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 @@ +v1.3, 2018-09-01 -- Don't throw exception on invalid tokens. + Fix python 3 compatibility v1.2, 2018-08-27 -- Fix handling of unrecognized closing tags. v1.1, 2018-08-24 -- Initialize token_class dynamically. 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 @@ -96,25 +96,25 @@ def getwiki(url, options): m = re.match('(?P<url>(?:.+://)(?P<lang>.+?)\.(?P<root>wik(?:ipedia|tionary))\.org)', url) if m: options.lang = m.group('lang') options.kwdict['html_base'] = m.group('url') + '/wiki/' if m.group('root') == 'wiktionary': options.itype = 'wiktionary' options.kwdict['text'] = text.text.encode() def main(): usage = '%prog [OPTIONS] ARG' - version = '%prog 1.2' + version = '%prog 1.3' description = """Translates MediaWiki documents markup to various other formats. If ARG looks like a URL, the wiki text to be converted will be downloaded from that URL. Otherwise, if --base-url is given, ARG is treated as the name of the page to get from the WikiMedia istallation at that URL. Otherwise, ARG is name of the file to read wiki material from. """ epilog = "Report bugs to: <gray+wikitrans@gnu.org.ua>" parser = OptionParser(usage=usage, version=version, description=description, @@ -13,25 +13,25 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. from setuptools import setup, find_packages from codecs import open with open("README.rst", "r") as fh: long_description = fh.read() setup(name='wikitrans', - version='1.2', + version='1.3', author='Sergey Poznyakoff', author_email='gray@gnu.org', url='http://www.gnu.org.ua/projects/wikitrans', packages = find_packages(exclude=['contrib', 'docs', 'tests', 'testdata']), scripts=['bin/wikitrans'], license='GPL License', description='Wiki markup translator.', long_description=long_description, long_description_content_type="text/x-rst", platforms=['any'], test_suite='tests', diff --git a/wikitrans/wiki2html.py b/wikitrans/wiki2html.py index 0696dce..affe10b 100644 --- a/wikitrans/wiki2html.py +++ b/wikitrans/wiki2html.py @@ -1,15 +1,15 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# Copyright (C) 2008-2018 Sergey Poznyakoff +# Copyright (C) 2008-2021 Sergey Poznyakoff # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License @@ -168,27 +168,27 @@ class HtmlTagNode(WikiTagNode): return '<sup id="cite_ref-%d" class="reference"><a name="cite_ref-%d" href=#cite_note-%d">%d</a></sup>' % (n, n, n, n) elif self.tag == 'references': s = '<div class="references">\n' s += '<ol class="references">\n' n = 0 for ref in self.parser.references: n += 1 s += ('<li id="cite_note-%d">' + '<span class="mw-cite-backlink">' + '<b><a href="#cite_ref-%d">^</a></b>' + '</span>' + '<span class="reference-text">' - + ref.content.format() + + '%s' + '</span>' - + '</li>\n') % (n, n) + + '</li>\n') % (n, n, ref.content.format()) s += '</ol>\n</div>\n' return s else: s = '<' + self.tag if self.args: s += ' ' + str(self.args) s += '>' s += self.content.format() return s + '</' + self.tag + '>' class HtmlParaNode(HtmlSeqNode): diff --git a/wikitrans/wikimarkup.py b/wikitrans/wikimarkup.py index 1e2429f..6660808 100644 --- a/wikitrans/wikimarkup.py +++ b/wikitrans/wikimarkup.py @@ -650,25 +650,25 @@ class WikiMarkupParser(object): return None elif tok.type == 'DELIM': if tok.content == ']': break else: tok = self.parse_inline_delim(tok) if tok: seq.append(tok) else: self.dprint(80, "LEAVE parse_ref=None") return None elif tok.type == 'OTAG': - list.append(self.parse_tag(tok)) + seq.append(self.parse_tag(tok)) else: seq.append(tok) ret = self._new_node(type='REF', ref=ref, content=self._new_node(type='SEQ', content=seq)) self.dprint(80, "LEAVE parse_ref= %s", ret) return ret def parse_link(self, type, delim): """Parse an external link ([[...]]). In this implementation, it is also used to parse template |