Commit 44c4c51c authored by Andreas Jung's avatar Andreas Jung

a string '_blabla_' at the end of line has not been recognized properly

as text to be represented as underline.

- updated tests and HTML references
parent 29ca2ebc
...@@ -854,8 +854,7 @@ class DocumentClass: ...@@ -854,8 +854,7 @@ class DocumentClass:
def doc_underline(self, def doc_underline(self,
s, s,
#expr=re.compile(r"\_([a-zA-Z0-9\s\.,\?]+)\_").search, # old expr, inconsistent punc, failed to cross newlines expr=re.compile(r'_([%s%s%s\s]+)_([\s%s]|$)' % (letters, digits, under_punc,phrase_delimiters)).search):
expr=re.compile(r'_([%s%s%s\s]+)_[\s%s]' % (letters, digits, under_punc,phrase_delimiters)).search):
result = expr(s) result = expr(s)
if result: if result:
...@@ -863,7 +862,7 @@ class DocumentClass: ...@@ -863,7 +862,7 @@ class DocumentClass:
return None # no double unders return None # no double unders
start,end = result.span(1) start,end = result.span(1)
st,e = result.span() st,e = result.span()
return (StructuredTextUnderline(s[start:end]),st,e-1) return (StructuredTextUnderline(s[start:end]),st,e-len(result.group(2)))
else: else:
return None return None
......
...@@ -31,11 +31,11 @@ ...@@ -31,11 +31,11 @@
<p><a name="ref1">[1]</a> (The referring text should be a paragraph, not a header, and <p><a name="ref1">[1]</a> (The referring text should be a paragraph, not a header, and
should contain a reference to this footnote, footnote "<a href="#ref1">[1]</a>".)<p> Some hrefs, in a definition list:</p> should contain a reference to this footnote, footnote "<a href="#ref1">[1]</a>".)<p> Some hrefs, in a definition list:</p>
<dl> <dl>
<dt> _Regular_</dt> <dt> <u>Regular</u></dt>
<dd><a href="http://www.zope.org">http://www.zope.org/</a></dd> <dd><a href="http://www.zope.org">http://www.zope.org/</a></dd>
<dt> _W/trailing punctuation_</dt> <dt> <u>W/trailing punctuation</u></dt>
<dd><a href="http://www.zope.org">http://www.zope.org/</a>.</dd> <dd><a href="http://www.zope.org">http://www.zope.org/</a>.</dd>
<dt> _W protocol implicit_</dt> <dt> <u>W protocol implicit</u></dt>
<dd><a href=":locallink">locallink</a></dd> <dd><a href=":locallink">locallink</a></dd>
<dt> <u>W protocol implicit</u>, alternate</dt> <dt> <u>W protocol implicit</u>, alternate</dt>
<dd>"locallink", :locallink</dd> <dd>"locallink", :locallink</dd>
...@@ -46,3 +46,4 @@ should contain a reference to this footnote, footnote "<a href="#ref1">[1]</a>". ...@@ -46,3 +46,4 @@ should contain a reference to this footnote, footnote "<a href="#ref1">[1]</a>".
</p> </p>
</body> </body>
</html> </html>
...@@ -144,6 +144,11 @@ class BasicTests(unittest.TestCase): ...@@ -144,6 +144,11 @@ class BasicTests(unittest.TestCase):
self._test("xx _this is html_ xx", self._test("xx _this is html_ xx",
"xx <u>this is html</u> xx") "xx <u>this is html</u> xx")
def testUnderline1(self):
"""underline 1"""
self._test("xx _this is html_",
"<u>this is html</u>")
def testEmphasis(self): def testEmphasis(self):
""" emphasis """ """ emphasis """
self._test("xx *this is html* xx", self._test("xx *this is html* xx",
......
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