Fixes in the experimental converters.
authorRadek Czajka <rczajka@rczajka.pl>
Fri, 11 Dec 2020 12:39:19 +0000 (13:39 +0100)
committerRadek Czajka <rczajka@rczajka.pl>
Fri, 11 Dec 2020 12:39:19 +0000 (13:39 +0100)
Makefile
src/librarian/elements/figures/ilustr.py
src/librarian/elements/figures/tabela.py
src/librarian/elements/footnotes/__init__.py
src/librarian/elements/themes/end.py
src/librarian/elements/themes/motyw.py
src/librarian/locale/pl/LC_MESSAGES/messages.po

index e206641..38a3c9f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
 locale:
        find src/librarian -name '*.py' |xargs xgettext --from-code utf-8 -o - | sed '/^"POT-Creation-Date:/d' > messages.pot
-       for lang in pl; do msgmerge -U src/librarian/locale/$${lang}/LC_MESSAGES/messages.po messages.pot; done
+       for lang in pl lt; do mkdir -p src/librarian/locale/$${lang}/LC_MESSAGES/; [ -e src/librarian/locale/$${lang}/LC_MESSAGES/messages.po ] && msgmerge -U src/librarian/locale/$${lang}/LC_MESSAGES/messages.po messages.pot || cp messages.pot src/librarian/locale/$${lang}/LC_MESSAGES/messages.po ; done
        rm messages.pot
        
index 143132e..ee82b08 100644 (file)
@@ -7,6 +7,6 @@ class Ilustr(WLElement):
     def get_html_attr(self, builder):
         return {
             'src': builder.image_location + self.attrib['src'],
-            'alt': self.attr['alt'],
-            'title': self.attr['alt'],
+            'alt': self.attrib['alt'],
+            'title': self.attrib['alt'],
         }
index 387041d..af4a436 100644 (file)
@@ -5,7 +5,7 @@ class Tabela(WLElement):
     HTML_TAG = 'table'
 
     def get_html_attr(self, builder):
-        if self.attrib['ramka'] == '1':
+        if self.attrib.get('ramka', '') == '1':
             return {
                 'class': 'border'
             }
index 6e00385..d0a0bf1 100644 (file)
@@ -14,10 +14,19 @@ class Footnote(WLElement):
         footnote_id = 'footnote-idm{}'.format(self.attrib['_compat_ordered_id'])
         anchor_id = 'anchor-idm{}'.format(self.attrib['_compat_ordered_id'])
 
-        builder.start_element('a', {"href": '#{}'.format(footnote_id), "class": "annotation"})
+        # Add anchor.
+        builder.start_element(
+            'a',
+            {
+                "href": '#{}'.format(footnote_id),
+                "class": "annotation-anchor",
+                "id": anchor_id,
+            }
+        )
         builder.push_text('[{}]'.format(fn_no))
         builder.end_element()
         
+        # Add actual footnote.
         builder.enter_fragment('footnotes')
         builder.start_element('div', {'class': 'fn-{}'.format(self.tag)})
         builder.push_text('\n') # Compat
index 32c6f36..0604e3d 100644 (file)
@@ -5,7 +5,7 @@ class End(WLElement):
     HTML_TAG = 'span'
 
     def get_html_attr(self, builder):
-        fid = self.attrib['id'][1:]
+        fid = self.attrib.get('id', '')[1:]
         return {
             "class": "theme-end",
             "fid": fid
index 3b68c8b..f9ab197 100644 (file)
@@ -12,7 +12,7 @@ class Motyw(WLElement):
             super(Motyw, self).html_build(builder)
 
     def get_html_attr(self, builder):
-        fid = self.attrib['id'][1:]
+        fid = self.attrib.get('id', '')[1:]
         return {
             "class": "theme-begin",
             "fid": fid,
index e06828f..c81c458 100644 (file)
@@ -17,26 +17,26 @@ msgstr ""
 "Content-Transfer-Encoding: 8bit\n"
 "X-Generator: Poedit 2.3\n"
 
-#: src/librarian/builders/html.py:77
+#: src/librarian/builders/html.py:84
 msgid "translated by"
 msgstr "tłum."
 
-#: src/librarian/builders/html.py:94
+#: src/librarian/builders/html.py:104
 msgid "Footnotes"
 msgstr "Przypisy"
 
-#: src/librarian/elements/footnotes/__init__.py:43
+#: src/librarian/elements/footnotes/__init__.py:55
 msgid "author's footnote"
 msgstr "przypis autorski"
 
-#: src/librarian/elements/footnotes/__init__.py:51
+#: src/librarian/elements/footnotes/__init__.py:63
 msgid "translator's footnote"
 msgstr "przypis tłumacza"
 
-#: src/librarian/elements/footnotes/__init__.py:59
+#: src/librarian/elements/footnotes/__init__.py:71
 msgid "editor's footnote"
 msgstr "przypis redakcyjny"
 
-#: src/librarian/elements/footnotes/__init__.py:67
+#: src/librarian/elements/footnotes/__init__.py:79
 msgid "source editor's footnote"
 msgstr "przypis edytorski"