diff --git a/mdpo/__init__.py b/mdpo/__init__.py index f6ae516b..eed2a42e 100644 --- a/mdpo/__init__.py +++ b/mdpo/__init__.py @@ -5,7 +5,7 @@ from mdpo.po2md import pofile_to_markdown -__version__ = '0.3.1' +__version__ = '0.3.2' __version_info__ = tuple([int(i) for i in __version__.split('.')]) __title__ = 'mdpo' __description__ = ('Markdown file translation utilities using pofiles') diff --git a/mdpo/md2po/__init__.py b/mdpo/md2po/__init__.py index 23658194..39efd6ae 100644 --- a/mdpo/md2po/__init__.py +++ b/mdpo/md2po/__init__.py @@ -397,11 +397,11 @@ def text(self, block, text): self._current_msgid[self._codespan_start_index:]) elif text == self.italic_start_string: text = self.italic_start_string_escaped - elif text == self.italic_end_string: - text = self.italic_end_string_escaped elif text == self.code_start_string: text = self.code_start_string_escaped - elif text == self.code_end_string: + elif text == self.italic_end_string: # pragma: no cover + text = self.italic_end_string_escaped + elif text == self.code_end_string: # pragma: no cover text = self.code_end_string_escaped if self._inside_pblock: text = text.replace("\n", " ") diff --git a/mdpo/mdpo2html/__init__.py b/mdpo/mdpo2html/__init__.py index f69b4427..39dad386 100644 --- a/mdpo/mdpo2html/__init__.py +++ b/mdpo/mdpo2html/__init__.py @@ -138,14 +138,18 @@ def _process_replacer(self): raw_html_template += '<%s' % handled - attrs_except_href_title = [] + # attrs_except_href_title = [] for attr, value in attrs: if attr in ['title', 'href']: raw_html_template += ' %s="{}"' % attr - else: - attrs_except_href_title.append(attr) - raw_html_template += html_attrs_tuple_to_string( - attrs_except_href_title) + '>' + # else: + # These attributes are not included in output + # attrs_except_href_title.append((attr, value)) + # if attrs_except_href_title: + # raw_html_template += ' ' + # raw_html_template += html_attrs_tuple_to_string( + # attrs_except_href_title) + '>' + raw_html_template += '>' else: raw_html_template += '<%s%s>' % ( handled, @@ -161,10 +165,7 @@ def _process_replacer(self): if all((ch in ALIGNMENT_CHARS) for ch in handled): raw_html_template += handled - if _last_start_tag in self.markup_tags: - _current_replacement += handled - else: - _current_replacement += handled + _current_replacement += handled else: raw_html_template += '{}' if _current_link_target: diff --git a/mdpo/po2md/__init__.py b/mdpo/po2md/__init__.py index cbbc13a2..a236e26c 100644 --- a/mdpo/po2md/__init__.py +++ b/mdpo/po2md/__init__.py @@ -420,12 +420,12 @@ def text(self, block, text): self._current_msgid[self._codespan_start_index:]) elif text == self.italic_start_string: text = self.italic_start_string_escaped - elif text == self.italic_end_string: - text = self.italic_end_string_escaped elif text == self.code_start_string: text = self.code_start_string_escaped - elif text == self.code_end_string: + elif text == self.code_end_string: # pragma: no cover text = self.code_end_string_escaped + elif text == self.italic_end_string: # pragma: no cover + text = self.italic_end_string_escaped if self._inside_pblock: text = text.replace("\n", " ") diff --git a/setup.cfg b/setup.cfg index 6ce883db..ae7a0af3 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,11 +1,11 @@ [bumpversion] -current_version = 0.3.1 +current_version = 0.3.2 [bumpversion:file:mdpo/__init__.py] [coverage:report] -exclude_lines = - pragma: no cover +exclude_lines = + pragma: no cover if __name__ == .__main__.: except ImportError: if '-h' in args or '--help' in args: diff --git a/test/test_mdpo2html/translate-examples/markuptext/a.html b/test/test_mdpo2html/translate-examples/markuptext/a.html index e0409476..831302c4 100644 --- a/test/test_mdpo2html/translate-examples/markuptext/a.html +++ b/test/test_mdpo2html/translate-examples/markuptext/a.html @@ -1,3 +1,5 @@

Some text followed by a link.

When the link starts the text.

+ +

Link with class.

\ No newline at end of file diff --git a/test/test_mdpo2html/translate-examples/markuptext/a.html.expect.html b/test/test_mdpo2html/translate-examples/markuptext/a.html.expect.html index 0da23bc6..d1a9262d 100644 --- a/test/test_mdpo2html/translate-examples/markuptext/a.html.expect.html +++ b/test/test_mdpo2html/translate-examples/markuptext/a.html.expect.html @@ -1,3 +1,5 @@

Algo de texto seguido de un enlace.

Cuando el enlace comienza el texto.

+ +

Link con clase.

\ No newline at end of file diff --git a/test/test_mdpo2html/translate-examples/markuptext/a.po b/test/test_mdpo2html/translate-examples/markuptext/a.po index ddd62e0b..247935c7 100644 --- a/test/test_mdpo2html/translate-examples/markuptext/a.po +++ b/test/test_mdpo2html/translate-examples/markuptext/a.po @@ -8,3 +8,6 @@ msgstr "Algo de texto seguido de [un enlace](https://falso.falsa)." msgid "[When the link](some/place \"a title\") starts the text." msgstr "[Cuando el enlace](algun/lugar \"un título\") comienza el texto." + +msgid "[Link with class](https://fake.fake)." +msgstr "[Link con clase](https://falso.falsa)."