MoinSupport

Changeset

87:6880a13390fa
2013-10-15 Paul Boddie raw files shortlog changelog graph Fixed the extraction of "verbatim" text in getSimpleWikiText.
MoinSupport.py (file) README.txt (file)
     1.1 --- a/MoinSupport.py	Sat Oct 12 19:21:46 2013 +0200
     1.2 +++ b/MoinSupport.py	Tue Oct 15 13:28:23 2013 +0200
     1.3 @@ -968,7 +968,28 @@
     1.4  
     1.5      # NOTE: Re-implementing support for verbatim text and linking avoidance.
     1.6  
     1.7 -    return "".join([s for s in verbatim_regexp.split(text) if s is not None])
     1.8 +    l = []
     1.9 +    last = 0
    1.10 +
    1.11 +    for m in verbatim_regexp.finditer(text):
    1.12 +        start, end = m.span()
    1.13 +        l.append(text[last:start])
    1.14 +
    1.15 +        # Process the verbatim macro arguments.
    1.16 +
    1.17 +        args = m.group("verbatim") or m.group("verbatim2")
    1.18 +        if args:
    1.19 +            l += [v for (n, v) in parseMacroArguments(args)]
    1.20 +
    1.21 +        # Or just add the match groups.
    1.22 +
    1.23 +        else:
    1.24 +            l += [s for s in m.groups() if s]
    1.25 +
    1.26 +        last = end
    1.27 +
    1.28 +    l.append(text[last:])
    1.29 +    return "".join(l)
    1.30  
    1.31  def getEncodedWikiText(text):
    1.32  
     2.1 --- a/README.txt	Sat Oct 12 19:21:46 2013 +0200
     2.2 +++ b/README.txt	Tue Oct 15 13:28:23 2013 +0200
     2.3 @@ -72,6 +72,7 @@
     2.4    * Fixed DateSupport to handle NonExistentTimeError.
     2.5    * Added macro argument quoting functions.
     2.6    * Fixed the quoting of text presented as an argument to the Verbatim macro.
     2.7 +  * Fixed the extraction of "verbatim" text in getSimpleWikiText.
     2.8  
     2.9  New in MoinSupport 0.4 (Changes since MoinSupport 0.3)
    2.10  ------------------------------------------------------