[Zope-Checkins] CVS: Zope/lib/python/docutils/parsers/rst - __init__.py:1.2.10.5 roles.py:1.1.4.2 states.py:1.2.10.5

Christian 'Tiran' Heimes heimes at faho.rwth-aachen.de
Mon Jul 26 13:38:39 EDT 2004


Update of /cvs-repository/Zope/lib/python/docutils/parsers/rst
In directory cvs.zope.org:/tmp/cvs-serv18892/lib/python/docutils/parsers/rst

Modified Files:
      Tag: Zope-2_7-branch
	__init__.py roles.py states.py 
Log Message:
Updated docutils including a fix for 1426:  System locale breaks reStructuredText horribly
Added rest-language-code to zope.conf schema. it's used instead of the locales


=== Zope/lib/python/docutils/parsers/rst/__init__.py 1.2.10.4 => 1.2.10.5 ===
--- Zope/lib/python/docutils/parsers/rst/__init__.py:1.2.10.4	Thu May 13 12:19:58 2004
+++ Zope/lib/python/docutils/parsers/rst/__init__.py	Mon Jul 26 13:38:08 2004
@@ -88,12 +88,21 @@
     settings_spec = (
         'reStructuredText Parser Options',
         None,
-        (('Recognize and link to PEP references (like "PEP 258").',
+        (('Recognize and link to standalone PEP references (like "PEP 258").',
           ['--pep-references'],
           {'action': 'store_true', 'validator': frontend.validate_boolean}),
-         ('Recognize and link to RFC references (like "RFC 822").',
+         ('Base URL for PEP references '
+          '(default "http://www.python.org/peps/").',
+          ['--pep-base-url'],
+          {'metavar': '<URL>', 'default': 'http://www.python.org/peps/',
+           'validator': frontend.validate_url_trailing_slash}),
+         ('Recognize and link to standalone RFC references (like "RFC 822").',
           ['--rfc-references'],
           {'action': 'store_true', 'validator': frontend.validate_boolean}),
+         ('Base URL for RFC references (default "http://www.faqs.org/rfcs/").',
+          ['--rfc-base-url'],
+          {'metavar': '<URL>', 'default': 'http://www.faqs.org/rfcs/',
+           'validator': frontend.validate_url_trailing_slash}),
          ('Set number of spaces for tab expansion (default 8).',
           ['--tab-width'],
           {'metavar': '<width>', 'type': 'int', 'default': 8}),


=== Zope/lib/python/docutils/parsers/rst/roles.py 1.1.4.1 => 1.1.4.2 ===
--- Zope/lib/python/docutils/parsers/rst/roles.py:1.1.4.1	Thu May 13 12:19:58 2004
+++ Zope/lib/python/docutils/parsers/rst/roles.py	Mon Jul 26 13:38:08 2004
@@ -263,7 +263,7 @@
         prb = inliner.problematic(rawtext, rawtext, msg)
         return [prb], [msg]
     # Base URL mainly used by inliner.pep_reference; so this is correct:
-    ref = inliner.pep_url % pepnum
+    ref = inliner.document.settings.pep_base_url + inliner.pep_url % pepnum
     return [nodes.reference(rawtext, 'PEP ' + text, refuri=ref, **options)], []
 
 register_canonical_role('pep-reference', pep_reference_role)
@@ -281,7 +281,7 @@
         prb = inliner.problematic(rawtext, rawtext, msg)
         return [prb], [msg]
     # Base URL mainly used by inliner.rfc_reference, so this is correct:
-    ref = inliner.rfc_url % rfcnum
+    ref = inliner.document.settings.rfc_base_url + inliner.rfc_url % rfcnum
     node = nodes.reference(rawtext, 'RFC ' + text, refuri=ref, **options)
     return [node], []
 


=== Zope/lib/python/docutils/parsers/rst/states.py 1.2.10.4 => 1.2.10.5 ===
--- Zope/lib/python/docutils/parsers/rst/states.py:1.2.10.4	Thu May 13 12:19:58 2004
+++ Zope/lib/python/docutils/parsers/rst/states.py	Mon Jul 26 13:38:08 2004
@@ -556,14 +556,19 @@
     # Valid URI characters (see RFC 2396 & RFC 2732);
     # final \x00 allows backslash escapes in URIs:
     uric = r"""[-_.!~*'()[\];/:@&=+$,%a-zA-Z0-9\x00]"""
+    # Delimiter indicating the end of a URI (not part of the URI):
+    uri_end_delim = r"""[>]"""
     # Last URI character; same as uric but no punctuation:
-    urilast = r"""[_~/a-zA-Z0-9]"""
+    urilast = r"""[_~*/=+a-zA-Z0-9]"""
+    # End of a URI (either 'urilast' or 'uric followed by a
+    # uri_end_delim'):
+    uri_end = r"""(?:%(urilast)s|%(uric)s(?=%(uri_end_delim)s))""" % locals()
     emailc = r"""[-_!~*'{|}/#?^`&=+$%a-zA-Z0-9\x00]"""
     email_pattern = r"""
           %(emailc)s+(?:\.%(emailc)s+)*   # name
           @                               # at
           %(emailc)s+(?:\.%(emailc)s*)*   # host
-          %(urilast)s                     # final URI char
+          %(uri_end)s                     # final URI char
           """
     parts = ('initial_inline', start_string_prefix, '',
              [('start', '', non_whitespace_after,  # simple start-strings
@@ -642,15 +647,15 @@
                       (                       # either:
                         (//?)?                  # hierarchical URI
                         %(uric)s*               # URI characters
-                        %(urilast)s             # final URI char
+                        %(uri_end)s             # final URI char
                       )
                       (                       # optional query
                         \?%(uric)s*
-                        %(urilast)s
+                        %(uri_end)s
                       )?
                       (                       # optional fragment
                         \#%(uric)s*
-                        %(urilast)s
+                        %(uri_end)s
                       )?
                     )
                   )
@@ -954,9 +959,7 @@
         else:                   # not a valid scheme
             raise MarkupMismatch
 
-    pep_url_local = 'pep-%04d.html'
-    pep_url_absolute = 'http://www.python.org/peps/pep-%04d.html'
-    pep_url = pep_url_absolute
+    pep_url = 'pep-%04d.html'
 
     def pep_reference(self, match, lineno):
         text = match.group(0)
@@ -966,17 +969,17 @@
             pepnum = int(match.group('pepnum2'))
         else:
             raise MarkupMismatch
-        ref = self.pep_url % pepnum
+        ref = self.document.settings.pep_base_url + self.pep_url % pepnum
         unescaped = unescape(text, 0)
         return [nodes.reference(unescape(text, 1), unescaped, refuri=ref)]
 
-    rfc_url = 'http://www.faqs.org/rfcs/rfc%d.html'
+    rfc_url = 'rfc%d.html'
 
     def rfc_reference(self, match, lineno):
         text = match.group(0)
         if text.startswith('RFC'):
             rfcnum = int(match.group('rfcnum'))
-            ref = self.rfc_url % rfcnum
+            ref = self.document.settings.rfc_base_url + self.rfc_url % rfcnum
         else:
             raise MarkupMismatch
         unescaped = unescape(text, 0)
@@ -2542,9 +2545,10 @@
             indented.trim_end()
         if not indented:
             return self.quoted_literal_block()
-        nodelist = []
         data = '\n'.join(indented)
-        nodelist.append(nodes.literal_block(data, data))
+        literal_block = nodes.literal_block(data, data)
+        literal_block.line = offset + 1
+        nodelist = [literal_block]
         if not blank_finish:
             nodelist.append(self.unindent_warning('Literal block'))
         return nodelist



More information about the Zope-Checkins mailing list