mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -04:00
output improvements
This commit is contained in:
parent
eadf98bfd0
commit
c98887eddb
@ -5,20 +5,45 @@ ${head_content}$
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
<div class="meta">
|
||||||
|
<div class="metaTitle">
|
||||||
|
${pos1=1}$
|
||||||
|
${for title in meta.titles():}$
|
||||||
|
${if pos1:}$
|
||||||
|
<h1>${print title}$</h1>
|
||||||
|
${:else:}$
|
||||||
|
<div class="metaSubtitle">${print title}$</div>
|
||||||
|
${:endif}$
|
||||||
|
${pos1=0}$
|
||||||
|
${:endfor}$
|
||||||
|
</div>
|
||||||
|
<div class="metaAuthor">
|
||||||
|
${print ', '.join(meta.creators())}$
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="toc">
|
<div class="toc">
|
||||||
Table of contents
|
<h2>Table of contents</h2>
|
||||||
${print toc()}$
|
${print toc()}$
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
${ebookContent}$
|
<div class="ebookContent">
|
||||||
|
|
||||||
|
${ebookContent}$
|
||||||
|
|
||||||
|
<div class="ebookNavigation">
|
||||||
|
${if prevLink:}$
|
||||||
|
<a href="${prevLink}$">previous page</a>
|
||||||
|
${:endif}$
|
||||||
|
|
||||||
|
${if nextLink:}$
|
||||||
|
<a href="${nextLink}$">next page</a>
|
||||||
|
${:endif}$
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
${if prevLink:}$
|
|
||||||
<a href="${prevLink}$">previous page</a>
|
|
||||||
${:endif}$
|
|
||||||
|
|
||||||
${if nextLink:}$
|
|
||||||
<a href="${nextLink}$">next page</a>
|
|
||||||
${:endif}$
|
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
@ -14,14 +14,30 @@ ${:endfor}$
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
${for title in meta.titles():}$
|
<div class="meta">
|
||||||
<h1>${print title}$</h1>
|
<div class="metaTitle">
|
||||||
${:endfor}$
|
${pos1=1}$
|
||||||
|
${for title in meta.titles():}$
|
||||||
|
${if pos1:}$
|
||||||
|
<h1>${print title}$</h1>
|
||||||
|
${:else:}$
|
||||||
|
<div class="metaSubtitle">${print title}$</div>
|
||||||
|
${:endif}$
|
||||||
|
${pos1=0}$
|
||||||
|
${:endfor}$
|
||||||
|
</div>
|
||||||
|
<div class="metaAuthor">
|
||||||
|
${print ', '.join(meta.creators())}$
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
${print ', '.join(meta.creators())}$
|
<h2>Table of contents</h2>
|
||||||
|
|
||||||
<h1>Table of contents</h1>
|
<div class="ebookContent">
|
||||||
${toc}$
|
|
||||||
|
${toc}$
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -60,6 +60,7 @@ class HTMLOutput(OutputFormatPlugin):
|
|||||||
self.opts = opts
|
self.opts = opts
|
||||||
output_file = output_path
|
output_file = output_path
|
||||||
output_dir = re.sub(r'\.html', '', output_path)+'_files'
|
output_dir = re.sub(r'\.html', '', output_path)+'_files'
|
||||||
|
meta=EasyMeta(oeb_book.metadata)
|
||||||
if not exists(output_dir):
|
if not exists(output_dir):
|
||||||
os.makedirs(output_dir)
|
os.makedirs(output_dir)
|
||||||
|
|
||||||
@ -68,7 +69,7 @@ class HTMLOutput(OutputFormatPlugin):
|
|||||||
html_toc = self.generate_html_toc(oeb_book, output_file, output_dir)
|
html_toc = self.generate_html_toc(oeb_book, output_file, output_dir)
|
||||||
templite = Templite(P('templates/html_export_default_index.tmpl', data=True))
|
templite = Templite(P('templates/html_export_default_index.tmpl', data=True))
|
||||||
print oeb_book.metadata.items
|
print oeb_book.metadata.items
|
||||||
t = templite.render(toc=html_toc, meta=EasyMeta(oeb_book.metadata))
|
t = templite.render(toc=html_toc, meta=meta)
|
||||||
f.write(t)
|
f.write(t)
|
||||||
|
|
||||||
with CurrentDir(output_dir):
|
with CurrentDir(output_dir):
|
||||||
@ -118,7 +119,7 @@ class HTMLOutput(OutputFormatPlugin):
|
|||||||
# render template
|
# render template
|
||||||
templite = Templite(P('templates/html_export_default.tmpl', data=True))
|
templite = Templite(P('templates/html_export_default.tmpl', data=True))
|
||||||
toc = lambda: self.generate_html_toc(oeb_book, path, output_dir)
|
toc = lambda: self.generate_html_toc(oeb_book, path, output_dir)
|
||||||
t = templite.render(ebookContent=ebook_content, prevLink=prevLink, nextLink=nextLink, toc=toc, head_content=head_content)
|
t = templite.render(ebookContent=ebook_content, prevLink=prevLink, nextLink=nextLink, toc=toc, head_content=head_content, meta=meta)
|
||||||
|
|
||||||
# write html to file
|
# write html to file
|
||||||
with open(path, 'wb') as f:
|
with open(path, 'wb') as f:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user