[Doc-SIG] Patches to pythondoc 0.6

Konrad Hinsen hinsen@cnrs-orleans.fr
Mon, 28 Jun 1999 16:58:57 +0200


There were two bugs in pythondoc that I found sufficiently annoying
to warrant an exploration:

1) Markup in oneliners was not taken into account.

2) Markup for a single letter didn't work.

Here's the patch:

diff -r -c pythondoc-0.6/docregex.py pythondoc-0.6-fixed/docregex.py
*** pythondoc-0.6/docregex.py	Sat May  1 03:01:15 1999
--- pythondoc-0.6-fixed/docregex.py	Mon Jun 28 16:52:34 1999
***************
*** 37,47 ****
  
  # Strong:
  # format: "**strong text**"
! strong_regex=re.compile(startm + "\*\*(?P<text>[^ \t][^\n*]*[^ \t])\*\*" + endm, re.MULTILINE)
  
  # Emphasized:
  # format: "*emphasized*"
! emph_regex = re.compile(startm + "\*(?P<text>[^ \t][^\n*]*[^ \t])\*" + endm, re.MULTILINE)
  
  # Bullet:
  # format: "* bulleted list"
--- 37,47 ----
  
  # Strong:
  # format: "**strong text**"
! strong_regex=re.compile(startm + "\*\*(?P<text>[^ \t]([^\n*]*[^ \t])?)\*\*" + endm, re.MULTILINE)
  
  # Emphasized:
  # format: "*emphasized*"
! emph_regex = re.compile(startm + "\*(?P<text>[^ \t]([^\n*]*[^ \t])?)\*" + endm, re.MULTILINE)
  
  # Bullet:
  # format: "* bulleted list"
diff -r -c pythondoc-0.6/stdmarkup.py pythondoc-0.6-fixed/stdmarkup.py
*** pythondoc-0.6/stdmarkup.py	Sat May  1 03:09:09 1999
--- pythondoc-0.6-fixed/stdmarkup.py	Mon Jun 28 16:48:00 1999
***************
*** 97,103 ****
      def create_tree_Object(self, docobj):
          """Default implementation for generating doctrees."""
  	self.trace_msg("Creating tree for %s %s" % (docobj.tag(), docobj.name()), 2)
! 	oneliner, doc = docstring.split_doc(docobj.docstring())
          try:
              oneliner = eval("self.fix_oneliner_%s(oneliner)" % docobj.tag())
          except AttributeError:
--- 97,103 ----
      def create_tree_Object(self, docobj):
          """Default implementation for generating doctrees."""
  	self.trace_msg("Creating tree for %s %s" % (docobj.tag(), docobj.name()), 2)
!         oneliner, doc = docstring.split_doc(docobj.docstring())
          try:
              oneliner = eval("self.fix_oneliner_%s(oneliner)" % docobj.tag())
          except AttributeError:
***************
*** 107,113 ****
  
  	st = StructuredText.StructuredText(doc)
  	if oneliner:
! 	    self.__doctree.add_child(doctree.Oneliner(oneliner))
  
  	marker = doctree.DocNode('', 'Marker')
  	self.__doctree.add_child(marker)
--- 107,115 ----
  
  	st = StructuredText.StructuredText(doc)
  	if oneliner:
!             node = doctree.Oneliner('')
!             self._create_markup_node(oneliner, node)
! 	    self.__doctree.add_child(node)
  
  	marker = doctree.DocNode('', 'Marker')
  	self.__doctree.add_child(marker)

-- 
-------------------------------------------------------------------------------
Konrad Hinsen                            | E-Mail: hinsen@cnrs-orleans.fr
Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.55.69
Rue Charles Sadron                       | Fax:  +33-2.38.63.15.17
45071 Orleans Cedex 2                    | Deutsch/Esperanto/English/
France                                   | Nederlands/Francais
-------------------------------------------------------------------------------