From: Marek Stępniowski Date: Wed, 17 Sep 2008 09:56:36 +0000 (+0200) Subject: Don't add footnotes to table of contents. X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/845c06b87c63cc732de3acbf70040ae1c2036079?ds=inline Don't add footnotes to table of contents. --- diff --git a/lib/librarian/html.py b/lib/librarian/html.py index 94514df3c..13cef6520 100644 --- a/lib/librarian/html.py +++ b/lib/librarian/html.py @@ -203,6 +203,9 @@ def add_table_of_contents(root): for element in root.iterdescendants(): if element.tag in ('h2', 'h3'): + if any_ancestor(element, lambda e: e.get('id') in ('footnotes')): + continue + if element.tag == 'h3' and len(sections) and sections[-1][0] == 'h2': sections[-1][2].append((element.tag, ''.join(element.xpath('descendant-or-self::text()')), [])) else: