1.1 --- a/parsers/MoinShare.py Sat Sep 29 17:53:04 2012 +0200
1.2 +++ b/parsers/MoinShare.py Mon May 06 16:57:55 2013 +0200
1.3 @@ -2,11 +2,11 @@
1.4 """
1.5 MoinMoin - MoinShare fragment parser
1.6
1.7 - @copyright: 2011, 2012 by Paul Boddie <paul@boddie.org.uk>
1.8 + @copyright: 2011, 2012, 2013 by Paul Boddie <paul@boddie.org.uk>
1.9 @license: GNU GPL (v2 or later), see COPYING.txt for details.
1.10 """
1.11
1.12 -from MoinSupport import parseAttributes
1.13 +from MoinSupport import parseAttributes, getParserClass, formatText
1.14 from MoinMoin import wikiutil
1.15
1.16 try:
1.17 @@ -73,20 +73,6 @@
1.18
1.19 return self.format_type
1.20
1.21 - def getParserClass(self, format):
1.22 -
1.23 - """
1.24 - Return a parser class for the given 'format', returning a plain text
1.25 - parser if no parser can be found for the specified 'format'.
1.26 - """
1.27 -
1.28 - cfg = self.request.cfg
1.29 -
1.30 - try:
1.31 - return wikiutil.searchAndImportPlugin(cfg, "parser", format or "wiki")
1.32 - except wikiutil.PluginMissingError:
1.33 - return wikiutil.searchAndImportPlugin(cfg, "parser", "plain")
1.34 -
1.35 def formatText(self, text, fmt):
1.36
1.37 """
1.38 @@ -94,20 +80,8 @@
1.39 """
1.40
1.41 request = self.request
1.42 - page = fmt.page = request.page
1.43 format = self.getFormat()
1.44
1.45 - # Suppress line anchors.
1.46 -
1.47 - parser_cls = self.getParserClass(format)
1.48 - parser = parser_cls(text, request, line_anchors=False)
1.49 -
1.50 - # Fix lists by indicating that a paragraph is already started.
1.51 -
1.52 - kw = {}
1.53 - if not format or format == "wiki":
1.54 - kw["inhibit_p"] = True
1.55 -
1.56 - return request.redirectedOutput(parser.format, fmt, **kw)
1.57 + return formatText(text, request, fmt, inhibit_p=True, parser_cls=getParserClass(request, format))
1.58
1.59 # vim: tabstop=4 expandtab shiftwidth=4