[Python-checkins] CVS: python/dist/src/Doc/tools buildindex.py,1.10.4.1,1.10.4.2

Fred L. Drake fdrake@weyr.cnri.reston.va.us
Mon, 6 Mar 2000 12:00:57 -0500 (EST)


Update of /projects/cvsroot/python/dist/src/Doc/tools
In directory weyr:/home/fdrake/projects/python/Doc-152p2/tools
Modified Files:
 Tag: release152p1-patches
	buildindex.py 
Log Message:
When an entry with sub-entries is continued across columns, make sure
the entry name in the second column is marked as a continuation so the 
reader knows to look at the end of the preceeding column.
Index: buildindex.py
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Doc/tools/buildindex.py,v
retrieving revision 1.10.4.1
retrieving revision 1.10.4.2
diff -C2 -r1.10.4.1 -r1.10.4.2
*** buildindex.py	2000年03月03日 16:30:11	1.10.4.1
--- buildindex.py	2000年03月06日 17:00:55	1.10.4.2
***************
*** 1,5 ****
 #! /usr/bin/env python
 
! __version__ = '$Revision: 1.10.4.1 $'
 
 import os
--- 1,5 ----
 #! /usr/bin/env python
 
! __version__ = '$Revision: 1.10.4.2 $'
 
 import os
***************
*** 12,15 ****
--- 12,17 ----
 __rmjunk = re.compile("<#\d+#>")
 
+ continuation = 0
+ 
 def __init__(self, link, str, seqno):
 self.links = [link]
***************
*** 176,179 ****
--- 178,197 ----
 end = start + colheight
 cols.append(nodes[start:end])
+ #
+ # If items continue across columns, make sure they are marked
+ # as continuations so the user knows to look at the previous column.
+ #
+ for i in range(len(cols) - 1):
+ try:
+ prev = cols[i][-1]
+ next = cols[i + 1][0]
+ except IndexError:
+ return cols
+ else:
+ n = min(len(prev.key), len(next.key))
+ for j in range(n):
+ if prev.key[j] != next.key[j]:
+ break
+ next.continuation = j + 1
 return cols
 
***************
*** 205,210 ****
 term = node.text[i]
 level = level + 1
! append("\n<dt>%s\n<dd>\n%s<dl compact>"
! % (term, level * DL_LEVEL_INDENT))
 append("\n%s<dt>%s%s</a>"
 % (level * DL_LEVEL_INDENT, node.links[0], node.text[-1]))
--- 223,232 ----
 term = node.text[i]
 level = level + 1
! if node.continuation > i:
! extra = " (continued)"
! else:
! extra = ""
! append("\n<dt>%s%s\n<dd>\n%s<dl compact>"
! % (term, extra, level * DL_LEVEL_INDENT))
 append("\n%s<dt>%s%s</a>"
 % (level * DL_LEVEL_INDENT, node.links[0], node.text[-1]))

AltStyle によって変換されたページ (->オリジナル) /