Installing the Moin2rst plugin
I was trying to install this plugin into my MoinMoin 1.9 wiki → https://github.com/dwf/moin2rst
The installation instruction are incorrect
wiki/data/plugin/action/RenderAsRestructuredtext.py wiki/data/plugin/formatter/text_x-rst.py
Errors and changes to make this work with MoinMoin 1.9
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/MoinMoin/support/werkzeug/wsgi.py", line 766, in __call__
return self.app(environ, start_response)
File "/usr/local/lib/python2.7/site-packages/MoinMoin/wsgiapp.py", line 264, in __call__
response = run(context)
File "/usr/local/lib/python2.7/site-packages/MoinMoin/wsgiapp.py", line 89, in run
response = dispatch(request, context, action_name)
File "/usr/local/lib/python2.7/site-packages/MoinMoin/wsgiapp.py", line 137, in dispatch
response = handle_action(context, pagename, action_name)
File "/usr/local/lib/python2.7/site-packages/MoinMoin/wsgiapp.py", line 203, in handle_action
handler(context.page.page_name, context)
File "/usr/local/lib/python2.7/site-packages/MoinMoin/action/__init__.py", line 277, in do_format
do_show(pagename, request, count_hit=0, cacheable=0, mimetype=u'text/plain')
File "/usr/local/lib/python2.7/site-packages/MoinMoin/action/__init__.py", line 267, in do_show
content_only=content_only,
File "/usr/local/lib/python2.7/site-packages/MoinMoin/Page.py", line 1165, in send_page
Formatter = wikiutil.searchAndImportPlugin(request.cfg, "formatter", self.output_mimetype)
File "/usr/local/lib/python2.7/site-packages/MoinMoin/wikiutil.py", line 1194, in searchAndImportPlugin
raise PluginMissingError("Plugin not found! (%r %r %r)" % (type, name, what))
MoinMoin.wikiutil.PluginMissingError: Plugin not found! ('formatter' 'text/x-rst' 'Formatter')
A change in wikiutil.py#Mime means the formatter plug in is not being found. The file we are looking for won't be what is supplied with the GIT repo.
modname = mimetype.replace("/", "_").replace("-", "_").replace(".", "_")
Rename the file from text_x-rst.py TO text_x_rst.py
-rw-r--r-- 1 root www 34417 Jan 21 17:11 text_x_rst.py
Next problem
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/MoinMoin/support/werkzeug/wsgi.py", line 766, in __call__
return self.app(environ, start_response)
File "/usr/local/lib/python2.7/site-packages/MoinMoin/wsgiapp.py", line 264, in __call__
response = run(context)
File "/usr/local/lib/python2.7/site-packages/MoinMoin/wsgiapp.py", line 89, in run
response = dispatch(request, context, action_name)
File "/usr/local/lib/python2.7/site-packages/MoinMoin/wsgiapp.py", line 137, in dispatch
response = handle_action(context, pagename, action_name)
File "/usr/local/lib/python2.7/site-packages/MoinMoin/wsgiapp.py", line 203, in handle_action
handler(context.page.page_name, context)
File "/usr/local/lib/python2.7/site-packages/MoinMoin/action/__init__.py", line 277, in do_format
do_show(pagename, request, count_hit=0, cacheable=0, mimetype=u'text/plain')
File "/usr/local/lib/python2.7/site-packages/MoinMoin/action/__init__.py", line 267, in do_show
content_only=content_only,
File "/usr/local/lib/python2.7/site-packages/MoinMoin/Page.py", line 1332, in send_page
start_line=pi['lines'])
File "/usr/local/lib/python2.7/site-packages/MoinMoin/Page.py", line 1422, in send_page_content
self.format(parser)
File "/usr/local/lib/python2.7/site-packages/MoinMoin/Page.py", line 1443, in format
parser.format(self.formatter)
File "/usr/local/lib/python2.7/site-packages/MoinMoin/parser/text_moin_wiki.py", line 1553, in format
formatted_line = self.scan(line, inhibit_p=inhibit_p)
File "/usr/local/lib/python2.7/site-packages/MoinMoin/parser/text_moin_wiki.py", line 1363, in scan
result.append(self.replace(match, inhibit_p))
File "/usr/local/lib/python2.7/site-packages/MoinMoin/parser/text_moin_wiki.py", line 1407, in replace
result.append(replace_func(hit, match.groupdict()))
File "/usr/local/lib/python2.7/site-packages/MoinMoin/parser/text_moin_wiki.py", line 1330, in _macro_repl
return self.formatter.macro(self.macro, macro_name, macro_args, markup=groups.get('macro'))
TypeError: macro() got an unexpected keyword argument 'markup'
text_x_rst.py: Change the definition of this call:
def macro(self, macroObj, name, argString):
to:
def macro(self, macroObj, name, argString, **kwargs):
Next problem
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/MoinMoin/support/werkzeug/wsgi.py", line 766, in __call__
return self.app(environ, start_response)
File "/usr/local/lib/python2.7/site-packages/MoinMoin/wsgiapp.py", line 264, in __call__
response = run(context)
File "/usr/local/lib/python2.7/site-packages/MoinMoin/wsgiapp.py", line 89, in run
response = dispatch(request, context, action_name)
File "/usr/local/lib/python2.7/site-packages/MoinMoin/wsgiapp.py", line 137, in dispatch
response = handle_action(context, pagename, action_name)
File "/usr/local/lib/python2.7/site-packages/MoinMoin/wsgiapp.py", line 203, in handle_action
handler(context.page.page_name, context)
File "/usr/local/lib/python2.7/site-packages/MoinMoin/action/__init__.py", line 277, in do_format
do_show(pagename, request, count_hit=0, cacheable=0, mimetype=u'text/plain')
File "/usr/local/lib/python2.7/site-packages/MoinMoin/action/__init__.py", line 267, in do_show
content_only=content_only,
File "/usr/local/lib/python2.7/site-packages/MoinMoin/Page.py", line 1332, in send_page
start_line=pi['lines'])
File "/usr/local/lib/python2.7/site-packages/MoinMoin/Page.py", line 1422, in send_page_content
self.format(parser)
File "/usr/local/lib/python2.7/site-packages/MoinMoin/Page.py", line 1443, in format
parser.format(self.formatter)
File "/usr/local/lib/python2.7/site-packages/MoinMoin/parser/text_moin_wiki.py", line 1553, in format
formatted_line = self.scan(line, inhibit_p=inhibit_p)
File "/usr/local/lib/python2.7/site-packages/MoinMoin/parser/text_moin_wiki.py", line 1363, in scan
result.append(self.replace(match, inhibit_p))
File "/usr/local/lib/python2.7/site-packages/MoinMoin/parser/text_moin_wiki.py", line 1407, in replace
result.append(replace_func(hit, match.groupdict()))
File "/usr/local/lib/python2.7/site-packages/MoinMoin/parser/text_moin_wiki.py", line 876, in _link_repl
self._link_description(desc, target, page_name_and_anchor) +
File "/usr/local/www/wiki/data/plugin/formatter/text_x_rst.py", line 488, in pagelink
url = self.request.normalizePagename(pagename)
File "/usr/local/lib/python2.7/site-packages/MoinMoin/web/contexts.py", line 224, in __getattr__
return super(HTTPContext, self).__getattribute__(name)
AttributeError: 'AllContext' object has no attribute 'normalizePagename'
Change these two calls in the text_x_rst.py file
def pagelink...
url = self.request.normalizePagename(pagename)
urlPath = url.split("/")
thisPath = self.request.normalizePagename(self.page.page_name).split("/")
TO
url = wikiutil.normalize_pagename(pagename, self.request.cfg)
urlPath = url.split("/")
thisPath = wikiutil.normalize_pagename(self.page.page_name, self.request.cfg).split("/")
After all this and getting it working I decided it was just easier to use docbook !