changeset 149:16f02802f448

Start to produce saner HTML and CSS. Drop the "beta" targets for now (forever?).
author Bryan O'Sullivan <bos@serpentine.com>
date Thu, 08 Mar 2007 22:51:50 -0800
parents 6a5864c09879
children 8cf40d4d9377
files en/Makefile en/bookhtml.cfg en/fixhtml.py en/hgbook.css
diffstat 4 files changed, 501 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/en/Makefile	Tue Mar 06 22:00:38 2007 -0800
+++ b/en/Makefile	Thu Mar 08 22:51:50 2007 -0800
@@ -28,6 +28,7 @@
 	kdiff3.png \
 	metadata.svg \
 	mq-stack.svg \
+	note.png \
 	revlog.svg \
 	snapshot.svg \
 	tour-history.svg \
@@ -99,7 +100,11 @@
 pdf/hgbook.pdf: $(sources) $(image-pdf) examples
 	$(call pdf)
 
-html: html/onepage/hgbook.html html/split/hgbook.html
+html: onepage split
+
+onepage: html/onepage/hgbook.html
+
+split: html/split/hgbook.html
 
 # This is a horrible hack to work around the fact that the htlatex
 # command in tex4ht is itself a horrible hack.  I really don't want to
@@ -115,37 +120,23 @@
 	head -3 $(shell which htlatex) >> $(dir $(1))/htlatex.book
 	echo 'echo status $$$$' >>  $(dir $(1))/htlatex.book
 	chmod 755 $(dir $(1))/htlatex.book
-	TEXINPUTS=$(dir $(2)): $(dir $(1))/htlatex.book $(2) "xhtml,html4-uni,$(3)" " -cunihtf -utf8" "" "$(call latex-options,$(1))" || (rm -f $(1); exit 1)
+	TEXINPUTS=$(dir $(2)): $(dir $(1))/htlatex.book $(2) "bookhtml,html4-uni,$(3)" " -cunihtf -utf8" "" "$(call latex-options,$(1))" || (rm -f $(1); exit 1)
 	cd $(dir $(1)) && tex4ht -f/$(basename $(notdir $(1))) -cvalidate -cunihtf
 	cd $(dir $(1)) && t4ht -f/$(basename $(notdir $(1)))
-	perl -pi -e 's/&#x00([0-7][0-9a-f]);/chr(hex($$1))/egi' $(dir $(1))/*.html
+	./fixhtml.py $(dir $(1))/*.html
 endef
 
 image-html := $(image-dot:%.dot=%.png) $(image-svg:%.svg=%.png) $(image-png)
 
-html/onepage/hgbook.html: $(sources) $(image-html) examples
+html/onepage/hgbook.html: $(sources) $(image-html) examples hgbook.css bookhtml.cfg
 	$(call htlatex,$@,$<)
 	cp $(image-sources:%.svg=%.png) $(dir $@)
+	cp hgbook.css $(dir $@)
 
-html/split/hgbook.html: $(sources) $(image-html) examples
+html/split/hgbook.html: $(sources) $(image-html) examples hgbook.css bookhtml.cfg
 	$(call htlatex,$@,$<,2)
 	cp $(image-sources:%.svg=%.png) $(dir $@)
-
-beta: beta/pdf/hgbook.pdf beta/html/onepage/hgbook.html beta/html/split/hgbook.html
-
-beta/%.tex: %.tex
-	./fblinks $(hg_id) $(dir $@) $<
-
-beta/pdf/hgbook.pdf: $(sources:%.tex=beta/%.tex) $(image-sources:%.svg=%.pdf) examples fblinks
-	$(call pdf)
-
-beta/html/onepage/hgbook.html: $(sources:%.tex=beta/%.tex) $(image-sources:%.svg=%.png) examples
-	$(call htlatex,$@,$<)
-	cp $(image-sources:%.svg=%.png) $(dir $@)
-
-beta/html/split/hgbook.html: $(sources:%.tex=beta/%.tex) $(image-sources:%.svg=%.png) examples
-	$(call htlatex,$@,$<,2)
-	cp $(image-sources:%.svg=%.png) $(dir $@)
+	cp hgbook.css $(dir $@)
 
 # Produce 90dpi PNGs for the web.
 
@@ -178,7 +169,7 @@
 	echo -n $(hg_id) > build_id.tex
 
 clean:
-	rm -rf beta html pdf \
+	rm -rf html pdf \
 		$(image-dot:%.dot=%.pdf) \
 		$(image-dot:%.dot=%.png) \
 		$(image-svg:%.svg=%.pdf) \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/en/bookhtml.cfg	Thu Mar 08 22:51:50 2007 -0800
@@ -0,0 +1,14 @@
+% -*- latex -*-
+
+\Preamble{xhtml}
+
+\ConfigureList{itemize}%  
+   {\EndP\HCode{<dl>}\let\endItem=\empty}  
+   {\ifvmode \IgnorePar\fi  
+    \EndP\HCode{</dd></dl>}\ShowPar}  
+   {\endItem \def\endItem{\EndP\Tg</dd>}\HCode{<dt>}}  
+   {\HCode{</dt><dd>}}
+
+\begin{document}
+
+\EndPreamble
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/en/fixhtml.py	Thu Mar 08 22:51:50 2007 -0800
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+
+import os
+import sys
+import re
+
+unicode_re = re.compile(r'&#x00([0-7][0-9a-f]);', re.I)
+fancyvrb_re = re.compile(r'id="fancyvrb\d+"', re.I)
+
+tmpsuffix = '.tmp.' + str(os.getpid())
+
+def fix_ascii(m):
+    return chr(int(m.group(1), 16))
+
+for name in sys.argv[1:]:
+    tmpname = name + tmpsuffix
+    ofp = file(tmpname, 'w')
+    for line in file(name):
+        line = unicode_re.sub(fix_ascii, line)
+        line = fancyvrb_re.sub('id="fancyvrb"', line)
+        ofp.write(line)
+    ofp.close()
+    os.rename(tmpname, name)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/en/hgbook.css	Thu Mar 08 22:51:50 2007 -0800
@@ -0,0 +1,451 @@
+body {
+  font: 12px/1.5 Verdana, sans-serif;
+  padding-top: 50px;
+  padding-left: 80px;
+  padding-right: 80px;
+  padding-bottom: 90px;
+}
+.ptmr7t- {
+  font-family: monospace;
+}
+.ptmr7t-x-x-172 {
+  font-size: 172%;
+  font-family: monospace;
+}
+.ptmr7t-x-x-172 {
+  font-family: monospace;
+}
+.ptmr7t-x-x-120 {
+  font-size: 120%;
+  font-family: monospace;
+}
+.ptmr7t-x-x-120 {
+  font-family: monospace;
+}
+.zpzccmry-x-x-120 {
+  font-size: 120%;
+  font-weight: bold;
+  font-style: italic;
+}
+.zpzccmry-x-x-120 {
+  font-weight: bold;
+  font-style: italic;
+}
+.pcrr7tn- {
+  font-family: monospace;
+}
+.ptmri7t- {
+  font-style: italic;
+}
+.ptmr7t-x-x-50 {
+  font-size: 50%;
+  font-family: monospace;
+}
+.ptmr7t-x-x-50 {
+  font-family: monospace;
+}
+.ptmb7t- {
+  font-weight: bold;
+}
+.zptmcmr- {
+  font-style: italic;
+}
+.zptmcmrm- {
+  font-style: italic;
+}
+.zpzccmry- {
+  font-weight: bold;
+  font-style: italic;
+}
+.pcrb7t- {
+  font-family: monospace;
+  font-weight: bold;
+}
+.pcrro7t- {
+  font-family: monospace;
+  font-style: oblique;
+}
+p.noindent {
+  text-indent: 0em;
+  margin: 0em;
+}
+p.nopar {
+  text-indent: 0em;
+}
+p.indent {
+  text-indent: 1.5em;
+  margin: 0em;
+}
+a img {
+  border-top: 0;
+  border-left: 0;
+  border-right: 0;
+}
+center {
+  margin-top: 1em;
+  margin-bottom: 1em;
+}
+td center {
+  margin-top: 0em;
+  margin-bottom: 0em;
+}
+.Canvas {
+  position: relative;
+}
+img.math {
+  vertical-align: middle;
+}
+li p.indent {
+  text-indent: 0em;
+}
+.enumerate1 {
+  list-style-type: decimal;
+}
+.enumerate2 {
+  list-style-type: lower-alpha;
+}
+.enumerate3 {
+  list-style-type: lower-roman;
+}
+.enumerate4 {
+  list-style-type: upper-alpha;
+}
+div.newtheorem {
+  margin-bottom: 2em;
+  margin-top: 2em;
+}
+.obeylines-h,.obeylines-v {
+  white-space: nowrap;
+}
+div.obeylines-v p {
+  margin-top: 0;
+  margin-bottom: 0;
+}
+.overline {
+  text-decoration: overline;
+}
+.overline img {
+  border-top: 1px solid black;
+}
+td.displaylines {
+  text-align: center;
+  white-space: nowrap;
+}
+.centerline {
+  text-align: center;
+}
+.rightline {
+  text-align: right;
+}
+div.verbatim {
+  font-family: monospace;
+  white-space: nowrap;
+}
+table.verbatim {
+  width: 100%;
+}
+.fbox {
+  background: url(note.png) no-repeat #cec;
+  padding-left: 58px;
+  padding-top: 1em;
+  padding-bottom: 1em;
+  padding-right: 1em;
+  text-indent: 0pt;
+  border: dotted black 1px;
+}
+div.center div.fbox {
+  text-align: center;
+  clear: both;
+  padding-left: 3.0pt;
+  padding-right: 3.0pt;
+  text-indent: 0pt;
+  border: solid black 0.4pt;
+}
+table.minipage {
+  width: 100%;
+}
+div.center, div.center div.center {
+  text-align: center;
+  margin-left: 1em;
+  margin-right: 1em;
+}
+div.center div {
+  text-align: left;
+}
+div.flushright, div.flushright div.flushright {
+  text-align: right;
+}
+div.flushright div {
+  text-align: left;
+}
+div.flushleft {
+  text-align: left;
+}
+.underline {
+  text-decoration: underline;
+}
+.underline img {
+  border-bottom: 1px solid black;
+  margin-bottom: 1pt;
+}
+.framebox-c, .framebox-l, .framebox-r {
+  padding-left: 3.0pt;
+  padding-right: 3.0pt;
+  text-indent: 0pt;
+  border: solid black 0.4pt;
+}
+.framebox-c {
+  text-align: center;
+}
+.framebox-l {
+  text-align: left;
+}
+.framebox-r {
+  text-align: right;
+}
+span.thank-mark {
+  vertical-align: super
+}
+span.footnote-mark sup.textsuperscript, span.footnote-mark a sup.textsuperscript {
+  font-size: 80%;
+}
+div.tabular, div.center div.tabular {
+  text-align: center;
+  margin-top: 0.5em;
+  margin-bottom: 0.5em;
+}
+table.tabular td p {
+  margin-top: 0em;
+}
+table.tabular {
+  margin-left: auto;
+  margin-right: auto;
+}
+div.td00 {
+  margin-left: 0pt;
+  margin-right: 0pt;
+}
+div.td01 {
+  margin-left: 0pt;
+  margin-right: 5pt;
+}
+div.td10 {
+  margin-left: 5pt;
+  margin-right: 0pt;
+}
+div.td11 {
+  margin-left: 5pt;
+  margin-right: 5pt;
+}
+table[rules] {
+  border-left: solid black 0.4pt;
+  border-right: solid black 0.4pt;
+}
+td.td00 {
+  padding-left: 0pt;
+  padding-right: 0pt;
+}
+td.td01 {
+  padding-left: 0pt;
+  padding-right: 5pt;
+}
+td.td10 {
+  padding-left: 5pt;
+  padding-right: 0pt;
+}
+td.td11 {
+  padding-left: 5pt;
+  padding-right: 5pt;
+}
+table[rules] {
+  border-left: solid black 0.4pt;
+  border-right: solid black 0.4pt;
+}
+.hline hr, .cline hr {
+  height : 1px;
+  margin: 0px;
+}
+.tabbing-right {
+  text-align: right;
+}
+span.TEX {
+  letter-spacing: -0.125em;
+}
+span.TEX span.E {
+  position: relative;top: 0.5ex;left: -0.0417em;
+}
+a span.TEX span.E {
+  text-decoration: none;
+}
+span.LATEX span.A {
+  position: relative;
+  top: -0.5ex;
+  left: -0.4em;
+  font-size: 85%;
+}
+span.LATEX span.TEX {
+  position: relative;
+  left: -0.4em;
+}
+div.float img, div.float .caption {
+  text-align: center;
+}
+div.figure img, div.figure .caption {
+  text-align: center;
+}
+.marginpar {
+  width: 20%;
+  float: right;
+  text-align: left;
+  margin-left: auto;
+  margin-top: 0.5em;
+  font-size: 85%;
+  text-decoration: underline;
+}
+.marginpar p {
+  margin-top: 0.4em;
+  margin-bottom: 0.4em;
+}
+table.equation {
+  width: 100%;
+}
+.equation td {
+  text-align: center;
+}
+td.equation {
+  margin-top: 1em;
+  margin-bottom: 1em;
+} 
+td.equation-label {
+  width: 5%;
+  text-align: center;
+}
+td.eqnarray4 {
+  width: 5%;
+  white-space: normal;
+}
+td.eqnarray2 {
+  width: 5%;
+}
+table.eqnarray-star, table.eqnarray {
+  width: 100%;
+}
+div.eqnarray {
+  text-align: center;
+}
+div.array {
+  text-align: center;
+}
+div.pmatrix {
+  text-align: center;
+}
+table.pmatrix {
+  width: 100%;
+}
+span.pmatrix img {
+  vertical-align: middle;
+}
+div.pmatrix {
+  text-align: center;
+}
+table.pmatrix {
+  width: 100%;
+}
+img.cdots {
+  vertical-align: middle;
+}
+.partToc a, .partToc, .likepartToc a, .likepartToc {
+  line-height: 200%;
+  font-weight: bold;
+  font-size: 110%;
+}
+.chapterToc a, .chapterToc, .likechapterToc a, .likechapterToc, .appendixToc a, .appendixToc {
+  line-height: 200%;
+  font-weight: bold;
+}
+.caption td.id {
+  font-weight: bold;
+  white-space: nowrap;
+}
+table.caption {
+  text-align: center;
+}
+h1.partHead {
+  text-align: center;
+}
+p.bibitem {
+  text-indent: -2em;
+  margin-left: 2em;
+  margin-top: 0.6em;
+  margin-bottom: 0.6em;
+}
+p.bibitem-p {
+  text-indent: 0em;
+  margin-left: 2em;
+  margin-top: 0.6em;
+  margin-bottom: 0.6em;
+}
+.paragraphHead, .likeparagraphHead {
+  margin-top: 2em;
+  font-weight: bold;
+}
+.subparagraphHead, .likesubparagraphHead {
+  font-weight: bold;
+}
+.quote {
+  margin-bottom: 0.25em;
+  margin-top: 0.25em;
+  margin-left: 1em;
+  margin-right: 1em;
+  text-align: justify;
+}
+.verse {
+  white-space: nowrap;
+  margin-left: 2em}
+div.maketitle {
+  text-align: center;
+}
+h2.titleHead {
+  text-align: center;
+}
+div.maketitle {
+  margin-bottom: 2em;
+}
+div.author, div.date {
+  text-align: center;
+}
+div.thanks {
+  text-align: left;
+  margin-left: 10%;
+  font-size: 85%;
+  font-style: italic;
+}
+div.author {
+  white-space: nowrap;
+}
+.quotation {
+  margin-bottom: 0.25em;
+  margin-top: 0.25em;
+  margin-left: 1em;
+}
+h1.partHead {
+  text-align: center;
+}
+img.graphics {
+  margin-left: 10%;
+}
+.figure {
+  width: 100%;
+}
+P.fancyvrb {
+  white-space: nowrap;
+}
+hr {
+  border: 0;
+  height: 1px;
+}
+div#fancyvrb {
+  white-space: nowrap;
+  background: #eee;
+  padding: 1em;
+}