changelog shortlog tags files raw bz2 zip gz

changeset: Add -s (strip base url) and -t (set title) options.

changeset 106: 88f40fbf8e8b
parent 105:c27b8c8a1b14
child 107:dde34eaf03ed
author: Rob Landley <rob@landley.net>
date: Sun Dec 12 16:48:45 2010 -0600 (17 months ago)
files: make/indexsections.py
description: Add -s (strip base url) and -t (set title) options.
       1--- a/make/indexsections.py	Sun Dec 12 16:47:22 2010 -0600
       2+++ b/make/indexsections.py	Sun Dec 12 16:48:45 2010 -0600
       3@@ -32,7 +32,9 @@
       4     # This recurses to call this function again, printing out different data.
       5 
       6     if tag[0] == "put_index_here":
       7-      if not idx: process(data, 1)
       8+      if not idx:
       9+        if title: print title
      10+        process(data, 1)
      11       continue
      12 
      13     # Parse one of our magic "span" tags describing a section.
      14@@ -44,7 +46,11 @@
      15       tag = tag[1][3:]
      16       if tag[0]=='"' and tag[-1]=='"': tag=tag[1:-1]
      17       if debug: sys.stderr.write("tag %s\n" % tag)
      18-      spans.append("_".join(tag.split()))
      19+
      20+      temp = "_".join(tag.split())
      21+      temp = "_".join(temp.split("/"))
      22+      temp = "".join(temp.split("?"))
      23+      spans.append(temp)
      24       secnum[-1] += 1
      25       secstr = ".".join(map(lambda a: str(a), secnum))
      26 
      27@@ -82,13 +88,23 @@
      28   if idx: adjust_depth(0, depth)
      29 
      30 baseurl=None
      31-if len(sys.argv) == 4 and sys.argv[1] == '-b':
      32-  del sys.argv[1]
      33-  baseurl=sys.argv[1]
      34-  del sys.argv[1]
      35+title=None
      36+while len(sys.argv) > 2 and sys.argv[1][0]=='-':
      37+  if sys.argv[1] == '-b':
      38+    del sys.argv[1]
      39+    baseurl=sys.argv[1]
      40+    del sys.argv[1]
      41+  elif sys.argv[1] == '-s':
      42+    del sys.argv[1]
      43+    baseurl = 1
      44+  elif sys.argv[1] == '-t':
      45+    del sys.argv[1]
      46+    title = sys.argv[1]
      47+    del sys.argv[1]
      48+  else: break
      49 
      50 if len(sys.argv) != 2:
      51-  sys.stderr.write("Usage: indexsections.py [-b http://baseurl] filename\n");
      52+  sys.stderr.write("Usage: indexsections.py [-s] [-b http://baseurl] filename\n");
      53   sys.exit(1)
      54 
      55 process(open(sys.argv[1]).read().split("<"), baseurl)