Mercurial > moin > 1.9
changeset 2760:d373e273cd7b
merged main
author | Thomas Waldmann <tw AT waldmann-edv DOT de> |
---|---|
date | Sat, 25 Aug 2007 17:27:14 +0200 |
parents | fe6098e2a895 (current diff) 3435f31e037e (diff) |
children | 3a6a25169f55 |
files | MoinMoin/parser/text_moin_wiki.py MoinMoin/wikiutil.py |
diffstat | 3 files changed, 33 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/MoinMoin/parser/text_moin_wiki.py Sat Aug 25 16:39:42 2007 +0200 +++ b/MoinMoin/parser/text_moin_wiki.py Sat Aug 25 17:27:14 2007 +0200 @@ -1159,7 +1159,13 @@ self.formatter.in_p) and lastpos < len(line): result.append(self.formatter.paragraph(1, css_class="line874")) if '}}}' in line and len(line[lastpos:].strip()) > 0: - result.append(wikiutil.renderText(self.request, Parser, line[lastpos:].strip())) + rules = self.formatting_rules.replace('\n', '|') + rules = ur'(?P<notword>!%(word_rule)s)|%(rules)s' % { + 'word_rule': self.word_rule, + 'rules': rules, + } + scanning_re = re.compile(rules, re.UNICODE) + result.append(self.scan(scanning_re, line[lastpos:].strip(), inhibit_p=inhibit_p)) else: result.append(self.formatter.text(line[lastpos:])) return u''.join(result)
--- a/MoinMoin/support/python_compatibility.py Sat Aug 25 16:39:42 2007 +0200 +++ b/MoinMoin/support/python_compatibility.py Sat Aug 25 17:27:14 2007 +0200 @@ -3,7 +3,8 @@ Stuff for compatibility with older pytohn versions - @copyright: 2007 Heinrich Wendel <heinrich.wendel@gmail.com> + @copyright: 2007 Heinrich Wendel <heinrich.wendel@gmail.com>, + 2007 MoinMoin:ThomasWaldmann @license: GNU GPL, see COPYING for details. """ @@ -12,6 +13,27 @@ although it may not be 100% compatible. """ try: + import string + rsplit = string.rsplit +except AttributeError: + # CAUTION: you can't use s.rsplit(...), only rsplit(s, ...) with this! + def rsplit(s, sep=None, maxsplit=-1): + """rsplit(s [,sep [,maxsplit]]) -> list of strings + + Return a list of the words in the string s, using sep as the + delimiter string, starting at the end of the string and working + to the front. If maxsplit is given, at most maxsplit splits are + done. If sep is not specified or is None, any whitespace string + is a separator. + """ + fragments = s[::-1].split(sep, maxsplit) + return [fragment[::-1] for fragment in fragments[::-1]] + +""" +This is a feature from python 2.4, needed for compatibility with python 2.3, +although it may not be 100% compatible. +""" +try: sorted = sorted except NameError: def sorted(l, *args, **kw):
--- a/MoinMoin/wikiutil.py Sat Aug 25 16:39:42 2007 +0200 +++ b/MoinMoin/wikiutil.py Sat Aug 25 17:27:14 2007 +0200 @@ -255,8 +255,8 @@ @return: cleaned text """ # we only have input fields with max 200 chars, but spammers send us more - l = len(text) - if l == 0 or l > max_len: + length = len(text) + if length == 0 or length > max_len: return u'' else: return text.translate(config.clean_input_translation_map) @@ -2254,3 +2254,4 @@ pi.append((verb.lower(), args.strip())) return pi, body +