1 from ..base import WLElement
 
   4 class Footnote(WLElement):
 
   5     def txt_build(self, builder):
 
   8     def html_build(self, builder):
 
   9         if not builder.with_footnotes:
 
  12         builder.footnote_counter += 1
 
  13         fn_no = builder.footnote_counter
 
  14         footnote_id = 'footnote-idm{}'.format(self.attrib['_compat_ordered_id'])
 
  15         anchor_id = 'anchor-idm{}'.format(self.attrib['_compat_ordered_id'])
 
  18         builder.start_element(
 
  21                 "href": '#{}'.format(footnote_id),
 
  22                 "class": "annotation-anchor",
 
  26         builder.push_text('[{}]'.format(fn_no))
 
  29         # Add actual footnote.
 
  30         builder.enter_fragment('footnotes')
 
  31         builder.start_element('div', {'class': 'fn-{}'.format(self.tag)})
 
  32         builder.push_text('\n') # Compat
 
  33         builder.start_element('a', {'name': footnote_id})
 
  35         builder.start_element('a', {
 
  36             'href': '#{}'.format(anchor_id), 'class': 'annotation'
 
  38         builder.push_text('[{}]'.format(fn_no))
 
  41         builder.start_element('p')
 
  42         super(Footnote, self).html_build(builder)
 
  44         builder.push_text(' [{}]'.format(self.qualifier))
 
  47         builder.exit_fragment()
 
  51     """Przypis autorski."""
 
  55         return _("author's footnote")
 
  59     """Przypis tłumacza."""
 
  63         return _("translator's footnote")
 
  67     """Przypis redakcyjny."""
 
  71         return _("editor's footnote")
 
  75     """Przypis redakcji źródła."""
 
  79         return _("source editor's footnote")