From: Radek Czajka Date: Fri, 11 Dec 2020 12:39:19 +0000 (+0100) Subject: Fixes in the experimental converters. X-Git-Tag: 1.11.1~1 X-Git-Url: https://git.mdrn.pl/librarian.git/commitdiff_plain/d26d6a7fdcb2c6e26fd097532765b62fd17b429c?hp=e870e40d5fb975ba9ec0ec327014b3d16eea51e4 Fixes in the experimental converters. --- diff --git a/Makefile b/Makefile index e206641..38a3c9f 100644 --- 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 diff --git a/src/librarian/elements/figures/ilustr.py b/src/librarian/elements/figures/ilustr.py index 143132e..ee82b08 100644 --- a/src/librarian/elements/figures/ilustr.py +++ b/src/librarian/elements/figures/ilustr.py @@ -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'], } diff --git a/src/librarian/elements/figures/tabela.py b/src/librarian/elements/figures/tabela.py index 387041d..af4a436 100644 --- a/src/librarian/elements/figures/tabela.py +++ b/src/librarian/elements/figures/tabela.py @@ -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' } diff --git a/src/librarian/elements/footnotes/__init__.py b/src/librarian/elements/footnotes/__init__.py index 6e00385..d0a0bf1 100644 --- a/src/librarian/elements/footnotes/__init__.py +++ b/src/librarian/elements/footnotes/__init__.py @@ -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 diff --git a/src/librarian/elements/themes/end.py b/src/librarian/elements/themes/end.py index 32c6f36..0604e3d 100644 --- a/src/librarian/elements/themes/end.py +++ b/src/librarian/elements/themes/end.py @@ -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 diff --git a/src/librarian/elements/themes/motyw.py b/src/librarian/elements/themes/motyw.py index 3b68c8b..f9ab197 100644 --- a/src/librarian/elements/themes/motyw.py +++ b/src/librarian/elements/themes/motyw.py @@ -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, diff --git a/src/librarian/locale/pl/LC_MESSAGES/messages.po b/src/librarian/locale/pl/LC_MESSAGES/messages.po index e06828f..c81c458 100644 --- a/src/librarian/locale/pl/LC_MESSAGES/messages.po +++ b/src/librarian/locale/pl/LC_MESSAGES/messages.po @@ -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"