[Python-checkins] CVS: python/dist/src/Doc/tools mkmodindex,1.11,1.11.4.1

Fred L. Drake fdrake@users.sourceforge.net
Fri, 22 Jun 2001 10:17:04 -0700


Update of /cvsroot/python/python/dist/src/Doc/tools
In directory usw-pr-cvs1:/tmp/cvs-serv25830/tools

Modified Files:
      Tag: release21-maint
	mkmodindex 
Log Message:

Adjust to understand use of either single- or double-quotes to quote
attribute values, and make the logic surrounding the platform
annotations just a little easier to read.  Also make the platform
notes appear in the generated page; they were supposed to, but did not.


Index: mkmodindex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/tools/mkmodindex,v
retrieving revision 1.11
retrieving revision 1.11.4.1
diff -C2 -r1.11 -r1.11.4.1
*** mkmodindex	2001/02/12 19:12:55	1.11
--- mkmodindex	2001/06/22 17:17:02	1.11.4.1
***************
*** 50,73 ****
  
  class Node(buildindex.Node):
!     annotation = ""
! 
!     def __init__(self, link, str, seqno):
!         parts = string.split(str, None, 1)
!         if parts[0][-5:] == "</tt>":
!             self.modname = parts[0][:-5]
!         else:
!             self.modname = parts[0]
!         if len(parts) == 2:
!             self.annotation = parts[1]
          buildindex.Node.__init__(self, link, self.modname, seqno)
  
      def __str__(self):
!         return '<tt class="module">%s</tt> %s' \
!                % (self.modname, self.annotation)
  
  _rx = re.compile(
!     "<dt><a href='(module-.*\.html)#l2h-\d+'><tt class='module'>"
!     "([a-zA-Z_][a-zA-Z0-9_.]*</tt>(\s*<em>"
!     "\(<span class='platform'>.*</span>\)</em>)?)</a>")
  
  def main():
--- 50,77 ----
  
  class Node(buildindex.Node):
!     def __init__(self, link, str, seqno, platinfo):
!         self.annotation = platinfo or None
!         if str[0][-5:] == "</tt>":
!             str = str[:-5]
!         self.modname = str
          buildindex.Node.__init__(self, link, self.modname, seqno)
+         if platinfo:
+             s = '<tt class="module">%s</tt> %s' \
+                 % (self.modname, self.annotation)
+         else:
+             s = '<tt class="module">%s</tt>' % str
+         self.text = [s]
  
      def __str__(self):
!         if self.annotation:
!             return '<tt class="module">%s</tt> %s' \
!                    % (self.modname, self.annotation)
!         else:
!             return '<tt class="module">%s</tt>' % self.modname
  
  _rx = re.compile(
!     "<dt><a href=['\"](module-.*\.html)(?:#l2h-\d+)?['\"]>"
!     "<tt class=['\"]module['\"]>([a-zA-Z_][a-zA-Z0-9_.]*)</tt>\s*(<em>"
!     "\(<span class=['\"]platform['\"]>.*</span>\)</em>)?</a>")
  
  def main():
***************
*** 82,86 ****
      #
      nodes = []
-     seqno = 0
      has_plat_flag = 0
      for ifn in args:
--- 86,89 ----
***************
*** 98,106 ****
              if m:
                  # This line specifies a module!
!                 basename, modname = m.group(1, 2)
!                 has_plat_flag = has_plat_flag or m.group(3)
                  linkfile = os.path.join(dirname, basename)
!                 nodes.append(Node('<a href="%s">' % linkfile, modname, seqno))
!                 seqno = seqno + 1
          ifp.close()
      #
--- 101,109 ----
              if m:
                  # This line specifies a module!
!                 basename, modname, platinfo = m.group(1, 2, 3)
!                 has_plat_flag = has_plat_flag or platinfo
                  linkfile = os.path.join(dirname, basename)
!                 nodes.append(Node('<a href="%s">' % linkfile, modname,
!                                   len(nodes), platinfo))
          ifp.close()
      #