summaryrefslogtreecommitdiffabout
path: root/wikitrans
authorSergey Poznyakoff <gray@gnu.org>2018-08-17 13:11:53 (GMT)
committer Sergey Poznyakoff <gray@gnu.org>2018-08-17 13:11:53 (GMT)
commitad4a97d83528b00e76435d3d2674ff05a44bd398 (patch) (side-by-side diff)
treeb2a85bcc5cd8d65a1f9c84b1b8e8e68ee3a748ff /wikitrans
parentf566ec604f8753f869119389072a023cd4909e7f (diff)
downloadwikitrans-ad4a97d83528b00e76435d3d2674ff05a44bd398.tar.gz
wikitrans-ad4a97d83528b00e76435d3d2674ff05a44bd398.tar.bz2
Fix the default html_base. Update docs.
Diffstat (limited to 'wikitrans') (more/less context) (ignore whitespace changes)
-rw-r--r--wikitrans/wiki2html.py25
-rw-r--r--wikitrans/wiki2texi.py14
-rw-r--r--wikitrans/wiki2text.py14
-rw-r--r--wikitrans/wikimarkup.py25
4 files changed, 44 insertions, 34 deletions
diff --git a/wikitrans/wiki2html.py b/wikitrans/wiki2html.py
index ce65bae..fc6b142 100644
--- a/wikitrans/wiki2html.py
+++ b/wikitrans/wiki2html.py
@@ -219,26 +219,11 @@ class HtmlWikiMarkup(WikiMarkup):
def __init__(self, *args, **kwargs):
"""Create a HtmlWikiMarkup object.
- Arguments:
+ HtmlWikiMarkup([filename=FILE],[file=FD],[text=STRING],[lang=CODE],
+ [html_base=URL],[image_base=URL],[media_base=URL])
- filename=FILE
- Read Wiki material from the file named FILE.
- file=FD
- Read Wiki material from file object FD.
- text=STRING
- Read Wiki material from STRING.
- lang=CODE
- Specifies source language. Default is 'en'. This variable can be
- referred to as '%(lang)s' in the keyword arguments below.
- html_base=URL
- Base URL for cross-references. Default is
- 'http://%(lang)s.wiktionary.org/wiki/'
- image_base=URL
- Base URL for images. Default is
- 'http://upload.wikimedia.org/wikipedia/commons/thumb/a/bf'
- media_base=URL
- Base URL for media files. Default is
- 'http://www.mediawiki.org/xml/export-0.3'
+ The arguments have the same meaning as in the WikiMarkup constructor.
+
"""
super(HtmlWikiMarkup, self).__init__(*args, **kwargs)
@@ -318,3 +303,5 @@ class HtmlWiktionaryMarkup(HtmlWikiMarkup):
Reserved for future use. Currently does the same as HtmlWikiMarkup.
"""
+
+ html_base='http://%(lang)s.wiktionary.org/wiki/'
diff --git a/wikitrans/wiki2texi.py b/wikitrans/wiki2texi.py
index d9e5f52..55dffe2 100644
--- a/wikitrans/wiki2texi.py
+++ b/wikitrans/wiki2texi.py
@@ -311,14 +311,14 @@ class TexiWikiMarkup(WikiMarkup):
def __init__(self, *args, **keywords):
"""Create a TexiWikiMarkup object.
- Arguments:
+ TexiWikiMarkup([filename=FILE],[file=FD],[text=STRING],[lang=CODE],
+ [html_base=URL],[image_base=URL],[media_base=URL],
+ [sectioning_model=MODEL],[sectioning_start=N])
- filename=FILE
- Read Wiki material from the file named FILE.
- file=FD
- Read Wiki material from file object FD.
- text=STRING
- Read Wiki material from STRING.
+ For a discussion of generic arguments, see the constructor of
+ the WikiMarkup class.
+
+ Additional arguments:
sectioning_model=MODEL
Select the Texinfo sectioning model for the output document. Possible
diff --git a/wikitrans/wiki2text.py b/wikitrans/wiki2text.py
index 1fbc61b..88e7610 100644
--- a/wikitrans/wiki2text.py
+++ b/wikitrans/wiki2text.py
@@ -247,14 +247,13 @@ class TextWikiMarkup(WikiMarkup):
def __init__(self, *args, **keywords):
"""Create a TextWikiMarkup object.
- Arguments:
+ TextWikiMarkup([filename=FILE],[file=FD],[text=STRING],[lang=CODE],
+ [html_base=URL],[image_base=URL],[media_base=URL],
+ [width=N],[show_urls=False])
- filename=FILE
- Read Wiki material from the file named FILE.
- file=FD
- Read Wiki material from file object FD.
- text=STRING
- Read Wiki material from STRING.
+ Most arguments have the same meaning as in the WikiMarkup constructor.
+
+ Class-specific arguments:
width=N
Limit output width to N columns. Default is 78.
@@ -345,4 +344,5 @@ class TextWiktionaryMarkup(TextWikiMarkup):
Reserved for future use. Currently does the same as TextWikiMarkup.
"""
+ html_base='http://%(lang)s.wiktionary.org/wiki/'
diff --git a/wikitrans/wikimarkup.py b/wikitrans/wikimarkup.py
index 77c3b30..a3e17d5 100644
--- a/wikitrans/wikimarkup.py
+++ b/wikitrans/wikimarkup.py
@@ -952,11 +952,34 @@ class WikiMarkup(WikiMarkupParser):
file = None
text = None
lang = 'en'
- html_base = 'http://%(lang)s.wiktionary.org/wiki/'
+ html_base = 'http://%(lang)s.wikipedia.org/wiki/'
image_base = 'http://upload.wikimedia.org/wikipedia/commons/thumb/a/bf'
media_base = 'http://www.mediawiki.org/xml/export-0.3'
def __init__(self, *args, **keywords):
+ """Create a WikiMarkup object.
+
+ Arguments:
+
+ filename=FILE
+ Read Wiki material from the file named FILE.
+ file=FD
+ Read Wiki material from file object FD.
+ text=STRING
+ Read Wiki material from STRING.
+ lang=CODE
+ Specifies source language. Default is 'en'. This variable can be
+ referred to as '%(lang)s' in the keyword arguments below.
+ html_base=URL
+ Base URL for cross-references. Default is
+ 'http://%(lang)s.wikipedia.org/wiki/'
+ image_base=URL
+ Base URL for images. Default is
+ 'http://upload.wikimedia.org/wikipedia/commons/thumb/a/bf'
+ media_base=URL
+ Base URL for media files. Default is
+ 'http://www.mediawiki.org/xml/export-0.3'
+ """
for kw in keywords:
if kw == 'file':
self.file = keywords[kw]

Return to:

Send suggestions and report system problems to the System administrator.