From 9ca78ac57fbebcedba27c0f4487d295527b1f367 Mon Sep 17 00:00:00 2001 From: Fred Drake Date: Fri, 22 Jun 2001 17:11:30 +0000 Subject: 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. --- Doc/tools/mkmodindex | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/Doc/tools/mkmodindex b/Doc/tools/mkmodindex index 5f2da0e..23a200e 100755 --- a/Doc/tools/mkmodindex +++ b/Doc/tools/mkmodindex @@ -49,26 +49,30 @@ class IndexOptions(support.Options): class Node(buildindex.Node): - annotation = "" - - def __init__(self, link, str, seqno): - parts = string.split(str, None, 1) - if parts[0][-5:] == "": - self.modname = parts[0][:-5] - else: - self.modname = parts[0] - if len(parts) == 2: - self.annotation = parts[1] + def __init__(self, link, str, seqno, platinfo): + self.annotation = platinfo or None + if str[0][-5:] == "": + str = str[:-5] + self.modname = str buildindex.Node.__init__(self, link, self.modname, seqno) + if platinfo: + s = '%s %s' \ + % (self.modname, self.annotation) + else: + s = '%s' % str + self.text = [s] def __str__(self): - return '%s %s' \ - % (self.modname, self.annotation) + if self.annotation: + return '%s %s' \ + % (self.modname, self.annotation) + else: + return '%s' % self.modname _rx = re.compile( - "
" - "([a-zA-Z_][a-zA-Z0-9_.]*(\s*" - "\(.*\))?)") + "
" + "([a-zA-Z_][a-zA-Z0-9_.]*)\s*(" + "\(.*\))?") def main(): options = IndexOptions() @@ -81,7 +85,6 @@ def main(): # Collect the input data: # nodes = [] - seqno = 0 has_plat_flag = 0 for ifn in args: if ifn == "-": @@ -97,11 +100,11 @@ def main(): m = _rx.match(line) if m: # This line specifies a module! - basename, modname = m.group(1, 2) - has_plat_flag = has_plat_flag or m.group(3) + 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('' % linkfile, modname, seqno)) - seqno = seqno + 1 + nodes.append(Node('' % linkfile, modname, + len(nodes), platinfo)) ifp.close() # # Generate all output: -- cgit v0.12