fix
[librarian.git] / src / librarian / elements / footnotes / __init__.py
index 433e881..a94b968 100644 (file)
@@ -1,10 +1,22 @@
-# -*- coding: utf-8
-from __future__ import unicode_literals
-
+# This file is part of Librarian, licensed under GNU Affero GPLv3 or later.
+# Copyright © Fundacja Wolne Lektury. See NOTICE for more information.
+#
 from ..base import WLElement
 
 
 class Footnote(WLElement):
 from ..base import WLElement
 
 
 class Footnote(WLElement):
+    NO_TOC = True
+    DISABLE_NUMBERING = True
+    START_INLINE = True
+    ASIDE = True
+    NUMBERING = 'fn'
+
+    def signal(self, signal):
+        if signal == 'INLINE':
+            self.START_INLINE = False
+        else:
+            super().signal(signal)
+    
     def txt_build(self, builder):
         pass
 
     def txt_build(self, builder):
         pass
 
@@ -12,10 +24,9 @@ class Footnote(WLElement):
         if not builder.with_footnotes:
             return
 
         if not builder.with_footnotes:
             return
 
-        builder.footnote_counter += 1
-        fn_no = builder.footnote_counter
-        footnote_id = 'footnote-idm{}'.format(self.attrib['_compat_ordered_id'])
-        anchor_id = 'anchor-idm{}'.format(self.attrib['_compat_ordered_id'])
+        fn_no = self.attrib.get('_visible_numbering')
+        footnote_id = 'footnote-id{}'.format(fn_no)
+        anchor_id = 'anchor-id{}'.format(fn_no)
 
         # Add anchor.
         builder.start_element(
 
         # Add anchor.
         builder.start_element(
@@ -72,7 +83,7 @@ class Footnote(WLElement):
 
         
         builder.enter_fragment('footnotes')
 
         
         builder.enter_fragment('footnotes')
-        builder.start_element('p', {
+        builder.start_element('div', {
             'id': f'annotation-{fn_no}',
             'class': "annotation"
         })
             'id': f'annotation-{fn_no}',
             'class': "annotation"
         })