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:
def doc_underline(self,
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)
if result:
......@@ -863,7 +862,7 @@ class DocumentClass:
return None # no double unders
start,end = result.span(1)
st,e = result.span()
return (StructuredTextUnderline(s[start:end]),st,e-1)
return (StructuredTextUnderline(s[start:end]),st,e-len(result.group(2)))
else:
return None
......
......@@ -31,11 +31,11 @@
<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>
<dl>
<dt> _Regular_</dt>
<dt> <u>Regular</u></dt>
<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>
<dt> _W protocol implicit_</dt>
<dt> <u>W protocol implicit</u></dt>
<dd><a href=":locallink">locallink</a></dd>
<dt> <u>W protocol implicit</u>, alternate</dt>
<dd>"locallink", :locallink</dd>
......@@ -46,3 +46,4 @@ should contain a reference to this footnote, footnote "<a href="#ref1">[1]</a>".
</p>
</body>
</html>
......@@ -143,6 +143,11 @@ class BasicTests(unittest.TestCase):
"""underline"""
self._test("xx _this is html_ 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):
""" emphasis """
......
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