# HG changeset patch # User Bryan O'Sullivan # Date 1238139675 25200 # Node ID 9e8e5292acaae158e2a5019fbee018e804aae452 # Parent 7893b382471518d748727acb7ffdb3af5dced8c0 Generate a nice readable index. diff -r 7893b3824715 -r 9e8e5292acaa .hgignore --- a/.hgignore Fri Mar 27 00:01:58 2009 -0700 +++ b/.hgignore Fri Mar 27 00:41:15 2009 -0700 @@ -18,4 +18,5 @@ en/all-ids.dat web/hgbook/.database.sqlite3 web/hgbook/secrets.py +web/index-read.html.in xsl/system-xsl diff -r 7893b3824715 -r 9e8e5292acaa en/Makefile --- a/en/Makefile Fri Mar 27 00:01:58 2009 -0700 +++ b/en/Makefile Fri Mar 27 00:41:15 2009 -0700 @@ -119,8 +119,12 @@ html: $(obj-web-read)/index.html -$(obj-web-read)/index.html: ../xsl/system-xsl .validated-00book.xml +../web/index-read.html.in: ../web/genindex.py $(xml-src-files) + $< + +$(obj-web-read)/index.html: ../xsl/system-xsl .validated-00book.xml ../web/index-read.html.in xsltproc $(xsltproc-opts) -o $(obj-web-read)/x ../xsl/chunk-stylesheet.xsl 00book.xml + python ../web/texpand.py ../web/index-read.html.in html/read/index.html for i in $(obj-web-read)/*.html; do \ gzip -9 -c $$i > $$i.gz; \ done diff -r 7893b3824715 -r 9e8e5292acaa web/genindex.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/genindex.py Fri Mar 27 00:41:15 2009 -0700 @@ -0,0 +1,60 @@ +#!/usr/bin/env python + +import glob, os, re + +chapter_re = re.compile(r'<(chapter|appendix|preface)\s+id="([^"]+)">') +filename_re = re.compile(r'<\?dbhtml filename="([^"]+)"\?>') +title_re = re.compile(r'(.*)') + +chapters = glob.glob('../en/ch*.xml') + glob.glob('../en/app*.xml') + +fp = open('index-read.html.in', 'w') + +print >> fp, ''' +{% extends "boilerplate.html" %} +{% block bodycontent %} + +
+{% endblock %}''' + +fp.close() diff -r 7893b3824715 -r 9e8e5292acaa web/index.html.in --- a/web/index.html.in Fri Mar 27 00:01:58 2009 -0700 +++ b/web/index.html.in Fri Mar 27 00:41:15 2009 -0700 @@ -2,8 +2,7 @@ {% extends "boilerplate.html" %} {% block bodycontent %} - +

Welcome to Mercurial: The Definitive Guide

@@ -31,7 +30,7 @@

(If you would like to adapt the comment system for a publishing project of your own, the source for the web application - is included with the book.)

+ is included with the book source at the link above.)

What is Mercurial?