diff --git a/www/makeweb.py b/www/makeweb.py index 7dc334e..de955b3 100755 --- a/www/makeweb.py +++ b/www/makeweb.py @@ -11,6 +11,12 @@ SKIP_FILES = [ 'layout.conf', '.svn', 'instrset.inc' ] # asciidoc command line ASCIIDOC = 'asciidoc --unsafe --conf-file=${srcdir}/layout.conf -a icons -o ${outfile} ${infile}' +# specialized ASCIIDOC for certain files +# - this is a hack trying to look generic +ASCIIDOC_PERFILE = { + 'userguide.txt': ASCIIDOC.replace('-a icons', '-a icons -a toc') +} + def _is_older(inp, outp): older = True @@ -29,7 +35,8 @@ def asciidoc(opts, srcdir, inp, outp): if _is_older(inp, outp) or opts.force: if opts.verbose: print "asciidoc %s -> %s" % (inp, outp) - cmd = Template(ASCIIDOC).substitute(srcdir=srcdir, infile=inp, outfile=outp) + asciidoc = ASCIIDOC_PERFILE.get(os.path.split(inp)[-1], ASCIIDOC) + cmd = Template(asciidoc).substitute(srcdir=srcdir, infile=inp, outfile=outp) if opts.verbose >= 3: print "asciidoc command is [%s]" % cmd if not opts.dryrun: diff --git a/www/src/contribute.txt b/www/src/contribute.txt index 01cbe9b..886d0b4 100644 --- a/www/src/contribute.txt +++ b/www/src/contribute.txt @@ -5,7 +5,7 @@ llvm-py is just hatching. It needs your patches and suggestions to grow up. Please contribute! All patches are welcome. Here are some links to start hacking away: -`40`60~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +`75`25~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Google code hosting, http://code.google.com/p/llvm-py/[http://code.google.com/p/llvm-py/] Browse SVN, http://code.google.com/p/llvm-py/source/browse/[http://code.google.com/p/llvm-py/source/browse] Issues tracker, http://code.google.com/p/llvm-py/issues/list[http://code.google.com/p/llvm-py/issues/list] @@ -24,6 +24,7 @@ Current Next Steps ------------------ - Wrap GenericValue, function call args for execution engine. + * done. - Add APIs to read/write `.bc` and `.ll` files. - Wrap `lto`. - Add examples. diff --git a/www/src/js/toc.js b/www/src/js/toc.js new file mode 100644 index 0000000..a8437ba --- /dev/null +++ b/www/src/js/toc.js @@ -0,0 +1,67 @@ +/* Author: Mihai Bazon, September 2002 + * http://students.infoiasi.ro/~mishoo + * + * Table Of Content generator + * Version: 0.4 + * + * Feel free to use this script under the terms of the GNU General Public + * License, as long as you do not remove or alter this notice. + */ + + /* modified by Troy D. Hanson, September 2006. License: GPL */ + /* modified by Stuart Rackham, October 2006. License: GPL */ + +function getText(el) { + var text = ""; + for (var i = el.firstChild; i != null; i = i.nextSibling) { + if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants. + text += i.data; + else if (i.firstChild != null) + text += getText(i); + } + return text; +} + +function TocEntry(el, text, toclevel) { + this.element = el; + this.text = text; + this.toclevel = toclevel; +} + +function tocEntries(el, toclevels) { + var result = new Array; + var re = new RegExp('[hH]([2-'+(toclevels+1)+'])'); + // Function that scans the DOM tree for header elements (the DOM2 + // nodeIterator API would be a better technique but not supported by all + // browsers). + var iterate = function (el) { + for (var i = el.firstChild; i != null; i = i.nextSibling) { + if (i.nodeType == 1 /* Node.ELEMENT_NODE */) { + var mo = re.exec(i.tagName) + if (mo) + result[result.length] = new TocEntry(i, getText(i), mo[1]-1); + iterate(i); + } + } + } + iterate(el); + return result; +} + +// This function does the work. toclevels = 1..4. +function generateToc(toclevels) { + var toc = document.getElementById("toc"); + var entries = tocEntries(document.getElementsByTagName("body")[0], toclevels); + for (var i = 0; i < entries.length; ++i) { + var entry = entries[i]; + if (entry.element.id == "") + entry.element.id = "toc" + i; + var a = document.createElement("a"); + a.href = "#" + entry.element.id; + a.appendChild(document.createTextNode(entry.text)); + var div = document.createElement("div"); + div.appendChild(a); + div.className = "toclevel" + entry.toclevel; + toc.appendChild(div); + } +} diff --git a/www/src/layout.conf b/www/src/layout.conf index ec0f087..768f832 100644 --- a/www/src/layout.conf +++ b/www/src/layout.conf @@ -41,6 +41,14 @@ monospacedwords=(?u)\\?\basciidoc\(1\) (?u)\\?\ba2x\(1\) +ifdef::toc[] + + +endif::toc[] {doctitle} - llvm-py @@ -58,14 +66,18 @@ monospacedwords=(?u)\\?\basciidoc\(1\) (?u)\\?\ba2x\(1\)
»Contribute
»License
»About
-
»Python
-
»LLVM
+ifdef::toc[] +
+
Table of Contents
+ +
+endif::toc[] [footer]