diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2018-07-30 17:11:56 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2018-07-30 17:11:56 +0300 |
commit | 962837ceee4824e37590366ae6e64ba4293b5831 (patch) | |
tree | 7a4210aed3b86686ff014c65dc812e57516e1b3a | |
parent | 33911cd4ca1a0ef49b836900f21cd2df4e528f93 (diff) | |
download | wit-962837ceee4824e37590366ae6e64ba4293b5831.tar.gz wit-962837ceee4824e37590366ae6e64ba4293b5831.tar.bz2 |
* test.py: Prepend parent dir to the sys.path
* wiki2html.py: Use absolute imports
* wiki2texi.py: Likewise.
* wiki2text.py: Likewise.
(url_quote): Import from the appropriate module.
* wikimarkup.py: Make sure the object being split is a string.
-rw-r--r-- | test.py | 2 | ||||
-rw-r--r-- | wiki2html.py | 4 | ||||
-rw-r--r-- | wiki2texi.py | 4 | ||||
-rw-r--r-- | wiki2text.py | 18 | ||||
-rw-r--r-- | wikimarkup.py | 2 |
5 files changed, 18 insertions, 12 deletions
@@ -18,2 +18,4 @@ | |||
18 | from __future__ import print_function | 18 | from __future__ import print_function |
19 | import sys, os | ||
20 | sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.realpath(__file__)))) | ||
19 | import unittest | 21 | import unittest |
diff --git a/wiki2html.py b/wiki2html.py index 05d4642..abf851a 100644 --- a/wiki2html.py +++ b/wiki2html.py | |||
@@ -17,4 +17,4 @@ | |||
17 | 17 | ||
18 | from wikimarkup import * | 18 | from wit.wikimarkup import * |
19 | from wikins import wiki_ns_re, wiki_ns | 19 | from wit.wikins import wiki_ns_re, wiki_ns |
20 | import re | 20 | import re |
diff --git a/wiki2texi.py b/wiki2texi.py index 6e32c56..4ce32f9 100644 --- a/wiki2texi.py +++ b/wiki2texi.py | |||
@@ -17,4 +17,4 @@ | |||
17 | 17 | ||
18 | from wikimarkup import * | 18 | from wit.wikimarkup import * |
19 | from wikins import wiki_ns_re, wiki_ns | 19 | from wit.wikins import wiki_ns_re, wiki_ns |
20 | import re | 20 | import re |
diff --git a/wiki2text.py b/wiki2text.py index 916391e..5041ea0 100644 --- a/wiki2text.py +++ b/wiki2text.py | |||
@@ -17,6 +17,10 @@ | |||
17 | 17 | ||
18 | from wikimarkup import * | 18 | from wit.wikimarkup import * |
19 | from wikins import wiki_ns_re, wiki_ns | 19 | from wit.wikins import wiki_ns_re, wiki_ns |
20 | import re | 20 | import re |
21 | import urllib | 21 | try: |
22 | from urllib import quote as url_quote | ||
23 | except ImportError: | ||
24 | from urllib.parse import quote as url_quote | ||
25 | |||
22 | 26 | ||
@@ -64,3 +68,3 @@ class TextWikiMarkup (WikiMarkup): | |||
64 | lang = self.lang | 68 | lang = self.lang |
65 | return self.html_base % { 'lang' : lang } + urllib.quote(tgt) | 69 | return self.html_base % { 'lang' : lang } + url_quote(tgt) |
66 | 70 | ||
@@ -89,4 +93,4 @@ class TextWikiMarkup (WikiMarkup): | |||
89 | tgt = self.image_base + '/' + \ | 93 | tgt = self.image_base + '/' + \ |
90 | urllib.quote(tgt) + \ | 94 | url_quote(tgt) + \ |
91 | '/250px-' + urllib.quote(tgt) | 95 | '/250px-' + url_quote(tgt) |
92 | elif ns == 'NS_MEDIA': | 96 | elif ns == 'NS_MEDIA': |
@@ -114,3 +118,3 @@ class TextWikiMarkup (WikiMarkup): | |||
114 | s = "" | 118 | s = "" |
115 | for elt in text.split('\n'): | 119 | for elt in text.decode("utf-8").split('\n'): |
116 | if elt: | 120 | if elt: |
diff --git a/wikimarkup.py b/wikimarkup.py index 2ef6be1..9371d89 100644 --- a/wikimarkup.py +++ b/wikimarkup.py | |||
@@ -855,3 +855,3 @@ class WikiMarkup (BaseWikiMarkup): | |||
855 | elif kw == 'text': | 855 | elif kw == 'text': |
856 | self.text = keywords[kw].split("\n") | 856 | self.text = keywords[kw].decode("utf-8").split("\n") |
857 | elif kw == 'lang': | 857 | elif kw == 'lang': |