Mercurial > hg > kdocs
changeset 47:0df6348fc276
Teach indexsections to output index and contents in one pass, and put index
in an arbitrary location within the file (governed by <put_index_here> tag).
Update master.idx to use this, move introductory material to the top,
and reshuffle sections. Teach make.sh new calling convention for master.idx.
author | Rob Landley <rob@landley.net> |
---|---|
date | Tue, 25 Sep 2007 23:35:21 -0500 |
parents | 22a68f175e66 |
children | b1823444cf59 |
files | make/indexsections.py make/make.sh master.idx |
diffstat | 3 files changed, 106 insertions(+), 76 deletions(-) [+] |
line wrap: on
line diff
--- a/make/indexsections.py Mon Sep 24 05:50:40 2007 -0500 +++ b/make/indexsections.py Tue Sep 25 23:35:21 2007 -0500 @@ -2,20 +2,8 @@ import os,sys -args = sys.argv[1:] -spans = [] -secnum = [0] -depth = 0 - -if args[0] == '-i': args = args[1:] -if not len(args) != 3: - sys.stderr.write("Usage: indexsections.py [-i] filename\n"); - sys.exit(1) - -data = open(args[0]).read().split("<") - -def adjust_depth(newdepth): - global depth +# Print appropriate number of <ul> or </ul> tags, with indentation. +def adjust_depth(newdepth, depth): while newdepth > depth: sys.stdout.write("%s<ul>\n" % (" "*depth)) depth += 1 @@ -23,32 +11,46 @@ sys.stdout.write("%s</ul>\n" % (" "*depth)) depth -= 1 -line = data[0].count("\n") -if sys.argv[1] != "-i": sys.stdout.write(data[0]) -for i in data[1:]: - i = i.split(">",1) - tag = i[0].split(None,1) - if tag[0] == "span": - if len(tag) == 0 or not tag[1].startswith("id="): - sys.stderr.write("Bad span at line %s: %s" % (line,i[0])) - sys.exit(1) - tag = tag[1][3:] - if tag[0]=='"' and tag[-1]=='"': tag=tag[1:-1] - spans.append("_".join(tag.split())) - secnum[-1] += 1 - secstr = ".".join(map(lambda a: str(a), secnum)) - if sys.argv[1] == "-i": - adjust_depth(len(spans)) - sys.stdout.write('%s<li><a href="#%s">%s %s</a></li>\n' % (" "*len(spans),spans[-1],secstr,tag)) +def process(data, idx): + line = data[0].count("\n") + depth = 0 + spans = [] + secnum = [0] + + if not idx: sys.stdout.write(data[0]) + for i in data[1:]: + i = i.split(">",1) + tag = i[0].split(None,1) + if tag[0] == "put_index_here": + if not idx: process(data, 1) + continue + if tag[0] == "span": + if len(tag) == 0 or not tag[1].startswith("id="): + sys.stderr.write("Bad span at line %s: %s" % (line,i[0])) + sys.exit(1) + tag = tag[1][3:] + if tag[0]=='"' and tag[-1]=='"': tag=tag[1:-1] + spans.append("_".join(tag.split())) + secnum[-1] += 1 + secstr = ".".join(map(lambda a: str(a), secnum)) + if idx: + adjust_depth(len(spans), depth) + depth = len(spans) + sys.stdout.write('%s<li><a href="#%s">%s %s</a></li>\n' % (" "*len(spans),spans[-1],secstr,tag)) + else: + sys.stdout.write('<h2><a name="%s">%s %s</a></h2>\n' % (spans[-1],secstr,tag)) + sys.stdout.write('<%s>%s' % (i[0], i[1])) + secnum.append(0) + elif tag[0] == "/span": + spans.pop() + secnum.pop() else: - sys.stdout.write('<h2><a name="%s">%s %s</a></h2>\n' % (spans[-1],secstr,tag)) - sys.stdout.write('<%s>%s' % (i[0], i[1])) - secnum.append(0) - elif tag[0] == "/span": - spans.pop() - secnum.pop() - else: - if sys.argv[1] != '-i': sys.stdout.write('<%s>%s' % (i[0], i[1])); - line += i[1].count("\n") + if not idx: sys.stdout.write('<%s>%s' % (i[0], i[1])); + line += i[1].count("\n") + if idx: adjust_depth(0, depth) -if sys.argv[1] == "-i": adjust_depth(0) +if len(sys.argv) != 2: + sys.stderr.write("Usage: indexsections.py filename\n"); + sys.exit(1) + +process(open(sys.argv[1]).read().split("<"), 0)
--- a/make/make.sh Mon Sep 24 05:50:40 2007 -0500 +++ b/make/make.sh Tue Sep 25 23:35:21 2007 -0500 @@ -7,10 +7,7 @@ echo "Update master index." -( $WEBDIR/make/indexsections.py -i $WEBDIR/master.idx && - echo "<hr>" && - $WEBDIR/make/indexsections.py $WEBDIR/master.idx -) > $WEBDIR/master.html || exit 1 +$WEBDIR/make/indexsections.py $WEBDIR/master.idx > $WEBDIR/master.html || exit 1 echo "Update Linux kernel from kernel.org"
--- a/master.idx Mon Sep 24 05:50:40 2007 -0500 +++ b/master.idx Tue Sep 25 23:35:21 2007 -0500 @@ -1,4 +1,27 @@ +<html> <title>Linux Kernel Documentation</title> +<body> + +<h2>Linux Kernel Documentation Index</h2> + +<p>This page collects and organizes documentation about the Linux kernel, taken +from many different sources. What is the kernel, how do you build it, how do +you use it, how do you change it...</p> + +<p>This is a work in progress, and probably always will be. Please let us know +on the +<a href=http://vger.kernel.org/vger-lists.html#linux-doc>linux-doc</a> mailing +list (on vger.kernel.org) about any documentation you'd like added to this +index, and feel free to ask about any topics that aren't covered here yet. +This index is maintained by Rob Landley <rob@landley.net>, and tracked in +<a href=http://landley.net/hg/kdocs>this mercurial repostiory</a>. The +cannonical location for the page is <a href=http://kernel.org/doc>here</a>.</p> + +<hr> + +<put_index_here> + +<hr> <span id="Sources of documentation"> @@ -39,16 +62,6 @@ </ul> </span id="Translations"> -<span id="About this index"> - -<p>The Linux kernel documentation index is maintained by Rob Landley -<rob@landley.net>, tracked in <a href=http://landley.net/hg/kdocs>this -mercurial repostiory</a>, and discussed on the -<a href=http://vger.kernel.org/vger-lists.html#linux-doc>linux-doc</a> mailing -list on vger.kernel.org. The cannonical location of the page is -<a href=http://kernel.org/doc>here</a>.</p> -</span id="About this index"> - </span id="Sources of documentation"> <span id="Building from source"> @@ -82,6 +95,31 @@ </span> </span> +<span id="Installing and using the kernel"> + <span id="Installing"> + <span id="Kernel image"> + </span> + <span id="Bootloader"> + </span> + </span> + <span id="A working Linux root filesystem"> + <span id="Finding and mounting /"> + <span id="initramfs, switch_root vs pivot_root, /dev/console"> + </span> + </span> + <span id="init program and PID 1"> + <span id="What does daemonizing really mean?"> + </span> + </span> + <span id="C library, Dynamic loader"> + </span> + <span id="FHS directories"> + <p>FHS spec</p> + <a href="pending/hotplug.txt">populating /dev from sysfs</a>. + </span> + </span> +</span> + <span id="Reading the source code"> <span id="Source code layout"> <span id="Following the boot process"> @@ -110,7 +148,13 @@ </span> </span> <span id="memory management"> - <a href="gorman">Understanding the Linux Virtual Memory Manager</a>, by Mel Gorman. + <ul> + <li><a href="gorman">Understanding the Linux Virtual Memory Manager</a>, by Mel Gorman.</li> + <li><a href=http://lwn.net/Articles/250967/>What every programmer should know about memory</a> by Ulrich Drepper.</li> + <li>Ars technica ram guide, parts +<a href=http://arstechnica.com/paedia/r/ram_guide/ram_guide.part1-1.html>one</a> +<a href=http://arstechnica.com/paedia/r/ram_guide/ram_guide.part1-1.html>two</a> +<a href=http://arstechnica.com/paedia/r/ram_guide/ram_guide.part3-1.html>three</a></li> <span id="mmap, DMA"> </span> </span> @@ -253,26 +297,6 @@ </span> </span> -<span id="A working Linux root filesystem"> - <span id="Bootloader, kernel"> - </span> - <span id="finding root"> - <span id="initramfs, switch_root vs pivot_root, /dev/console"> - </span> - </span> - <span id="init program and PID 1"> - <span id="What does daemonizing really mean?"> - </span> - </span> - <span id="C library, Dynamic loader"> - </span> - <span id="FHS directories"> - <p>FHS spec</p> - <a href="pending/hotplug.txt">populating /dev from sysfs</a>. - </span> -</span> - -<span id="Submitting Patches"> </span> <span id="Following Linux development"> @@ -293,6 +317,13 @@ Stable API nonsense Why reiser4 not in. </pre> + </span id="community"> + <span id="Submitting Patches"> + </span> +</span> + <span id="Glossary"> </span> +</body> +</html>