[ZCM] [ZC] 432/ 3 Comment "STX: '*code*' and '**code**' render differently from '_code_'"

Collector: Zope Bugs, Features, and Patches ... zope-coders@zope.org
Sun, 16 Jun 2002 14:06:36 -0400


Issue #432 Update (Comment) "STX: '*code*' and '**code**' render differently from '_code_'"
 Status Pending, Zope/bug low
To followup, visit:
  http://collector.zope.org/Zope/432

==============================================================
= Comment - Entry #3 by hamish on Jun 16, 2002 2:06 pm

Sorry, new to this. I also didn't check whether I could log in, and just believed the note on the login form, but it would appear that I can.

To check the unit tests, I just run StructuredText/test/testStructuredText.py? Or do I need to run a full suite of Zope tests? If the former then yes, they pass, this case wasn't tested for. If the latter, then is there an easy way to do that?

Here is a diff to add to more tests for the cases I complained about, and one with a structured text link within a code element.

Cheers,
Hamish

--- testStructuredText.py.orig  Sun Jun 16 18:25:42 2002
+++ testStructuredText.py       Sun Jun 16 18:28:29 2002
@@ -177,6 +177,23 @@
         self._test("this is '__a_literal__' eh",
                    "<code>__a_literal__</code>")

+    def testAsterisksInLiteral(self):
+        """ asterisks in literals shouldn't do emphasis """
+
+        self._test("this is a '*literal*' eh",
+                   "<code>*literal*</code>")
+
+    def testDoubleAsterisksInLiteral(self):
+        """ double asterisks in literals shouldn't do bold """
+
+        self._test("this is a '**literal**' eh",
+                   "<code>**literal**</code>")
+
+    def testLinkInLiteral(self):
+        """ links in literals should be passed through """
+
+        self._test("this is a '\"literal\":http://www.zope.org/.' eh",
+                   '<code>"literal":http://www.zope.org/.</code>')

     def testUnderlinesWithoutWithspaces(self):
         """ underscores in literals shouldn't do unterlining """


________________________________________
= Comment - Entry #2 by ajung on Jun 16, 2002 12:50 pm

Did you check that the unittests are still working?

-aj
________________________________________
= Request - Entry #1 by Anonymous User on Jun 16, 2002 12:44 pm

In structured text, '*code*' and '**code**' render as emphasised and emboldened text surrounded by single quotes. '_code_' renders as a code element, showing the _ characters.

I would have thought that all three should behave as the underline case does. I came across this in the process of putting together documentation for structured text for users of my site.

Diff below against DocumentClass.py moved doc_literal to the top of the list, so all other markup is escaped by doc_literal. This suits my purpose, but maybe not yours :-)

Cheers,
Hamish

--- DocumentClass.py.orig       Sun Jun 16 17:03:56 2002
+++ DocumentClass.py    Sun Jun 16 16:57:52 2002
@@ -295,6 +295,7 @@
     #'doc_named_link',
     #'doc_underline'
     text_types = [
+        'doc_literal',
         'doc_sgml',
         'doc_inner_link',
         'doc_named_link',
@@ -302,7 +303,6 @@
         'doc_href2',
         'doc_strong',
         'doc_emphasize',
-        'doc_literal',
         'doc_underline',
         'doc_sgml',
         'doc_xref',

==============================================================