Anpassungen für neue Moin Version
This commit is contained in:
parent
8117b6a1e2
commit
eb469fe356
10 changed files with 617 additions and 345 deletions
2
doku.php
2
doku.php
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
if ('cli' != php_sapi_name()) die();
|
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/init.php';
|
||||||
require_once DOKU_INC.'inc/common.php';
|
require_once DOKU_INC.'inc/common.php';
|
||||||
require_once DOKU_INC.'inc/cliopts.php';
|
require_once DOKU_INC.'inc/cliopts.php';
|
||||||
|
|
BIN
doku.pyc
Normal file
BIN
doku.pyc
Normal file
Binary file not shown.
|
@ -9,9 +9,10 @@
|
||||||
# Version: 1.0
|
# Version: 1.0
|
||||||
|
|
||||||
import sys, os, os.path, re, codecs
|
import sys, os, os.path, re, codecs
|
||||||
|
sys.path.insert(1,'/home/caddy/.conda/envs/moinmoin/lib/python2.7/site-packages/MoinMoin/support')
|
||||||
import getopt
|
import getopt
|
||||||
from MoinMoin import user, wikiutil
|
from MoinMoin import user, wikiutil
|
||||||
from MoinMoin.request import RequestCLI
|
from MoinMoin.web.contexts import ScriptContext as RequestCLI
|
||||||
from MoinMoin.logfile import editlog
|
from MoinMoin.logfile import editlog
|
||||||
from MoinMoin.Page import Page
|
from MoinMoin.Page import Page
|
||||||
from shutil import copyfile, copystat
|
from shutil import copyfile, copystat
|
||||||
|
@ -40,7 +41,7 @@ def init_dirs(output_dir):
|
||||||
mkdir(metadir)
|
mkdir(metadir)
|
||||||
|
|
||||||
def readfile(filename):
|
def readfile(filename):
|
||||||
with open(filename, 'r') as f:
|
f = open(filename, 'r')
|
||||||
text = f.read()
|
text = f.read()
|
||||||
return unicode(text.decode('utf-8'))
|
return unicode(text.decode('utf-8'))
|
||||||
|
|
||||||
|
@ -50,7 +51,7 @@ def writefile(filename, content, overwrite=False):
|
||||||
os.makedirs(dir);
|
os.makedirs(dir);
|
||||||
|
|
||||||
if os.path.exists(filename) and overwrite == False:
|
if os.path.exists(filename) and overwrite == False:
|
||||||
raise OSError, 'File already exists: %s' % filename
|
raise (OSError, 'File already exists: %s' % filename)
|
||||||
|
|
||||||
# ensure it's a list
|
# ensure it's a list
|
||||||
if not isinstance(content, (list, tuple)):
|
if not isinstance(content, (list, tuple)):
|
||||||
|
@ -294,6 +295,7 @@ else:
|
||||||
# get list of all pages in wiki
|
# get list of all pages in wiki
|
||||||
# hide underlay dir temporarily
|
# hide underlay dir temporarily
|
||||||
underlay_dir = request.rootpage.cfg.data_underlay_dir
|
underlay_dir = request.rootpage.cfg.data_underlay_dir
|
||||||
|
print(underlay_dir)
|
||||||
request.rootpage.cfg.data_underlay_dir = None
|
request.rootpage.cfg.data_underlay_dir = None
|
||||||
pages = request.rootpage.getPageList(user = '', exists = not convert_attic, filter = filter)
|
pages = request.rootpage.getPageList(user = '', exists = not convert_attic, filter = filter)
|
||||||
pages = dict(zip(pages, pages))
|
pages = dict(zip(pages, pages))
|
||||||
|
|
|
@ -7,13 +7,13 @@
|
||||||
#
|
#
|
||||||
# Author: Elan Ruusamäe <glen@pld-linux.org>
|
# Author: Elan Ruusamäe <glen@pld-linux.org>
|
||||||
# Version: 1.0
|
# Version: 1.0
|
||||||
|
#from MoinMoin.web.request import Request as RequestCLI
|
||||||
from MoinMoin import wikimacro, wikiutil
|
from MoinMoin.web.contexts import ScriptContext
|
||||||
|
from MoinMoin import wikiutil
|
||||||
from MoinMoin.Page import Page
|
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 text_dokuwiki import Formatter
|
||||||
from MoinMoin.request import RequestCLI
|
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import StringIO
|
import StringIO
|
||||||
|
@ -37,7 +37,7 @@ def moin2doku(pagename, text):
|
||||||
|
|
||||||
return unicode(output.getvalue().decode('utf-8'))
|
return unicode(output.getvalue().decode('utf-8'))
|
||||||
|
|
||||||
request = RequestCLI()
|
request = ScriptContext()
|
||||||
formatter = Formatter(request)
|
formatter = Formatter(request)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
@ -47,6 +47,6 @@ if __name__ == "__main__":
|
||||||
else:
|
else:
|
||||||
inputfile = 'syntaxreference.txt'
|
inputfile = 'syntaxreference.txt'
|
||||||
|
|
||||||
with open(inputfile, 'r') as f:
|
f = open(inputfile, 'r')
|
||||||
text = f.read()
|
text = f.read()
|
||||||
print moin2doku('test', text)
|
print moin2doku('test', text)
|
||||||
|
|
BIN
moinformat.pyc
Normal file
BIN
moinformat.pyc
Normal file
Binary file not shown.
238
output.txt
Normal file
238
output.txt
Normal file
|
@ -0,0 +1,238 @@
|
||||||
|
|
||||||
|
|
||||||
|
<file>#pragma section-numbers off
|
||||||
|
#acl All:admin,read,write,delete,revert
|
||||||
|
#language en</file>
|
||||||
|
This page tries to use each supported markup element at least once.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<file>'''Index'''
|
||||||
|
[[TableOfContents(2)]]</file>
|
||||||
|
**Index**
|
||||||
|
|
||||||
|
[[:TableOfContents(2)|TableOfContents(2)]]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
====== Headers ======
|
||||||
|
|
||||||
|
|
||||||
|
===== Header 2 =====
|
||||||
|
|
||||||
|
|
||||||
|
==== Header 3 ====
|
||||||
|
|
||||||
|
|
||||||
|
=== Header 4 ===
|
||||||
|
|
||||||
|
|
||||||
|
== Header 5 ==
|
||||||
|
|
||||||
|
|
||||||
|
====== Font styles ======
|
||||||
|
|
||||||
|
|
||||||
|
<file>Normal text, ''emphasized'', '''strong''', __underline__, ,,subscript,,, ^superscript^, `typewriter` and {{{typewriter</file>
|
||||||
|
.}}}
|
||||||
|
|
||||||
|
Normal text, //emphasized//, **strong**, __underline__, <sub>subscript</sub>, <sup>superscript</sup>, ''typewriter'' and ''typewriter''.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
===== Syntax Highlighting =====
|
||||||
|
|
||||||
|
* <code >
|
||||||
|
# python code
|
||||||
|
print code.colorize("abc", 1 + 1)</code>
|
||||||
|
|
||||||
|
|
||||||
|
====== Hyperlinks ======
|
||||||
|
|
||||||
|
|
||||||
|
===== Internal =====
|
||||||
|
|
||||||
|
|
||||||
|
<file> * MoinMoin
|
||||||
|
* MoinMoin/TextFormatting
|
||||||
|
* MoinMoin/InstallDocs
|
||||||
|
* ../InstallDocs
|
||||||
|
* /SubPage
|
||||||
|
* Self:InterWiki</file>
|
||||||
|
|
||||||
|
* [[:MoinMoin|MoinMoin]]
|
||||||
|
* [[:MoinMoin:TextFormatting|MoinMoin/TextFormatting]]
|
||||||
|
* [[:MoinMoin:InstallDocs|MoinMoin/InstallDocs]]
|
||||||
|
* [[:InstallDocs|../InstallDocs]]
|
||||||
|
* [[:test:SubPage|/SubPage]]
|
||||||
|
* [[:InterWiki|InterWiki]]
|
||||||
|
|
||||||
|
|
||||||
|
<file>[#anchorname Anchor Link]</file>
|
||||||
|
[#anchorname Anchor Link]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
===== External =====
|
||||||
|
|
||||||
|
|
||||||
|
<file> * 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</file>
|
||||||
|
|
||||||
|
* [[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 =====
|
||||||
|
|
||||||
|
|
||||||
|
<file>Wiki''''''Name
|
||||||
|
Wiki``Name</file>
|
||||||
|
Wiki****Name Wiki''''Name
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
====== Blockquote ======
|
||||||
|
|
||||||
|
|
||||||
|
<file> This is indented
|
||||||
|
Even more</file>
|
||||||
|
|
||||||
|
* This is indented
|
||||||
|
* Even more
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
====== Bullet list ======
|
||||||
|
|
||||||
|
|
||||||
|
<file> * item 1
|
||||||
|
|
||||||
|
* item 2, with gap
|
||||||
|
* item 3
|
||||||
|
* item 3.1</file>
|
||||||
|
|
||||||
|
* item 1
|
||||||
|
* item 2, with gap
|
||||||
|
* item 3
|
||||||
|
* item 3.1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
====== Numbered list ======
|
||||||
|
|
||||||
|
|
||||||
|
<file> 1. item 1
|
||||||
|
i. item 1
|
||||||
|
i. item 2</file>
|
||||||
|
|
||||||
|
- item 1
|
||||||
|
- item 1
|
||||||
|
- item 2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<file> 1. item 2
|
||||||
|
a. item 1
|
||||||
|
a. item 2</file>
|
||||||
|
|
||||||
|
- item 2
|
||||||
|
- item 1
|
||||||
|
- item 2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
====== Descriptions + Definitions ======
|
||||||
|
|
||||||
|
|
||||||
|
<file> Term:: Description
|
||||||
|
Label:: Definition</file>
|
||||||
|
<gloss><label>Term</label><item>Description </item><label>Label</label><item>Definition </item></gloss>
|
||||||
|
|
||||||
|
====== Code display ======
|
||||||
|
|
||||||
|
* <file>line 1
|
||||||
|
indented 4 characters</file>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
====== Tables ======
|
||||||
|
|
||||||
|
|
||||||
|
===== General table layout and HTML like options =====
|
||||||
|
|
||||||
|
|
||||||
|
<file> ||cell 1||cell2||cell 3||</file>
|
||||||
|
|
||||||
|
*
|
||||||
|
|cell 1|cell2|cell 3|
|
||||||
|
|
||||||
|
|
||||||
|
====== Rules ======
|
||||||
|
|
||||||
|
|
||||||
|
<file>--- (not a rule)
|
||||||
|
----
|
||||||
|
-----
|
||||||
|
------
|
||||||
|
-------
|
||||||
|
--------
|
||||||
|
---------
|
||||||
|
----------
|
||||||
|
-------------------------------------------- (not thicker than 10)</file>
|
||||||
|
--- (not a rule)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
----
|
||||||
|
(not thicker than 10)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
====== Macros ======
|
||||||
|
|
||||||
|
|
||||||
|
<file>[[Anchor(anchorname)]]
|
||||||
|
'''[[PageCount]]''' pages</file>
|
||||||
|
[[:Anchor(anchorname)|Anchor(anchorname)]] **[[:PageCount|PageCount]]** pages
|
||||||
|
|
||||||
|
|
22
standalone.py
Normal file
22
standalone.py
Normal file
|
@ -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)
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from xml.sax import saxutils
|
from xml.sax import saxutils
|
||||||
from MoinMoin.formatter.base import FormatterBase
|
from MoinMoin.formatter import FormatterBase
|
||||||
from MoinMoin import config
|
from MoinMoin import config
|
||||||
from MoinMoin.Page import Page
|
from MoinMoin.Page import Page
|
||||||
from types import *
|
from types import *
|
||||||
|
@ -57,7 +57,8 @@ class Formatter(FormatterBase):
|
||||||
return ('<sysmsg>', '</sysmsg>')[not on]
|
return ('<sysmsg>', '</sysmsg>')[not on]
|
||||||
|
|
||||||
def rawHTML(self, markup):
|
def rawHTML(self, markup):
|
||||||
return '<html>' + markup + '</html>'
|
#return '<html>' + markup + '</html>'
|
||||||
|
return ''
|
||||||
|
|
||||||
def pagelink(self, on, pagename='', page=None, **kw):
|
def pagelink(self, on, pagename='', page=None, **kw):
|
||||||
if on:
|
if on:
|
||||||
|
@ -76,8 +77,8 @@ class Formatter(FormatterBase):
|
||||||
def url(self, on, url='', css=None, **kw):
|
def url(self, on, url='', css=None, **kw):
|
||||||
return ('[[%s|' % (self._escape(url)), ']]')[not on]
|
return ('[[%s|' % (self._escape(url)), ']]')[not on]
|
||||||
|
|
||||||
def attachment_link(self, url, text, **kw):
|
def attachment_link(self, on, url=None, querystr=None, **kw):
|
||||||
return '{{%s|%s}}' % (url, text)
|
return '{{ %s | %s }}' % (url, querystr)
|
||||||
|
|
||||||
def attachment_image(self, url, **kw):
|
def attachment_image(self, url, **kw):
|
||||||
return '{{%s|}}' % (url,)
|
return '{{%s|}}' % (url,)
|
||||||
|
@ -229,7 +230,7 @@ class Formatter(FormatterBase):
|
||||||
|
|
||||||
return '{{' + url + '}}'
|
return '{{' + url + '}}'
|
||||||
|
|
||||||
def code_area(self, on, code_id, code_type='code', show=0, start=-1, step=-1):
|
def code_area(self, on, code_id, code_type='code', show=0, start=-1, step=-1,msg=None):
|
||||||
syntax = ''
|
syntax = ''
|
||||||
# switch for Python: http://simonwillison.net/2004/may/7/switch/
|
# switch for Python: http://simonwillison.net/2004/may/7/switch/
|
||||||
try:
|
try:
|
||||||
|
@ -254,7 +255,8 @@ class Formatter(FormatterBase):
|
||||||
def comment(self, text):
|
def comment(self, text):
|
||||||
# real comments (lines with two hash marks)
|
# real comments (lines with two hash marks)
|
||||||
if text[0:2] == '##':
|
if text[0:2] == '##':
|
||||||
return "/* %s */\n" % text[2:].strip()
|
#return "/* %s */\n" % text[2:].strip()
|
||||||
|
return ''
|
||||||
|
|
||||||
# Some kind of Processing Instruction
|
# Some kind of Processing Instruction
|
||||||
# http://moinmo.in/HelpOnProcessingInstructions
|
# http://moinmo.in/HelpOnProcessingInstructions
|
||||||
|
@ -274,16 +276,23 @@ class Formatter(FormatterBase):
|
||||||
|
|
||||||
if tokens[0] == 'pragma':
|
if tokens[0] == 'pragma':
|
||||||
# TODO: can do 'description' via 'meta' dokuwiki plugin
|
# TODO: can do 'description' via 'meta' dokuwiki plugin
|
||||||
return "/* pragma: %s */\n" % " ".join(tokens[1:])
|
#return "/* pragma: %s */\n" % " ".join(tokens[1:])
|
||||||
|
return ''
|
||||||
|
|
||||||
return "/* %s */\n" % text.lstrip('#')
|
#return "/* %s */\n" % text.lstrip('#')
|
||||||
|
return ''
|
||||||
|
|
||||||
def macro(self, macro_obj, name, args):
|
|
||||||
|
def macro(self, macro_obj, name, args,markup):
|
||||||
def email(args):
|
def email(args):
|
||||||
mail = args.replace(' AT ', '@')
|
mail = args.replace(' AT ', '@')
|
||||||
mail = mail.replace(' DOT ', '.')
|
mail = mail.replace(' DOT ', '.')
|
||||||
return '[[%s|%s]]' % (mail, args)
|
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
|
# function which will just do what parent class would
|
||||||
def inherit(args):
|
def inherit(args):
|
||||||
return apply(FormatterBase.macro, (self, macro_obj, name, args))
|
return apply(FormatterBase.macro, (self, macro_obj, name, args))
|
||||||
|
@ -294,6 +303,7 @@ class Formatter(FormatterBase):
|
||||||
'MailTo' : email,
|
'MailTo' : email,
|
||||||
'GetText' : args,
|
'GetText' : args,
|
||||||
'ShowSmileys' : inherit,
|
'ShowSmileys' : inherit,
|
||||||
|
'ShowAttachedFiles' : showAttachedFiles
|
||||||
}[name]
|
}[name]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
lookup = '/* UndefinedMacro: %s(%s) */' % (name, args)
|
lookup = '/* UndefinedMacro: %s(%s) */' % (name, args)
|
||||||
|
|
BIN
text_dokuwiki.pyc
Normal file
BIN
text_dokuwiki.pyc
Normal file
Binary file not shown.
Loading…
Reference in a new issue