Update of /cvsroot/happydoc/HappyDoc/happydoclib/docstring
In directory usw-pr-cvs1:/tmp/cvs-serv8219/happydoclib/docstring
Modified Files:
docstring_StructuredText.py
Log Message:
Added some tests for quoted characters.
Changed handling of fixed format code sections using single quotes
so that quotable characters are not quoted ( > stays > instead of
>, etc.). This is related to defect #510447.
Index: docstring_StructuredText.py
===================================================================
RCS file: /cvsroot/happydoc/HappyDoc/happydoclib/docstring/docstring_StructuredText.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** docstring_StructuredText.py 30 Dec 2001 13:44:07 -0000 1.3
--- docstring_StructuredText.py 10 Feb 2002 13:18:41 -0000 1.4
***************
*** 154,161 ****
return
else:
! if tag_name == 'StructuredTextExample':
actual_para = st.aq_self
text = self._unquoteHTML(actual_para._src)
actual_para._src = text
else:
for child in st.getChildNodes():
--- 154,165 ----
return
else:
! if tag_name in ('StructuredTextExample',):
actual_para = st.aq_self
text = self._unquoteHTML(actual_para._src)
actual_para._src = text
+ elif tag_name in ( 'StructuredTextLiteral',):
+ actual_para = st.aq_self
+ text = self._unquoteHTML(actual_para._value)
+ actual_para._value = text
else:
for child in st.getChildNodes():
***************
*** 257,260 ****
--- 261,271 ----
"""
+ happydoclib.TRACE.into('StructuredTextConverter',
+ 'quote',
+ inputText=inputText,
+ outputFormat=outputFormat,
+ args=args,
+ namedArgs=namedArgs,
+ )
self._testOutputFormat(outputFormat)
if outputFormat == 'html':
***************
*** 263,266 ****
--- 274,278 ----
namedArgs,
)
+ happydoclib.TRACE.write('AFTER QUOTING="%s"' % html_quoted)
#
# Replace form: ".*":
***************
*** 273,278 ****
'"\\1":',
html_quoted)
return html_quoted
!
return inputText
--- 285,292 ----
'"\\1":',
html_quoted)
+ happydoclib.TRACE.write('AFTER FIXUP="%s"' % html_quoted)
return html_quoted
!
! happydoclib.TRACE.outof(inputText)
return inputText
***************
*** 625,626 ****
--- 639,680 ----
+ def testWithQuotableCharacters(self):
+ input_text = "Here are some quotable characters. & < > < >."
+ expected_text = '\n<p>Here are some quotable characters. & < > < >.</p>\n'
+
+ self._testConversion(
+ input_text,
+ 'StructuredText',
+ 'html',
+ expected_text,
+ 'Converting ST to HTML with quotable characters did not produce expected results.',
+ )
+
+
+ def testWithQuotableCharactersInExample(self):
+ input_text = """Here are some quotable characters in example paragraphs
+
+ First, a true example::
+
+ Begin & < >
+
+ Finally, embedded in a code segment '& < >'.
+ """
+ expected_text = """
+ <h3>Here are some quotable characters in example paragraphs</h3>
+ <p> First, a true example:
+ <pre>
+ Begin & < >
+ </pre>
+ </p>
+ <p> Finally, embedded in a code segment '& < >'.</p>
+ """
+
+ self._testConversion(
+ input_text,
+ 'StructuredText',
+ 'html',
+ expected_text,
+ 'Converting ST to HTML with quotable characters did not produce expected results.',
+ )
+
|