feat(api): Merge PDF Templates

This commit is contained in:
TheOnlyWayUp
2024-12-10 18:34:27 +00:00
parent 90139b190b
commit 758b14fd15
5 changed files with 386 additions and 300 deletions
-95
View File
@@ -1,95 +0,0 @@
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>About the Author</title>
<style>
/* Reset */
body, html {
margin: 0;
padding: 0;
height: 100%;
}
body {
font-family: Arial, sans-serif;
background-color: #f3f4f6;
}
/* Container centering for older browsers */
#author-container {
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%); /* Old WebKit */
transform: translate(-50%, -50%);
width: 90%;
max-width: 400px;
text-align: center;
}
#author-about {
padding: 20px;
/* Fallback for older browsers */
display: block;
margin: 0 auto;
}
#author-profile-picture {
width: 200px;
height: 200px;
-webkit-border-radius: 100px; /* Old WebKit */
border-radius: 100px;
margin: 0 auto 20px auto;
display: block;
}
#author-name {
font-size: 24px;
font-weight: bold;
margin: 0 0 10px 0;
padding: 0;
}
#author-link {
color: #1a202c;
text-decoration: none;
}
#author-link:hover {
color: #4a5568;
text-decoration: underline;
}
#author-divider {
width: 60px;
height: 2px;
background-color: #d1d5db;
border: none;
margin: 0 auto 20px auto;
}
#author-bio {
color: #4b5563;
line-height: 1.6;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<h1>About the Author</h1>
<div id="author-container">
<div id="author-about">
{avatar}
<h2 id="author-name"><a href="https://wattpad.com/user/{username}" id="author-link">{username}</a></h2>
<hr id="author-divider">
<p id="author-bio">
{description}
</p>
</div>
</div>
</body>
</html>
+54
View File
@@ -0,0 +1,54 @@
<!DOCTYPE html>
<html lang="{langcode}">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{book_title}</title>
<section class="fullpage">
<img src="{cover}" alt="Cover">
</section>
<div id="copyright-container">
<h1 id="copyright-notice">Copyright Notice</h1>
<h2 id="copyright-title">{book_title}</h2>
<p id="copyright-author">By {author}</p>
<div id="copyright-separator"></div>
<p id="copyright-ex-libris">Ex Libris Sapientiae</p>
<div id="copyright-separator"></div>
{copyright_image}
<p id="copyright-copyright">{statement}</p>
<p id="copyright-rights">{freedoms}</p>
<p id="copyright-printing">Printing: {printing}</p>
<p id="copyright-printing">ID: {book_id}. <a href="https://wattpad.com/story/{book_id}" target="_blank" id="copyright-link">View this Book Online</a></p>
</div>
<div id="book">
</div>
<h1>About the Author</h1>
<div id="author-container">
<div id="author-about">
{avatar}
<h2 id="author-name"><a href="https://wattpad.com/user/{username}" id="author-link">{username}</a></h2>
<hr id="author-divider">
<p id="author-bio">
{description}
</p>
</div>
</div>
</html>
-171
View File
@@ -1,171 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Copyright Page</title>
<style>
html, body {
height: 100%;
margin: 0;
padding: 0;
background-color: #f8f8f8;
}
body {
text-align: center; /* For inline-block fallback centering */
line-height: 1.5;
}
#copyright-container {
position: relative;
margin: 20px auto;
width: 100%; /* Make it span the entire page */
max-width: 100%; /* Ensures no unintended shrinking */
/* Styling */
background-color: #ffffff;
border: 1px solid #e2e8f0;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
padding: 2rem;
text-align: center;
/* Old WebKit Box Model Compatibility */
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
/* Center the text content */
text-align: center;
}
#copyright-notice {
font-size: 2rem;
color: #2d3748;
margin-bottom: 1rem;
}
#copyright-title {
font-size: 1.8rem;
color: #2d3748;
margin-top: 1rem;
margin-bottom: 2rem;
line-height: 1.4;
}
#copyright-ex-libris {
font-size: 1.5rem;
font-style: italic;
color: #4a5568;
margin: 2rem 0;
}
#copyright-separator {
width: 100%;
max-width: 400px;
height: 1px;
background: #e2e8f0;
position: relative;
margin: 2rem auto;
/* Gradient fallback */
background: -webkit-gradient(linear, left top, right top, from(transparent), color-stop(#718096), to(transparent));
background: -webkit-linear-gradient(left, transparent, #718096, transparent);
background: -moz-linear-gradient(left, transparent, #718096, transparent);
background: -o-linear-gradient(left, transparent, #718096, transparent);
background: linear-gradient(to right, transparent, #718096, transparent);
}
#copyright-info {
max-width: 400px;
margin: 0 auto;
font-family: 'Garamond', Georgia, serif;
}
#copyright-statement {
font-size: 0.9rem;
line-height: 1.6;
color: #2d3748;
margin-bottom: 1rem;
}
#copyright-freedoms,
#copyright-printing,
#copyright-isbn {
font-size: 0.8rem;
color: #718096;
margin-bottom: 0.8rem;
}
#copyright-book-link {
font-size: 0.9rem;
color: #3182ce;
text-decoration: none;
display: inline-block;
margin-top: 1rem;
/* Cross-browser transition */
-webkit-transition: all 0.2s ease;
-moz-transition: all 0.2s ease;
-o-transition: all 0.2s ease;
transition: all 0.2s ease;
}
#copyright-book-link:hover {
text-decoration: underline;
color: #2c5282;
}
/* Simple horizontal line instead of decorative separator for older browsers */
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
#copyright-separator {
border-top: 1px solid #718096;
background: none;
}
}
</style>
</head>
<body>
<div style="text-align: center; margin-top: 20px;">
<img width="993" height="1404" src="{cover}" alt="Book Cover" />
</div>
<div id="copyright-container">
<h1 id="copyright-notice">Copyright Notice</h1>
<h2 id="copyright-title">{book_title}</h2>
<div id="copyright-separator"></div>
<p id="copyright-ex-libris">Ex Libris Sapientiae</p>
<div id="copyright-separator"></div>
<div id="copyright-info">
{copyright_image}
<p id="copyright-statement">
{statement}
</p>
<p id="copyright-freedoms">
{freedoms}
</p>
<p id="copyright-printing">
Printing: {printing}
</p>
<p id="copyright-isbn">
ID: {book_id}
</p>
<a href="https://wattpad.com/story/{book_id}" id="copyright-book-link">
View Book Online
</a>
</div>
</div>
<div id="copyright-container">
<p>Generated using WattpadDownloader.</p>
<p><a href="https://wpd.rambhat.la/donate">Buy me a coffee</a>, your donations keep this software free and public for everyone.</p>
</div>
</body>
</html>
-30
View File
@@ -1,30 +0,0 @@
<!DOCTYPE html>
<html><head><script>
function subst() {
var vars = {};
var query_strings_from_url = document.location.search.substring(1).split('&');
for (var query_string in query_strings_from_url) {
if (query_strings_from_url.hasOwnProperty(query_string)) {
var temp_var = query_strings_from_url[query_string].split('=', 2);
vars[temp_var[0]] = decodeURI(temp_var[1]);
}
}
var css_selector_classes = ['page', 'frompage', 'topage', 'webpage', 'section', 'subsection', 'date', 'isodate', 'time', 'title', 'doctitle', 'sitepage', 'sitepages'];
for (var css_class in css_selector_classes) {
if (css_selector_classes.hasOwnProperty(css_class)) {
var element = document.getElementsByClassName(css_selector_classes[css_class]);
for (var j = 0; j < element.length; ++j) {
element[j].textContent = vars[css_selector_classes[css_class]];
}
}
}
}
</script></head><body style="border:0; margin: 0;" onload="subst()">
<table style="border-bottom: 1px solid black; width: 100%">
<tr>
<td style="text-align:right">
<strong style="margin-right: 5px;"><span class="section"></span></strong> | <span class="page" style="margin-left: 5px;"></span>
</td>
</tr>
</table>
</body></html>
+331 -3
View File
@@ -52,10 +52,114 @@
h1 {
@page {
margin: 2cm 2cm 3cm 2cm;
size: 148mm 210mm;
}
@page :left {
@bottom-left {
content: counter(page);
position: absolute;
z-index: -1;
}
@bottom-right {
content: string(heading);
position: absolute;
z-index: -1;
}
}
@page :right {
@bottom-left {
content: string(heading);
position: absolute;
z-index: -1;
}
@bottom-right {
content: counter(page);
position: absolute;
z-index: -1;
}
}
@page full {
@bottom-right {
content: none;
}
@bottom-left {
content: none;
}
background: black;
margin: 0;
}
@page :blank {
@bottom-right {
content: none;
}
@bottom-left {
content: none;
}
}
@page clean {
@bottom-right {
content: none;
}
@bottom-left {
content: none;
}
}
html {
counter-reset: h2-counter;
font-size: 10pt;
}
body {
margin: 0;
}
p {
line-height: 2;
text-align: justify;
}
img {
display: block;
margin: 2em auto;
max-width: 70%;
}
#contents {
border-bottom: 1px dashed rgb(100,000,100);
h2 {
font-family: "PT Serif", serif;
font-weight: 400;
font-style: normal;
}
padding-top: 5px;
}
.chapter-title {
counter-increment: h2-counter;
display: flex;
flex-direction: column;
font-size: 3em;
height: 6cm;
justify-content: flex-end;
margin: 0;
string-set: heading content();
text-align: center; text-align: center;
font-family: "PT Serif", serif !important;
font-weight: 700 !important; font-family: "PT Serif", serif;
font-weight: 700;
font-style: normal !important; font-style: normal !important;
font-size: 36px !important; /* Uniform size */ font-size: 36px !important; /* Uniform size */
margin-bottom: 20px; /* Space below the heading */ margin-bottom: 20px; /* Space below the heading */
@@ -63,12 +167,84 @@ h1 {
padding-bottom: 10px; /* Space between text and line */ padding-bottom: 10px; /* Space between text and line */
} }
p { p {
font-size: 16px !important; /* Standardize paragraph size */ font-size: 16px !important; /* Standardize paragraph size */
line-height: 1.6 !important; /* Improve readability */ line-height: 1.6 !important; /* Improve readability */
margin: 10px 0 !important; /* Space between paragraphs */ margin: 10px 0 !important; /* Space between paragraphs */
} }
.chapter-title::before {
content: "Chapter " counter(h2-counter) " ";
display: block;
font-size: 1.2rem;
font-weight: normal;
line-height: 1;
}
section {
break-after: right;
}
#contents {
page: clean;
}
#contents p {
font-size: 2em;
}
#contents ul {
display: block;
margin: 1em 0;
padding: 0;
}
#contents li {
display: block;
}
#contents a {
color: inherit;
text-decoration: none;
}
#contents a::before {
content: target-counter(attr(href), h2-counter) '. ' target-text(attr(href));
width: 100%;
}
#contents a::after {
content: target-counter(attr(href), page);
text-align: end;
}
.outro {
border-radius: 50% 50% 0 0 / 15mm 15mm 0 0;
display: block;
height: 90mm;
left: -30mm;
max-width: none;
object-fit: cover;
position: absolute;
top: 120mm;
width: 168mm;
z-index: -1;
}
.fullpage {
page: full;
}
.fullpage img {
bottom: 0;
height: 210mm;
left: 0;
margin: 0;
max-width: none;
object-fit: cover;
position: absolute;
width: 148mm;
z-index: 1;
}
.fullpage:last-child {
break-before: left;
}
a { a {
font-size: 0.9rem; font-size: 0.9rem;
@@ -88,3 +264,155 @@ a:hover {
text-decoration: underline; text-decoration: underline;
color: #2c5282; color: #2c5282;
} }
/* Container centering for older browsers */
#author-container {
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%); /* Old WebKit */
transform: translate(-50%, -50%);
width: 90%;
max-width: 400px;
text-align: center;
}
#author-about {
padding: 20px;
/* Fallback for older browsers */
display: block;
margin: 0 auto;
}
#author-profile-picture {
width: 200px;
height: 200px;
-webkit-border-radius: 100px; /* Old WebKit */
border-radius: 100px;
margin: 0 auto 20px auto;
display: block;
}
#author-name {
font-size: 24px;
font-weight: bold;
margin: 0 0 10px 0;
padding: 0;
}
#author-link {
color: #1a202c;
text-decoration: none;
}
#author-link:hover {
color: #4a5568;
text-decoration: underline;
}
#author-divider {
width: 60px;
height: 2px;
background-color: #d1d5db;
border: none;
margin: 0 auto 20px auto;
}
#author-bio {
color: #4b5563;
line-height: 1.6;
margin: 0;
padding: 0;
}
#copyright-container {
max-width: 600px;
margin: 60px auto;
text-align: center !important;
font-family: Georgia, serif !important;
line-height: 1.6 !important;
color: #333 !important;
}
#copyright-notice {
font-size: 24px;
margin-bottom: 4px;
border-bottom: 1px solid #333;
padding-bottom: 8px;
color: #1a1a1a;
}
#copyright-title {
font-size: 28px;
margin: 24px 0 4px 0;
color: #1a1a1a;
}
#copyright-author {
font-size: 18px;
margin: 0 0 32px 0;
color: #444;
text-align: center;
}
#copyright-license-image {
margin: 20px 0;
width: 88px;
height: 31px;
display: block;
margin-left: auto;
margin-right: auto;
}
#copyright-copyright {
font-size: 16px;
margin: 16px 0;
text-align: center;
}
#copyright-rights {
font-size: 14px;
color: #666;
margin: 8px 0;
text-align: center;
}
#copyright-printing {
font-size: 14px;
color: #666;
margin: 8px 0;
text-align: center;
}
#copyright-separator {
width: 100%;
max-width: 400px;
height: 1px;
background: #e2e8f0;
position: relative;
margin: 2rem 1rem;
/* Gradient fallback */
background: -webkit-gradient(linear, left top, right top, from(transparent), color-stop(#718096), to(transparent));
background: -webkit-linear-gradient(left, transparent, #718096, transparent);
background: -moz-linear-gradient(left, transparent, #718096, transparent);
background: -o-linear-gradient(left, transparent, #718096, transparent);
background: linear-gradient(to right, transparent, #718096, transparent);
}
#copyright-ex-libris {
font-size: 1.5rem;
font-style: italic;
color: #4a5568;
margin: 2rem 0;
text-align: center;
}
#copyright-link {
font-size: 14px;
}