summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2018-09-01 22:31:44 +0300
committerSergey Poznyakoff <gray@gnu.org>2018-09-01 22:31:44 +0300
commit95752e413d7407c184f42bca61c659e37a3f9b46 (patch)
treebe4f9457de323e707132a60fcccffd6e3cb79652
parent5320bea15e388200e613e6a2bdac3c1449030986 (diff)
downloadwikitrans-95752e413d7407c184f42bca61c659e37a3f9b46.tar.gz
wikitrans-95752e413d7407c184f42bca61c659e37a3f9b46.tar.bz2
Version 1.3v1.3
-rw-r--r--CHANGES.txt2
-rwxr-xr-xbin/wikitrans2
-rw-r--r--setup.py2
3 files changed, 4 insertions, 2 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
@@ -84,49 +84,49 @@ def getwiki(url, options):
root = etree.fromstring(u.read())
else:
import urllib
urllib.urlretrieve(url, tmp.name)
root = etree.parse(tmp.name).getroot()
ns = { 'wiki':'' }
if 'version' in root.attrib:
ns['wiki'] = 'http://www.mediawiki.org/xml/export-%s/' % root.attrib['version']
text = root.find('wiki:page/wiki:revision/wiki:text',ns)
if text is None:
print("no page/revision/text element in the downloaded page")
exit(0)
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,
epilog=epilog)
parser.add_option('-v', '--verbose',
action="count", dest="verbose",
help="verbose operation")
parser.add_option('-I', '--input-type',
action='store', type='string', dest='itype',
default='default',
help='set input document type ("default" or "wiktionary")')
parser.add_option('-t', '--to', '--type',
action='store', type='string', dest='otype',
default='html',
help='set output document type ("html" (default), "texi" or "text")')
diff --git a/setup.py b/setup.py
index d1e10e7..d5d59d0 100644
--- a/setup.py
+++ b/setup.py
@@ -1,48 +1,48 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2008-2018 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
# 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',
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'License :: OSI Approved :: GNU General Public License (GPL)',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Text Processing :: Markup'
],
keywords = 'mediawiki markup translation',
)

Return to:

Send suggestions and report system problems to the System administrator.