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,13 +5,33 @@ ${head_content}$
|
||||
</head>
|
||||
<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">
|
||||
Table of contents
|
||||
<h2>Table of contents</h2>
|
||||
${print toc()}$
|
||||
</div>
|
||||
|
||||
<div class="ebookContent">
|
||||
|
||||
${ebookContent}$
|
||||
|
||||
<div class="ebookNavigation">
|
||||
${if prevLink:}$
|
||||
<a href="${prevLink}$">previous page</a>
|
||||
${:endif}$
|
||||
@ -19,6 +39,11 @@ ${:endif}$
|
||||
${if nextLink:}$
|
||||
<a href="${nextLink}$">next page</a>
|
||||
${:endif}$
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
|
@ -14,14 +14,30 @@ ${:endfor}$
|
||||
</head>
|
||||
<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>
|
||||
|
||||
<h2>Table of contents</h2>
|
||||
|
||||
<div class="ebookContent">
|
||||
|
||||
<h1>Table of contents</h1>
|
||||
${toc}$
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@ -60,6 +60,7 @@ class HTMLOutput(OutputFormatPlugin):
|
||||
self.opts = opts
|
||||
output_file = output_path
|
||||
output_dir = re.sub(r'\.html', '', output_path)+'_files'
|
||||
meta=EasyMeta(oeb_book.metadata)
|
||||
if not exists(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)
|
||||
templite = Templite(P('templates/html_export_default_index.tmpl', data=True))
|
||||
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)
|
||||
|
||||
with CurrentDir(output_dir):
|
||||
@ -118,7 +119,7 @@ class HTMLOutput(OutputFormatPlugin):
|
||||
# render template
|
||||
templite = Templite(P('templates/html_export_default.tmpl', data=True))
|
||||
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
|
||||
with open(path, 'wb') as f:
|
||||
|
Loading…
x
Reference in New Issue
Block a user