From 8d234da162626fd045f1c97367db08fdc37585f1 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 24 May 2013 10:28:46 +0530 Subject: [PATCH] Style the notes header the same as the first header in the document --- src/calibre/ebooks/docx/to_html.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/docx/to_html.py b/src/calibre/ebooks/docx/to_html.py index 698b5d01ea..9e4aec8072 100644 --- a/src/calibre/ebooks/docx/to_html.py +++ b/src/calibre/ebooks/docx/to_html.py @@ -83,11 +83,13 @@ class Convert(object): p = self.convert_p(wp) self.body.append(p) + notes_header = None if self.footnotes.has_notes: dl = DL() dl.set('class', 'notes') self.body.append(H1(self.notes_text)) - self.body[-1].set('class', 'notes-header') + notes_header = self.body[-1] + notes_header.set('class', 'notes-header') self.body.append(dl) for anchor, text, note in self.footnotes: dl.append(DT('[', A('←' + text, href='#back_%s' % anchor, title=text), id=anchor)) @@ -135,6 +137,14 @@ class Convert(object): if cls: html_obj.set('class', cls) + if notes_header is not None: + for h in self.body.iterchildren('h1', 'h2', 'h3'): + notes_header.tag = h.tag + cls = h.get('class', None) + if cls and cls != 'notes-header': + notes_header.set('class', '%s notes-header' % cls) + break + self.write() def read_page_properties(self, doc):