From eb469fe3560ed62ebd165f77ddebf131cd7cd3a8 Mon Sep 17 00:00:00 2001 From: Lukas P Date: Tue, 5 Jan 2016 17:13:48 +0100 Subject: [PATCH] =?UTF-8?q?Anpassungen=20f=C3=BCr=20neue=20Moin=20Version?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doku.php | 2 +- doku.pyc | Bin 0 -> 1642 bytes moin2doku.py | 10 +- moinformat.py | 14 +- moinformat.pyc | Bin 0 -> 1242 bytes output.txt | 238 ++++++++++++++++ standalone.py | 22 ++ syntaxreference.txt | 2 +- text_dokuwiki.py | 674 ++++++++++++++++++++++---------------------- text_dokuwiki.pyc | Bin 0 -> 13780 bytes 10 files changed, 617 insertions(+), 345 deletions(-) create mode 100644 doku.pyc create mode 100644 moinformat.pyc create mode 100644 output.txt create mode 100644 standalone.py create mode 100644 text_dokuwiki.pyc diff --git a/doku.php b/doku.php index d7a8660..50714df 100755 --- a/doku.php +++ b/doku.php @@ -13,7 +13,7 @@ if ('cli' != php_sapi_name()) die(); -define('DOKU_INC', '/usr/share/dokuwiki/'); +define('DOKU_INC', '/home/caddy/wikifarm/dokuwiki/dokuwiki/'); require_once DOKU_INC.'inc/init.php'; require_once DOKU_INC.'inc/common.php'; require_once DOKU_INC.'inc/cliopts.php'; diff --git a/doku.pyc b/doku.pyc new file mode 100644 index 0000000000000000000000000000000000000000..78db648323cf9f6823de3c1ff4202d0f51daeb97 GIT binary patch literal 1642 zcmbVM$!-%t5UsYI#aRFa1o90D1^E!L1Q&#&2(bvbSkVN5$fY$*x8rd<9&5U-C{l6? z0uEgG7Vi8M9{}&wWZ`N?Q`ObowJ+WLy}q*bBY&UC`Pany3=n!i4!@DH$o?g5WZ#Hu zh--;!%4d-?k&pY>8`NQA~XOm0AU>{7da8J>epVE*L}sY4Kho|<1EdFzCLPE$d3nItfDB~2h|&v zh3{plbH}|SxH(9xqF0pp9RzhHE`qJ_aag*9&di;bB?ui=>2&JdEs*C~sZ&ga2@NFVQtP!5 zx~UiQ6oBQUCCwK%Vm2DJAtpsN*VdM?tuNFN-I&MFD)_BE@G*_CvUY>wwY}>tEjL42 z0lenTFQAADG+1BM8bwFh(7huNdWeeNK5ep3M>qx1By0G|$pPzu_Q##mmc*8f7UTpY zg&!@wpeIY>76t7$YKvQvxB}tUXq5wZ3WhZ~SrE4@ozc3uHWlNqO~KB#TcN(oeTTlh zelyXIfj403>~$G%KX7U{!_&9Rn-GGE`zrN z7ciFKrpPP~9y|%m*k*XJvl+VAKq63)aUP-)Bg|Stn~`lYOoKi2$A}XeW}l{2nfVaZ z{BAk*6BX%~6R*VX+uc`@9Z=N4^*5LPS?tZx~Fh9S3A)_J%4-|bZ*70nU2{oH_T&m7nHu3=P%48ExffFzO_Z^ zW@Bs # Version: 1.0 - -from MoinMoin import wikimacro, wikiutil +#from MoinMoin.web.request import Request as RequestCLI +from MoinMoin.web.contexts import ScriptContext +from MoinMoin import wikiutil from MoinMoin.Page import Page -from MoinMoin.parser.wiki import Parser +from MoinMoin.parser.text_moin_wiki import Parser from text_dokuwiki import Formatter -from MoinMoin.request import RequestCLI import sys import StringIO @@ -37,7 +37,7 @@ def moin2doku(pagename, text): return unicode(output.getvalue().decode('utf-8')) -request = RequestCLI() +request = ScriptContext() formatter = Formatter(request) if __name__ == "__main__": @@ -47,6 +47,6 @@ if __name__ == "__main__": else: inputfile = 'syntaxreference.txt' - with open(inputfile, 'r') as f: - text = f.read() + f = open(inputfile, 'r') + text = f.read() print moin2doku('test', text) diff --git a/moinformat.pyc b/moinformat.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bad5d0ec365a6fc660e43a5ec56c59851e8ecb64 GIT binary patch literal 1242 zcmb7CJCD;q5dL-@CvoDCkb58+M418-iHZUtq?33Q9LSL<+*l^w98UZQ_WJH3zJ6%sAX?B)(y9D6d~ymscBb$$+dzsCB*0{h3I{}=StKS(6>3S>Yo5DEy!5}8Eq zAapEtkhPGz2wjU?$lAy|2s;+L$hycqgr3E1WIcpEQ=9ZY!akA?z5<~SC2&p30Lp_J z;F^xT12sg_#ag2J4mE=6VRe^XiHCIy)wjKc;QernqK$+O7(*REjgjACj*)|{Y}qAkfs^V7gf5^CuO14rMBiSnJ?0H+UPX1mKIsw z$7jl-wn0^`DvLeBFUu;AwN};XLK5T<=J|xa`U?pS>;yCoFL5QI=@p1bI;`wq?4(Pq zTG%-}ywEOIF3)q-f^K8g!Ig`h(W4G_6x!tk4&AvNL00W?#Hz<>E25naH1B-EZJpLG z$wn_9Kb`ob1>B?Vkf_w>M%9|qf#uCC0p}QZtu)WCnVPw-(&FsRJ8GSV+tze2{p+M` zv{CozT(v3EMVZ(%%07>?MwysIv3Ve2Evo3xhTrxw1}dV8>tUiYzrMt0Q^V}6_Wjp-a*v?q+Ha`|{-zh| z<8)!~SsjqWPJZJKIN#jJ8_Sd#w<~z?Zyn3Zlv#>$Dje~=c9VRejh%-!X67^Cr3SpZ zfaeVO4g|N#pragma section-numbers off +#acl All:admin,read,write,delete,revert +#language en +This page tries to use each supported markup element at least once. + + + +'''Index''' +[[TableOfContents(2)]] +**Index** + +[[:TableOfContents(2)|TableOfContents(2)]] + + + +====== Headers ====== + + +===== Header 2 ===== + + +==== Header 3 ==== + + +=== Header 4 === + + +== Header 5 == + + +====== Font styles ====== + + +Normal text, ''emphasized'', '''strong''', __underline__, ,,subscript,,, ^superscript^, `typewriter` and {{{typewriter +.}}} + +Normal text, //emphasized//, **strong**, __underline__, subscript, superscript, ''typewriter'' and ''typewriter''. + + + +===== Syntax Highlighting ===== + + * +# python code +print code.colorize("abc", 1 + 1) + + +====== Hyperlinks ====== + + +===== Internal ===== + + + * MoinMoin + * MoinMoin/TextFormatting + * MoinMoin/InstallDocs + * ../InstallDocs + * /SubPage + * Self:InterWiki + + * [[:MoinMoin|MoinMoin]] + * [[:MoinMoin:TextFormatting|MoinMoin/TextFormatting]] + * [[:MoinMoin:InstallDocs|MoinMoin/InstallDocs]] + * [[:InstallDocs|../InstallDocs]] + * [[:test:SubPage|/SubPage]] + * [[:InterWiki|InterWiki]] + + +[#anchorname Anchor Link] +[#anchorname Anchor Link] + + + +===== External ===== + + + * http://moinmoin.wikiwikiweb.de/ + * [http://moinmoin.wikiwikiweb.de/] + * [http://moinmoin.wikiwikiweb.de/ MoinMoin Wiki] + * [http://moinmoin.wikiwikiweb.de/wiki/classic/img/moinmoin.png] + * http://moinmoin.wikiwikiweb.de/wiki/classic/img/moinmoin.png + * [http://moinmoin.wikiwikiweb.de/wiki/classic/img/moinmoin.png moinmoin.png] + * MeatBall:InterWiki + * wiki:MeatBall/InterWiki + * [wiki:MeatBall/InterWiki] + * [wiki:MeatBall/InterWiki InterWiki page on MeatBall] + * [file://servername/full/path/to/file/filename%20with%20spaces.txt Click here to read filename with spaces.txt] + * me@privacy.net + + * [[http://moinmoin.wikiwikiweb.de/|http://moinmoin.wikiwikiweb.de/]] + * [[[http://moinmoin.wikiwikiweb.de/|http://moinmoin.wikiwikiweb.de/]]] + * [[[http://moinmoin.wikiwikiweb.de/|http://moinmoin.wikiwikiweb.de/]] [[:MoinMoin|MoinMoin]] Wiki] + * [[[http://moinmoin.wikiwikiweb.de/wiki/classic/img/moinmoin.png|http://moinmoin.wikiwikiweb.de/wiki/classic/img/moinmoin.png]]] + * [[http://moinmoin.wikiwikiweb.de/wiki/classic/img/moinmoin.png|http://moinmoin.wikiwikiweb.de/wiki/classic/img/moinmoin.png]] + * [[[http://moinmoin.wikiwikiweb.de/wiki/classic/img/moinmoin.png|http://moinmoin.wikiwikiweb.de/wiki/classic/img/moinmoin.png]] moinmoin.png] + * [[MeatBall>InterWiki|InterWiki]] + * wiki:[[:MeatBall:InterWiki|MeatBall/InterWiki]] + * [wiki:[[:MeatBall:InterWiki|MeatBall/InterWiki]]] + * [wiki:[[:MeatBall:InterWiki|MeatBall/InterWiki]] [[:InterWiki|InterWiki]] page on [[:MeatBall|MeatBall]]] + * [[[file://servername/full/path/to/file/filename%20with%20spaces.txt|file://servername/full/path/to/file/filename%20with%20spaces.txt]] Click here to read filename with spaces.txt] + * [[mailto:me@privacy.net|me@privacy.net]] + + +===== Escaping WikiNames ===== + + +Wiki''''''Name +Wiki``Name +Wiki****Name Wiki''''Name + + + +====== Blockquote ====== + + + This is indented + Even more + + * This is indented + * Even more + + + +====== Bullet list ====== + + + * item 1 + + * item 2, with gap + * item 3 + * item 3.1 + + * item 1 + * item 2, with gap + * item 3 + * item 3.1 + + + +====== Numbered list ====== + + + 1. item 1 + i. item 1 + i. item 2 + + - item 1 + - item 1 + - item 2 + + + + 1. item 2 + a. item 1 + a. item 2 + + - item 2 + - item 1 + - item 2 + + + +====== Descriptions + Definitions ====== + + + Term:: Description + Label:: Definition +Description Definition + +====== Code display ====== + + * line 1 + indented 4 characters + + + +====== Tables ====== + + +===== General table layout and HTML like options ===== + + + ||cell 1||cell2||cell 3|| + + * +|cell 1|cell2|cell 3| + + +====== Rules ====== + + +--- (not a rule) +---- +----- +------ +------- +-------- +--------- +---------- +-------------------------------------------- (not thicker than 10) +--- (not a rule) + + + + +- + + +-- + + +--- + + +---- + + +---- + + +---- + + +---- + (not thicker than 10) + + + +====== Macros ====== + + +[[Anchor(anchorname)]] +'''[[PageCount]]''' pages +[[:Anchor(anchorname)|Anchor(anchorname)]] **[[:PageCount|PageCount]]** pages + + diff --git a/standalone.py b/standalone.py new file mode 100644 index 0000000..413a450 --- /dev/null +++ b/standalone.py @@ -0,0 +1,22 @@ +from MoinMoin.server.standalone import StandaloneConfig, run + +import sys +# Path of the directory where wikiconfig.py is located. +# YOU NEED TO CHANGE THIS TO MATCH YOUR SETUP. +sys.path.insert(0, 'home/caddy/wikifarm/var/wikifarm/config') + +# Path to MoinMoin package, needed if you installed with --prefix=PREFIX +# or if you did not use setup.py. +sys.path.insert(0, '/usr/local/lib/python2.4/site-packages') + +# Path of the directory where farmconfig.py is located (if different). +sys.path.insert(0, '/home/caddy/wikifarm/var/wikifarm/config') + +class Config(StandaloneConfig): + docs = '/home/caddy/wikifarm/var/wikifarm' + user = 'http' + group = 'http' + port = 80 + +run(Config) + \ No newline at end of file diff --git a/syntaxreference.txt b/syntaxreference.txt index ea5bca2..d824f2d 100644 --- a/syntaxreference.txt +++ b/syntaxreference.txt @@ -182,4 +182,4 @@ line 1 '''[[PageCount]]''' pages }}} [[Anchor(anchorname)]] -'''[[PageCount]]''' pages +'''[[PageCount]]''' pages \ No newline at end of file diff --git a/text_dokuwiki.py b/text_dokuwiki.py index 02f93b5..cb444f8 100644 --- a/text_dokuwiki.py +++ b/text_dokuwiki.py @@ -1,15 +1,15 @@ # -*- coding: utf-8 -*- # Setup VIM: ex: noet ts=2 sw=2 : """ - MoinMoin - Dokuwiki Formatter + MoinMoin - Dokuwiki Formatter - @copyright: 2000, 2001, 2002 by Jürgen Hermann - @copyright: 2011-2012 Elan Ruusamäe - @license: GNU GPL, see COPYING for details. + @copyright: 2000, 2001, 2002 by Jürgen Hermann + @copyright: 2011-2012 Elan Ruusamäe + @license: GNU GPL, see COPYING for details. """ from xml.sax import saxutils -from MoinMoin.formatter.base import FormatterBase +from MoinMoin.formatter import FormatterBase from MoinMoin import config from MoinMoin.Page import Page from types import * @@ -17,330 +17,340 @@ from types import * # TODO: let base class MoinMoin/formatter/base.py handle not implemented methods class Formatter(FormatterBase): - """ - Send Dokuwiki formatted data. - """ - - hardspace = ' ' -# hardspace = ' ' - - def __init__(self, request, **kw): - apply(FormatterBase.__init__, (self, request), kw) - self._current_depth = 1 - self._base_depth = 0 - self.in_pre = 0 - self.in_table = 0 - self._text = None # XXX does not work with links in headings!!!!! - - self.list_depth = 0 - self.list_type = ' ' - - def _escape(self, text, extra_mapping={"'": "'", '"': """}): - return saxutils.escape(text, extra_mapping) - - def startDocument(self, pagename): - encoding = config.charset - return '\n' % ( - encoding, self._escape(pagename)) - - def endDocument(self): - result = "" - while self._current_depth > 1: - result += "" % self._current_depth - self._current_depth -= 1 - return result + '' - - def lang(self, on, lang_name): - return ('
' % lang_name, '
')[not on] - - def sysmsg(self, on, **kw): - return ('', '')[not on] - - def rawHTML(self, markup): - return '' + markup + '' - - def pagelink(self, on, pagename='', page=None, **kw): - if on: - return '[[:' + ":".join(pagename.split("/")) + "|" - else: - return ']]' - - def interwikilink(self, on, interwiki='', pagename='', **kw): - if on: - if interwiki == 'Self': - return self.pagelink(on, pagename, **kw) - return '[[%s>%s|' % (interwiki, pagename) - else: - return ']]' - - def url(self, on, url='', css=None, **kw): - return ('[[%s|' % (self._escape(url)), ']]')[not on] - - def attachment_link(self, url, text, **kw): - return '{{%s|%s}}' % (url, text) - - def attachment_image(self, url, **kw): - return '{{%s|}}' % (url,) - - def attachment_drawing(self, url, text, **kw): - return '{{%s|%s}}' % (url, text) - - def text(self, text, **kw): - self._did_para = 0 - if self._text is not None: - self._text.append(text) - return text - - def rule(self, size=0, **kw): - # size not supported - if size >= 4: - return '----\n' - else: - return '-' * size + '\n' - - def icon(self, type): - return '' % type - - def strong(self, on, **kw): - return ['**', '**'][not on] - - def emphasis(self, on, **kw): - return ['//', '//'][not on] - - def highlight(self, on, **kw): - return ['**', '**'][not on] - - def number_list(self, on, type=None, start=None, **kw): - # list type not supported - if on: - self.list_depth += 1 - self.list_type = '-' - else: - self.list_depth -= 1 - self.list_type = ' ' - - return ['', '\n'][on] - - def bullet_list(self, on, **kw): - if on: - self.list_depth += 1 - self.list_type = '*' - else: - self.list_depth -= 1 - self.list_type = ' ' - - return ['', '\n'][on] - - def listitem(self, on, **kw): - # somewhy blockquote uses "listitem" call - return [(' ' * self.list_depth * 2) + self.list_type + ' ', '\n'][not on] - - def code(self, on, **kw): - """ `typewriter` or {{{typerwriter}}, for code blocks i hope codeblock works """ - return ["''", "''"][not on] - - def sup(self, on, **kw): - return ['', ''][not on] - - def sub(self, on, **kw): - return ['', ''][not on] - - def strike(self, on, **kw): - return ['', ''][not on] - - def preformatted(self, on, **kw): - FormatterBase.preformatted(self, on) - result = '' - if self.in_p: - result = self.paragraph(0) - return result + ['', '\n'][not on] - - def paragraph(self, on, **kw): - FormatterBase.paragraph(self, on) - if self.in_table or self.list_depth: - return '' - return ['', '\n\n'][not on] - - def linebreak(self, preformatted=1): - return ['\n', '\\\n'][not preformatted] - - def heading(self, on, depth, **kw): - # heading depth reversed in dokuwiki - heading_depth = 7 - depth - - if on: - return u'%s ' % (u'=' * heading_depth) - else: - return u' %s\n' % (u'=' * heading_depth) - - def table(self, on, attrs={}, **kw): - if on: - self.in_table = 1 - else: - self.in_table = 0 - return '' - - def table_row(self, on, attrs={}, **kw): - return ['\n', '|'][not on] - - def table_cell(self, on, attrs={}, **kw): - return ['|', ''][not on] - - def anchordef(self, id): - # not supported - return '' - - def anchorlink(self, on, name='', **kw): - # kw.id not supported, we hope the anchor matches existing heading on page - return ('[[#', ']]') [not on] - - def underline(self, on, **kw): - return ['__', '__'][not on] - - def definition_list(self, on, **kw): - result = '' - if self.in_p: - result = self.paragraph(0) - return result + ['', ''][not on] - - def definition_term(self, on, compact=0, **kw): - return [''][not on] - - def definition_desc(self, on, **kw): - return ['', ''][not on] - - def image(self, src=None, **kw): - valid_attrs = ['src', 'width', 'height', 'alt', 'title'] - - url = src - if '?' in url: - url += '&' - else: - url += '?' - - attrs = {} - for key, value in kw.items(): - if key in valid_attrs: - attrs[key] = value - - # TODO: finish this - if attrs.has_key('width'): - url += attrs['width'] - - return '{{' + url + '}}' - - def code_area(self, on, code_id, code_type='code', show=0, start=-1, step=-1): - syntax = '' - # switch for Python: http://simonwillison.net/2004/may/7/switch/ - try: - syntax = { - 'ColorizedPython': 'python', - 'ColorizedPascal': 'pascal', - 'ColorizedJava': 'java', - 'ColorizedCPlusPlus': 'cpp', - }[code_type] - except KeyError: - pass - - return ('' % syntax , '')[not on] - - def code_line(self, on): - return ('', '\n')[on] - - def code_token(self, on, tok_type): - # not supported - return '' - - def comment(self, text): - # real comments (lines with two hash marks) - if text[0:2] == '##': - return "/* %s */\n" % text[2:].strip() - - # Some kind of Processing Instruction - # http://moinmo.in/HelpOnProcessingInstructions - tokens = text.lstrip('#').split(None, 1) - if tokens[0] in ('language', 'format', 'refresh'): - return '' - - if tokens[0] == 'acl': - # TODO: fill acl.auth.php - return '' - - if tokens[0] == 'deprecated': - return 'This page is deprecated\n' - - if tokens[0] == 'redirect': - return text + "\n" - - if tokens[0] == 'pragma': - # TODO: can do 'description' via 'meta' dokuwiki plugin - return "/* pragma: %s */\n" % " ".join(tokens[1:]) - - return "/* %s */\n" % text.lstrip('#') - - def macro(self, macro_obj, name, args): - def email(args): - mail = args.replace(' AT ', '@') - mail = mail.replace(' DOT ', '.') - return '[[%s|%s]]' % (mail, args) - - # function which will just do what parent class would - def inherit(args): - return apply(FormatterBase.macro, (self, macro_obj, name, args)) - - try: - lookup = { - 'BR' : '\\\\', - 'MailTo' : email, - 'GetText' : args, - 'ShowSmileys' : inherit, - }[name] - except KeyError: - lookup = '/* UndefinedMacro: %s(%s) */' % (name, args) - - if type(lookup) == FunctionType: - text = lookup(args) - else: - text = lookup - return text - - def smiley(self, text): - try: - # https://www.dokuwiki.org/devel:smileys.conf - return { - # note: reverse sorted so that longer smileys get matched first - 'X-(' : ':-X', - '{X}' : ':!:', - '{*}' : '', - '(./)' : u'✓', - ':))' : ':-P', - ':-))' : ':-P', - ':-?' : ':-P', - ':o' : ':-o', - '{OK}' : ':!:', - '{o}' : '', - '{i}' : ':!:', - ':D' : ':-D', - 'B)' : '8-)', - 'B-)' : '8-)', - '{3}' : '<3>', - '{2}' : '<2>', - '{1}' : '<1>', - '(!)' : ':!:', - '/!\\' : ':!:', - ':\\' : ':-\\', - ':))' : ':-)', - ':)' : ':-)', - ':(' : ':-(', - ':-))' : ':-)', - ':-)' : ':-)', - ':-(' : ':-(', - ';)' : ';-)', - '|)' : ':-|', - '|-)' : ':-|', - '>:>' : '^_^', - '' : ':!:', - '<:(' : ':-?', - }[text] - except KeyError: - return text + """ + Send Dokuwiki formatted data. + """ + + hardspace = ' ' +# hardspace = ' ' + + def __init__(self, request, **kw): + apply(FormatterBase.__init__, (self, request), kw) + self._current_depth = 1 + self._base_depth = 0 + self.in_pre = 0 + self.in_table = 0 + self._text = None # XXX does not work with links in headings!!!!! + + self.list_depth = 0 + self.list_type = ' ' + + def _escape(self, text, extra_mapping={"'": "'", '"': """}): + return saxutils.escape(text, extra_mapping) + + def startDocument(self, pagename): + encoding = config.charset + return '\n' % ( + encoding, self._escape(pagename)) + + def endDocument(self): + result = "" + while self._current_depth > 1: + result += "" % self._current_depth + self._current_depth -= 1 + return result + '' + + def lang(self, on, lang_name): + return ('
' % lang_name, '
')[not on] + + def sysmsg(self, on, **kw): + return ('', '')[not on] + + def rawHTML(self, markup): + #return '' + markup + '' + return '' + + def pagelink(self, on, pagename='', page=None, **kw): + if on: + return '[[:' + ":".join(pagename.split("/")) + "|" + else: + return ']]' + + def interwikilink(self, on, interwiki='', pagename='', **kw): + if on: + if interwiki == 'Self': + return self.pagelink(on, pagename, **kw) + return '[[%s>%s|' % (interwiki, pagename) + else: + return ']]' + + def url(self, on, url='', css=None, **kw): + return ('[[%s|' % (self._escape(url)), ']]')[not on] + + def attachment_link(self, on, url=None, querystr=None, **kw): + return '{{ %s | %s }}' % (url, querystr) + + def attachment_image(self, url, **kw): + return '{{%s|}}' % (url,) + + def attachment_drawing(self, url, text, **kw): + return '{{%s|%s}}' % (url, text) + + def text(self, text, **kw): + self._did_para = 0 + if self._text is not None: + self._text.append(text) + return text + + def rule(self, size=0, **kw): + # size not supported + if size >= 4: + return '----\n' + else: + return '-' * size + '\n' + + def icon(self, type): + return '' % type + + def strong(self, on, **kw): + return ['**', '**'][not on] + + def emphasis(self, on, **kw): + return ['//', '//'][not on] + + def highlight(self, on, **kw): + return ['**', '**'][not on] + + def number_list(self, on, type=None, start=None, **kw): + # list type not supported + if on: + self.list_depth += 1 + self.list_type = '-' + else: + self.list_depth -= 1 + self.list_type = ' ' + + return ['', '\n'][on] + + def bullet_list(self, on, **kw): + if on: + self.list_depth += 1 + self.list_type = '*' + else: + self.list_depth -= 1 + self.list_type = ' ' + + return ['', '\n'][on] + + def listitem(self, on, **kw): + # somewhy blockquote uses "listitem" call + return [(' ' * self.list_depth * 2) + self.list_type + ' ', '\n'][not on] + + def code(self, on, **kw): + """ `typewriter` or {{{typerwriter}}, for code blocks i hope codeblock works """ + return ["''", "''"][not on] + + def sup(self, on, **kw): + return ['', ''][not on] + + def sub(self, on, **kw): + return ['', ''][not on] + + def strike(self, on, **kw): + return ['', ''][not on] + + def preformatted(self, on, **kw): + FormatterBase.preformatted(self, on) + result = '' + if self.in_p: + result = self.paragraph(0) + return result + ['', '\n'][not on] + + def paragraph(self, on, **kw): + FormatterBase.paragraph(self, on) + if self.in_table or self.list_depth: + return '' + return ['', '\n\n'][not on] + + def linebreak(self, preformatted=1): + return ['\n', '\\\n'][not preformatted] + + def heading(self, on, depth, **kw): + # heading depth reversed in dokuwiki + heading_depth = 7 - depth + + if on: + return u'%s ' % (u'=' * heading_depth) + else: + return u' %s\n' % (u'=' * heading_depth) + + def table(self, on, attrs={}, **kw): + if on: + self.in_table = 1 + else: + self.in_table = 0 + return '' + + def table_row(self, on, attrs={}, **kw): + return ['\n', '|'][not on] + + def table_cell(self, on, attrs={}, **kw): + return ['|', ''][not on] + + def anchordef(self, id): + # not supported + return '' + + def anchorlink(self, on, name='', **kw): + # kw.id not supported, we hope the anchor matches existing heading on page + return ('[[#', ']]') [not on] + + def underline(self, on, **kw): + return ['__', '__'][not on] + + def definition_list(self, on, **kw): + result = '' + if self.in_p: + result = self.paragraph(0) + return result + ['', ''][not on] + + def definition_term(self, on, compact=0, **kw): + return [''][not on] + + def definition_desc(self, on, **kw): + return ['', ''][not on] + + def image(self, src=None, **kw): + valid_attrs = ['src', 'width', 'height', 'alt', 'title'] + + url = src + if '?' in url: + url += '&' + else: + url += '?' + + attrs = {} + for key, value in kw.items(): + if key in valid_attrs: + attrs[key] = value + + # TODO: finish this + if attrs.has_key('width'): + url += attrs['width'] + + return '{{' + url + '}}' + + def code_area(self, on, code_id, code_type='code', show=0, start=-1, step=-1,msg=None): + syntax = '' + # switch for Python: http://simonwillison.net/2004/may/7/switch/ + try: + syntax = { + 'ColorizedPython': 'python', + 'ColorizedPascal': 'pascal', + 'ColorizedJava': 'java', + 'ColorizedCPlusPlus': 'cpp', + }[code_type] + except KeyError: + pass + + return ('' % syntax , '')[not on] + + def code_line(self, on): + return ('', '\n')[on] + + def code_token(self, on, tok_type): + # not supported + return '' + + def comment(self, text): + # real comments (lines with two hash marks) + if text[0:2] == '##': + #return "/* %s */\n" % text[2:].strip() + return '' + + # Some kind of Processing Instruction + # http://moinmo.in/HelpOnProcessingInstructions + tokens = text.lstrip('#').split(None, 1) + if tokens[0] in ('language', 'format', 'refresh'): + return '' + + if tokens[0] == 'acl': + # TODO: fill acl.auth.php + return '' + + if tokens[0] == 'deprecated': + return 'This page is deprecated\n' + + if tokens[0] == 'redirect': + return text + "\n" + + if tokens[0] == 'pragma': + # TODO: can do 'description' via 'meta' dokuwiki plugin + #return "/* pragma: %s */\n" % " ".join(tokens[1:]) + return '' + + #return "/* %s */\n" % text.lstrip('#') + return '' + + + def macro(self, macro_obj, name, args,markup): + def email(args): + mail = args.replace(' AT ', '@') + mail = mail.replace(' DOT ', '.') + return '[[%s|%s]]' % (mail, args) + + def showAttachedFiles(args): + args = args.split(',') + return self.attachment_link(1,url=args[0].strip(),querystr=args[1].strip()) + + # function which will just do what parent class would + def inherit(args): + return apply(FormatterBase.macro, (self, macro_obj, name, args)) + + try: + lookup = { + 'BR' : '\\\\', + 'MailTo' : email, + 'GetText' : args, + 'ShowSmileys' : inherit, + 'ShowAttachedFiles' : showAttachedFiles + }[name] + except KeyError: + lookup = '/* UndefinedMacro: %s(%s) */' % (name, args) + + if type(lookup) == FunctionType: + text = lookup(args) + else: + text = lookup + return text + + def smiley(self, text): + try: + # https://www.dokuwiki.org/devel:smileys.conf + return { + # note: reverse sorted so that longer smileys get matched first + 'X-(' : ':-X', + '{X}' : ':!:', + '{*}' : '', + '(./)' : u'✓', + ':))' : ':-P', + ':-))' : ':-P', + ':-?' : ':-P', + ':o' : ':-o', + '{OK}' : ':!:', + '{o}' : '', + '{i}' : ':!:', + ':D' : ':-D', + 'B)' : '8-)', + 'B-)' : '8-)', + '{3}' : '<3>', + '{2}' : '<2>', + '{1}' : '<1>', + '(!)' : ':!:', + '/!\\' : ':!:', + ':\\' : ':-\\', + ':))' : ':-)', + ':)' : ':-)', + ':(' : ':-(', + ':-))' : ':-)', + ':-)' : ':-)', + ':-(' : ':-(', + ';)' : ';-)', + '|)' : ':-|', + '|-)' : ':-|', + '>:>' : '^_^', + '' : ':!:', + '<:(' : ':-?', + }[text] + except KeyError: + return text diff --git a/text_dokuwiki.pyc b/text_dokuwiki.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cbff1eb331be1a1d81e5e3111531c6bdd58999af GIT binary patch literal 13780 zcmcIr&2Jn>cCVfp4ml(x>dTU7$x@RNr6DD9M9C|ADVmZ+efUdbxhbz?N%puo-6C6@ z=^l6YnBtN=1QON;HXlef0fNOMd&mcJ$sxA@33A8+0dfce1js*-Taesx36R6)_j}bn zGa{`RD~?EZ)vN02s#ov5dhgY%V)nmx^{@QrPk&TZ$xjyf6+F>nB#u(|ks8X$sG6bb z8FfFS43@L1mR0qfx}VeKoT~MxdS2bn>vE5(^{RTGy5FbEc~vW@J5H~1bLtVk?^Dl| zdaBfC_xqJoPz%L=j``0>`c3@Y3Ot{WIcZ)CR+_8cif7&k!nz&DZrCqPu2h4@TIek; z$1~>nbLY;TWjZbCd2?~i{NPuA7cRNJ`JRipyW)*g9NZu()(tGa&V&X_mLpPDyse{|N2T-Tic`1WV- zmv5Sng3xr_*!F7CRKNFY{1gpLEAHb2?I+C`FLcc=)U+mb)s9?Uokw*w@E>_gx|~D# zw!M_RWnU9aJk+3=Qx}~c<>Zm|s%L0| zg75`Q1W(wuS2_Ix^eJaRfP!)c1pwc6Dd&gE*{z;IE(WEDnjt9y&~NuhaksQYa4l3t$0S=`-ACaC9E9a=x z4=d*l0bW;PAX?i&=^t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