1.1 --- a/MoinContentSupport.py Sun Sep 11 18:50:16 2011 +0200
1.2 +++ b/MoinContentSupport.py Mon Nov 11 13:33:39 2013 +0100
1.3 @@ -2,26 +2,27 @@
1.4 """
1.5 MoinMoin - MoinContentSupport library
1.6
1.7 - @copyright: 2008, 2009, 2010, 2011 by Paul Boddie <paul@boddie.org.uk>
1.8 + @copyright: 2008, 2009, 2010, 2011, 2013 by Paul Boddie <paul@boddie.org.uk>
1.9 @copyright: 2000-2004 Juergen Hermann <jh@web.de>,
1.10 2005-2008 MoinMoin:ThomasWaldmann.
1.11 @license: GNU GPL (v2 or later), see COPYING.txt for details.
1.12 """
1.13
1.14 +from MoinSupport import heading_regexp_str
1.15 from MoinMoin.wikiutil import escape
1.16 import re
1.17
1.18 __version__ = "0.1"
1.19
1.20 # Regular expressions.
1.21 -# NOTE: These overlap with ImprovedMoinSearch and EventAggregator.
1.22
1.23 -heading_regexp_str = r"^(?P<level>=+)\s*(?P<heading>.*?)\s*(?P=level)$"
1.24 hrule_regexp_str = r"^----$"
1.25 include_regexp_str = r"^\s*<<Include.*?>>$"
1.26 section_regexp_str = "(" + heading_regexp_str + "|" + hrule_regexp_str + "|" + include_regexp_str + ")"
1.27 section_regexp = re.compile(section_regexp_str, re.UNICODE | re.MULTILINE)
1.28
1.29 +# NOTE: This overlaps with EventAggregator.
1.30 +
1.31 category_membership_str = ur"^\s*(?:(Category\S+)(?:\s+(Category\S+))*)\s*$"
1.32 category_membership_regexp = re.compile(category_membership_str, re.MULTILINE | re.UNICODE)
1.33 category_declarations_regexp = re.compile("^----$\s*" + category_membership_str, re.MULTILINE | re.UNICODE)
1.34 @@ -81,64 +82,4 @@
1.35
1.36 return "\n----\n%s\n" % " ".join(categories)
1.37
1.38 -# Utility classes and associated functions.
1.39 -# NOTE: These are a subset of EventAggregatorSupport.
1.40 -
1.41 -class Form:
1.42 -
1.43 - """
1.44 - A wrapper preserving MoinMoin 1.8.x (and earlier) behaviour in a 1.9.x
1.45 - environment.
1.46 - """
1.47 -
1.48 - def __init__(self, form):
1.49 - self.form = form
1.50 -
1.51 - def get(self, name, default=None):
1.52 - values = self.form.getlist(name)
1.53 - if not values:
1.54 - return default
1.55 - else:
1.56 - return values
1.57 -
1.58 - def __getitem__(self, name):
1.59 - return self.form.getlist(name)
1.60 -
1.61 -class ActionSupport:
1.62 -
1.63 - """
1.64 - Work around disruptive MoinMoin changes in 1.9, and also provide useful
1.65 - convenience methods.
1.66 - """
1.67 -
1.68 - def get_form(self):
1.69 - return get_form(self.request)
1.70 -
1.71 -def get_form(request):
1.72 -
1.73 - "Work around disruptive MoinMoin changes in 1.9."
1.74 -
1.75 - if hasattr(request, "values"):
1.76 - return Form(request.values)
1.77 - else:
1.78 - return request.form
1.79 -
1.80 -class send_headers:
1.81 -
1.82 - """
1.83 - A wrapper to preserve MoinMoin 1.8.x (and earlier) request behaviour in a
1.84 - 1.9.x environment.
1.85 - """
1.86 -
1.87 - def __init__(self, request):
1.88 - self.request = request
1.89 -
1.90 - def __call__(self, headers):
1.91 - for header in headers:
1.92 - parts = header.split(":")
1.93 - self.request.headers.add(parts[0], ":".join(parts[1:]))
1.94 -
1.95 -def escattr(s):
1.96 - return escape(s, 1)
1.97 -
1.98 # vim: tabstop=4 expandtab shiftwidth=4
2.1 --- a/actions/AddLinkToPage.py Sun Sep 11 18:50:16 2011 +0200
2.2 +++ b/actions/AddLinkToPage.py Mon Nov 11 13:33:39 2013 +0100
2.3 @@ -5,7 +5,7 @@
2.4 Add a link using a form in the page, getting details of the linked document
2.5 and inserting them with the link itself.
2.6
2.7 - @copyright: 2010 Paul Boddie <paul@boddie.org.uk>
2.8 + @copyright: 2010, 2013 Paul Boddie <paul@boddie.org.uk>
2.9 @license: GNU GPL, see COPYING for details.
2.10 """
2.11
2.12 @@ -13,7 +13,8 @@
2.13
2.14 from MoinMoin.action import ActionBase
2.15 from MoinMoin.PageEditor import PageEditor
2.16 -from MoinContentSupport import ActionSupport, escape, escattr
2.17 +from MoinMoin.wikiutil import escape
2.18 +from MoinSupport import ActionSupport, escattr
2.19 import urllib
2.20 import re
2.21
3.1 --- a/actions/SectionBreakout.py Sun Sep 11 18:50:16 2011 +0200
3.2 +++ b/actions/SectionBreakout.py Mon Nov 11 13:33:39 2013 +0100
3.3 @@ -5,7 +5,7 @@
3.4 Break sections out of a page, making new pages for each of the sections and
3.5 replacing them with Include macros.
3.6
3.7 - @copyright: 2011 Paul Boddie <paul@boddie.org.uk>
3.8 + @copyright: 2011, 2013 Paul Boddie <paul@boddie.org.uk>
3.9 @license: GNU GPL, see COPYING for details.
3.10 """
3.11
3.12 @@ -13,7 +13,9 @@
3.13
3.14 from MoinMoin.action import ActionBase
3.15 from MoinMoin.PageEditor import PageEditor
3.16 +from MoinMoin.wikiutil import escape
3.17 from MoinContentSupport import *
3.18 +from MoinSupport import ActionSupport, escattr
3.19 import re
3.20
3.21 # Action class and supporting functions.