diff --git a/resources/templates/html_export_default.tmpl b/resources/templates/html_export_default.tmpl index 4fa20d8662..c0559cf2e7 100644 --- a/resources/templates/html_export_default.tmpl +++ b/resources/templates/html_export_default.tmpl @@ -5,20 +5,45 @@ ${head_content}$ +
+
+ ${pos1=1}$ + ${for title in meta.titles():}$ + ${if pos1:}$ +

${print title}$

+ ${:else:}$ +
${print title}$
+ ${:endif}$ + ${pos1=0}$ + ${:endfor}$ +
+
+ ${print ', '.join(meta.creators())}$ +
+
+
- Table of contents +

Table of contents

${print toc()}$
-${ebookContent}$ +
+ + ${ebookContent}$ + +
+ ${if prevLink:}$ + previous page + ${:endif}$ + + ${if nextLink:}$ + next page + ${:endif}$ +
+ +
-${if prevLink:}$ -previous page -${:endif}$ -${if nextLink:}$ -next page -${:endif}$ diff --git a/resources/templates/html_export_default_index.tmpl b/resources/templates/html_export_default_index.tmpl index 6184099bd4..46531d322f 100644 --- a/resources/templates/html_export_default_index.tmpl +++ b/resources/templates/html_export_default_index.tmpl @@ -14,14 +14,30 @@ ${:endfor}$ -${for title in meta.titles():}$ -

${print title}$

-${:endfor}$ +
+
+ ${pos1=1}$ + ${for title in meta.titles():}$ + ${if pos1:}$ +

${print title}$

+ ${:else:}$ +
${print title}$
+ ${:endif}$ + ${pos1=0}$ + ${:endfor}$ +
+
+ ${print ', '.join(meta.creators())}$ +
+
-${print ', '.join(meta.creators())}$ +

Table of contents

-

Table of contents

-${toc}$ +
+ + ${toc}$ + +
diff --git a/src/calibre/ebooks/html/output.py b/src/calibre/ebooks/html/output.py index df45854d78..af216f789d 100644 --- a/src/calibre/ebooks/html/output.py +++ b/src/calibre/ebooks/html/output.py @@ -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: