diff options
-rw-r--r-- | CHANGES.txt | 2 | ||||
-rwxr-xr-x | bin/wikitrans | 2 | ||||
-rw-r--r-- | setup.py | 2 | ||||
-rw-r--r-- | wikitrans/wiki2html.py | 6 | ||||
-rw-r--r-- | wikitrans/wikimarkup.py | 2 |
5 files changed, 8 insertions, 6 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index aa894f9..ebebda8 100644 --- a/CHANGES.txt +++ b/CHANGES.txt | |||
@@ -1,3 +1,5 @@ | |||
1 | v1.3, 2018-09-01 -- Don't throw exception on invalid tokens. | ||
2 | Fix python 3 compatibility | ||
1 | v1.2, 2018-08-27 -- Fix handling of unrecognized closing tags. | 3 | v1.2, 2018-08-27 -- Fix handling of unrecognized closing tags. |
2 | v1.1, 2018-08-24 -- Initialize token_class dynamically. | 4 | v1.1, 2018-08-24 -- Initialize token_class dynamically. |
3 | v1.0, 2018-08-19 -- Initial release. | 5 | v1.0, 2018-08-19 -- Initial release. |
diff --git a/bin/wikitrans b/bin/wikitrans index 09ba0b3..01c3f9c 100755 --- a/bin/wikitrans +++ b/bin/wikitrans | |||
@@ -102,13 +102,13 @@ def getwiki(url, options): | |||
102 | options.itype = 'wiktionary' | 102 | options.itype = 'wiktionary' |
103 | 103 | ||
104 | options.kwdict['text'] = text.text.encode() | 104 | options.kwdict['text'] = text.text.encode() |
105 | 105 | ||
106 | def main(): | 106 | def main(): |
107 | usage = '%prog [OPTIONS] ARG' | 107 | usage = '%prog [OPTIONS] ARG' |
108 | version = '%prog 1.2' | 108 | version = '%prog 1.3' |
109 | description = """Translates MediaWiki documents markup to various other formats. | 109 | description = """Translates MediaWiki documents markup to various other formats. |
110 | If ARG looks like a URL, the wiki text to be converted will be downloaded | 110 | If ARG looks like a URL, the wiki text to be converted will be downloaded |
111 | from that URL. | 111 | from that URL. |
112 | Otherwise, if --base-url is given, ARG is treated as the name of the page to | 112 | Otherwise, if --base-url is given, ARG is treated as the name of the page to |
113 | get from the WikiMedia istallation at that URL. | 113 | get from the WikiMedia istallation at that URL. |
114 | Otherwise, ARG is name of the file to read wiki material from. | 114 | Otherwise, ARG is name of the file to read wiki material from. |
@@ -19,13 +19,13 @@ from setuptools import setup, find_packages | |||
19 | from codecs import open | 19 | from codecs import open |
20 | 20 | ||
21 | with open("README.rst", "r") as fh: | 21 | with open("README.rst", "r") as fh: |
22 | long_description = fh.read() | 22 | long_description = fh.read() |
23 | 23 | ||
24 | setup(name='wikitrans', | 24 | setup(name='wikitrans', |
25 | version='1.2', | 25 | version='1.3', |
26 | author='Sergey Poznyakoff', | 26 | author='Sergey Poznyakoff', |
27 | author_email='gray@gnu.org', | 27 | author_email='gray@gnu.org', |
28 | url='http://www.gnu.org.ua/projects/wikitrans', | 28 | url='http://www.gnu.org.ua/projects/wikitrans', |
29 | packages = find_packages(exclude=['contrib', 'docs', | 29 | packages = find_packages(exclude=['contrib', 'docs', |
30 | 'tests', 'testdata']), | 30 | 'tests', 'testdata']), |
31 | scripts=['bin/wikitrans'], | 31 | scripts=['bin/wikitrans'], |
diff --git a/wikitrans/wiki2html.py b/wikitrans/wiki2html.py index 0696dce..affe10b 100644 --- a/wikitrans/wiki2html.py +++ b/wikitrans/wiki2html.py | |||
@@ -1,9 +1,9 @@ | |||
1 | #!/usr/bin/python | 1 | #!/usr/bin/python |
2 | # -*- coding: utf-8 -*- | 2 | # -*- coding: utf-8 -*- |
3 | # Copyright (C) 2008-2018 Sergey Poznyakoff | 3 | # Copyright (C) 2008-2021 Sergey Poznyakoff |
4 | # | 4 | # |
5 | # This program is free software; you can redistribute it and/or modify | 5 | # This program is free software; you can redistribute it and/or modify |
6 | # it under the terms of the GNU General Public License as published by | 6 | # it under the terms of the GNU General Public License as published by |
7 | # the Free Software Foundation; either version 3, or (at your option) | 7 | # the Free Software Foundation; either version 3, or (at your option) |
8 | # any later version. | 8 | # any later version. |
9 | # | 9 | # |
@@ -174,15 +174,15 @@ class HtmlTagNode(WikiTagNode): | |||
174 | n += 1 | 174 | n += 1 |
175 | s += ('<li id="cite_note-%d">' | 175 | s += ('<li id="cite_note-%d">' |
176 | + '<span class="mw-cite-backlink">' | 176 | + '<span class="mw-cite-backlink">' |
177 | + '<b><a href="#cite_ref-%d">^</a></b>' | 177 | + '<b><a href="#cite_ref-%d">^</a></b>' |
178 | + '</span>' | 178 | + '</span>' |
179 | + '<span class="reference-text">' | 179 | + '<span class="reference-text">' |
180 | + ref.content.format() | 180 | + '%s' |
181 | + '</span>' | 181 | + '</span>' |
182 | + '</li>\n') % (n, n) | 182 | + '</li>\n') % (n, n, ref.content.format()) |
183 | s += '</ol>\n</div>\n' | 183 | s += '</ol>\n</div>\n' |
184 | return s | 184 | return s |
185 | else: | 185 | else: |
186 | s = '<' + self.tag | 186 | s = '<' + self.tag |
187 | if self.args: | 187 | if self.args: |
188 | s += ' ' + str(self.args) | 188 | s += ' ' + str(self.args) |
diff --git a/wikitrans/wikimarkup.py b/wikitrans/wikimarkup.py index 1e2429f..6660808 100644 --- a/wikitrans/wikimarkup.py +++ b/wikitrans/wikimarkup.py | |||
@@ -656,13 +656,13 @@ class WikiMarkupParser(object): | |||
656 | if tok: | 656 | if tok: |
657 | seq.append(tok) | 657 | seq.append(tok) |
658 | else: | 658 | else: |
659 | self.dprint(80, "LEAVE parse_ref=None") | 659 | self.dprint(80, "LEAVE parse_ref=None") |
660 | return None | 660 | return None |
661 | elif tok.type == 'OTAG': | 661 | elif tok.type == 'OTAG': |
662 | list.append(self.parse_tag(tok)) | 662 | seq.append(self.parse_tag(tok)) |
663 | else: | 663 | else: |
664 | seq.append(tok) | 664 | seq.append(tok) |
665 | 665 | ||
666 | ret = self._new_node(type='REF', ref=ref, | 666 | ret = self._new_node(type='REF', ref=ref, |
667 | content=self._new_node(type='SEQ', content=seq)) | 667 | content=self._new_node(type='SEQ', content=seq)) |
668 | self.dprint(80, "LEAVE parse_ref= %s", ret) | 668 | self.dprint(80, "LEAVE parse_ref= %s", ret) |