Commit f9dd0c60 authored by Guido van Rossum's avatar Guido van Rossum

Several regular expressions were using ".*" without "DOTALL" mode, and

hence were unable to cope with the newlines that may occur in HTML
attributes.  This caused sustitution of "str:foo\nbar" to insert
"foo", omitting "\nbar".
parent c298bba6
......@@ -121,7 +121,7 @@ class DummyEngine:
self.globals[name] = value
def evaluate(self, expression):
m = re.match(r"(%s):(.*)" % NAME_RE, expression)
m = re.match(r"(?s)(%s):(.*)\Z" % NAME_RE, expression)
if m:
type, expr = m.group(1, 2)
else:
......
......@@ -129,8 +129,8 @@ class METALError(TALError):
pass
import re
_attr_re = re.compile(r"\s*([^\s]+)\s*(.*)")
_subst_re = re.compile(r"\s*(?:(text|structure)\s+)?(.*)")
_attr_re = re.compile(r"\s*([^\s]+)\s*(.*)\Z", re.S)
_subst_re = re.compile(r"\s*(?:(text|structure)\s+)?(.*)\Z", re.S)
del re
def parseAttributeReplacements(arg):
......
......@@ -12,7 +12,11 @@
Is
The
Replaced
Title">This</h1>
Title">This
Is
The
Replaced
Title</h1>
<!-- test entity references -->
&nbsp;&HarryPotter;
......
......@@ -12,7 +12,11 @@
Is
The
Replaced
Title">This</h1>
Title">This
Is
The
Replaced
Title</h1>
<!-- test entity references -->
&nbsp;&HarryPotter;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment