fnp
/
librarian.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
more rights flexibility
[librarian.git]
/
librarian
/
html.py
diff --git
a/librarian/html.py
b/librarian/html.py
index
997f904
..
39e5a01
100644
(file)
--- a/
librarian/html.py
+++ b/
librarian/html.py
@@
-228,10
+228,12
@@
def add_table_of_contents(root):
if any_ancestor(element, lambda e: e.get('id') in ('footnotes',) or e.get('class') in ('person-list',)):
continue
if any_ancestor(element, lambda e: e.get('id') in ('footnotes',) or e.get('class') in ('person-list',)):
continue
+ element_text = etree.tostring(element, method='text',
+ encoding=unicode).strip()
if element.tag == 'h3' and len(sections) and sections[-1][1] == 'h2':
if element.tag == 'h3' and len(sections) and sections[-1][1] == 'h2':
- sections[-1][3].append((counter, element.tag,
''.join(element.xpath('text()'))
, []))
+ sections[-1][3].append((counter, element.tag,
element_text
, []))
else:
else:
- sections.append((counter, element.tag,
''.join(element.xpath('text()'))
, []))
+ sections.append((counter, element.tag,
element_text
, []))
add_anchor(element, "s%d" % counter, with_link=False)
counter += 1
add_anchor(element, "s%d" % counter, with_link=False)
counter += 1