[Zope-Checkins] CVS: Zope2 - ClassicDocumentClass.py:1.16 DocumentClass.py:1.32 HTMLClass.py:1.12 StructuredText.py:1.42

Chris McDonough chrism@digicool.com
Fri, 13 Jul 2001 23:04:16 -0400


Enabling underlining is wrong.  Structured text NG should not support
underlines.  It's not part of the spec at
http://www.zope.org/Members/jim/StructuredTextWiki/StructuredTextNGRules .


----- Original Message -----
From: <andreas@digicool.com>
To: <zope-checkins@zope.org>
Sent: Thursday, July 12, 2001 4:04 PM
Subject: [Zope-Checkins] CVS: Zope2 - ClassicDocumentClass.py:1.16
DocumentClass.py:1.32 HTMLClass.py:1.12 StructuredText.py:1.42


> Update of /cvs-repository/Zope2/lib/python/StructuredText
> In directory
korak.digicool.com:/tmp/cvs-serv11220/lib/python/StructuredText
>
> Modified Files:
> ClassicDocumentClass.py DocumentClass.py HTMLClass.py
> StructuredText.py
> Log Message:
> Collector # 2397: StructuredText could not handle underlined text
> properly. Also <dtml-var stxdoc ftm=structured-text> will no longer
> produce <html>..<body>  and </body>..</html>
>
>
>
> --- Updated File ClassicDocumentClass.py in package Zope2 --
> --- ClassicDocumentClass.py 2001/07/02 19:13:27 1.15
> +++ ClassicDocumentClass.py 2001/07/12 20:04:01 1.16
> @@ -628,10 +628,13 @@
>
>      def doc_underline(self,
>                        s,
> -                      expr=re.compile("\_([%s0-9\s\.,\?\/]+)\_" %
letters).search):
> +                      expr=re.compile("_([%s0-9\s\.,\?\/]+)_" %
letters).search):
> +
> +        print s
>
>          result = expr(s)
>          if result:
> +            print "got it"
>              start,end = result.span(1)
>              st,e = result.span()
>              return (StructuredTextUnderline(s[start:end]),st,e)
>
> --- Updated File DocumentClass.py in package Zope2 --
> --- DocumentClass.py 2001/07/12 18:37:12 1.31
> +++ DocumentClass.py 2001/07/12 20:04:01 1.32
> @@ -371,6 +371,7 @@
>          'doc_href',
>          'doc_strong',
>          'doc_emphasize',
> +        'doc_underline',
>          'doc_literal',
>          'doc_sgml',
>          'doc_xref',
> @@ -924,6 +925,7 @@
>                        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]+)_' % (letters,
digits, under_punc)).search):
> +
>          result = expr(s)
>          if result:
>              if result.group(1)[:1] == '_':
>
> --- Updated File HTMLClass.py in package Zope2 --
> --- HTMLClass.py 2001/06/15 05:07:41 1.11
> +++ HTMLClass.py 2001/07/12 20:04:01 1.12
> @@ -113,11 +113,13 @@
>          'StructuredTextSGML':'sgml',
>          }
>
> +
>      def dispatch(self, doc, level, output):
>          getattr(self, self.element_types[doc.getNodeName()])(doc, level,
output)
>
> -    def __call__(self, doc, level=1):
> +    def __call__(self, doc, level=1, header=1):
>          r=[]
> +        self.header = header
>          self.dispatch(doc, level-1, r.append)
>          return join(r,'')
>
> @@ -125,17 +127,22 @@
>          output(doc.getNodeValue())
>
>      def document(self, doc, level, output):
> -        output('<html>\n')
>          children=doc.getChildNodes()
> -        if (children and
> -             children[0].getNodeName() == 'StructuredTextSection'):
> -            output('<head>\n<title>%s</title>\n</head>\n' %
> -                     children[0].getChildNodes()[0].getNodeValue())
> -        output('<body>\n')
> +
> +        if self.header==1:
> +            output('<html>\n')
> +            if (children and
> +                 children[0].getNodeName() == 'StructuredTextSection'):
> +                output('<head>\n<title>%s</title>\n</head>\n' %
> +                         children[0].getChildNodes()[0].getNodeValue())
> +            output('<body>\n')
> +
>          for c in children:
>              getattr(self, self.element_types[c.getNodeName()])(c, level,
output)
> -        output('</body>\n')
> -        output('</html>\n')
> +
> +        if self.header==1:
> +            output('</body>\n')
> +            output('</html>\n')
>
>      def section(self, doc, level, output):
>          children=doc.getChildNodes()
>
> --- Updated File StructuredText.py in package Zope2 --
> --- StructuredText.py 2001/07/06 18:13:38 1.41
> +++ StructuredText.py 2001/07/12 20:04:01 1.42
> @@ -96,15 +96,15 @@
>  Document = DocumentClass.DocumentClass()
>  HTMLNG = HTMLClass.HTMLClass()
>
> -def HTML(aStructuredString, level=0):
> +def HTML(aStructuredString, level=0, header=1):
>      st = Basic(aStructuredString)
>      doc = Document(st)
> -    return HTMLNG(doc)
> +    return HTMLNG(doc,header=header)
>
>  def StructuredText(aStructuredString, level=0):
>      return HTML(aStructuredString,level)
>
> -def html_with_references(text, level=1):
> +def html_with_references(text, level=1, header=1):
>      text = re.sub(
>          r'[\000\n]\.\. \[([0-9_%s-]+)\]' % letters,
>          r'\n  <a name="\1">[\1]</a>',
> @@ -120,7 +120,7 @@
>          r'\1<a href="\2.html">[\2]</a>\3',
>          text)
>
> -    return HTML(text,level=level)
> +    return HTML(text,level=level,header=header)
>
>  def html_quote(v,
>                 character_entities=(
>
>
> _______________________________________________
> Zope-Checkins maillist  -  Zope-Checkins@zope.org
> http://lists.zope.org/mailman/listinfo/zope-checkins
>