hgbook
changeset 149:16f02802f448
Start to produce saner HTML and CSS.
Drop the "beta" targets for now (forever?).
Drop the "beta" targets for now (forever?).
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Thu Mar 08 22:51:50 2007 -0800 (2007-03-08) |
parents | 6a5864c09879 |
children | 8cf40d4d9377 |
files | en/Makefile en/bookhtml.cfg en/fixhtml.py en/hgbook.css |
line diff
1.1 --- a/en/Makefile Tue Mar 06 22:00:38 2007 -0800 1.2 +++ b/en/Makefile Thu Mar 08 22:51:50 2007 -0800 1.3 @@ -28,6 +28,7 @@ 1.4 kdiff3.png \ 1.5 metadata.svg \ 1.6 mq-stack.svg \ 1.7 + note.png \ 1.8 revlog.svg \ 1.9 snapshot.svg \ 1.10 tour-history.svg \ 1.11 @@ -99,7 +100,11 @@ 1.12 pdf/hgbook.pdf: $(sources) $(image-pdf) examples 1.13 $(call pdf) 1.14 1.15 -html: html/onepage/hgbook.html html/split/hgbook.html 1.16 +html: onepage split 1.17 + 1.18 +onepage: html/onepage/hgbook.html 1.19 + 1.20 +split: html/split/hgbook.html 1.21 1.22 # This is a horrible hack to work around the fact that the htlatex 1.23 # command in tex4ht is itself a horrible hack. I really don't want to 1.24 @@ -115,37 +120,23 @@ 1.25 head -3 $(shell which htlatex) >> $(dir $(1))/htlatex.book 1.26 echo 'echo status $$$$' >> $(dir $(1))/htlatex.book 1.27 chmod 755 $(dir $(1))/htlatex.book 1.28 - TEXINPUTS=$(dir $(2)): $(dir $(1))/htlatex.book $(2) "xhtml,html4-uni,$(3)" " -cunihtf -utf8" "" "$(call latex-options,$(1))" || (rm -f $(1); exit 1) 1.29 + TEXINPUTS=$(dir $(2)): $(dir $(1))/htlatex.book $(2) "bookhtml,html4-uni,$(3)" " -cunihtf -utf8" "" "$(call latex-options,$(1))" || (rm -f $(1); exit 1) 1.30 cd $(dir $(1)) && tex4ht -f/$(basename $(notdir $(1))) -cvalidate -cunihtf 1.31 cd $(dir $(1)) && t4ht -f/$(basename $(notdir $(1))) 1.32 - perl -pi -e 's/�([0-7][0-9a-f]);/chr(hex($$1))/egi' $(dir $(1))/*.html 1.33 + ./fixhtml.py $(dir $(1))/*.html 1.34 endef 1.35 1.36 image-html := $(image-dot:%.dot=%.png) $(image-svg:%.svg=%.png) $(image-png) 1.37 1.38 -html/onepage/hgbook.html: $(sources) $(image-html) examples 1.39 +html/onepage/hgbook.html: $(sources) $(image-html) examples hgbook.css bookhtml.cfg 1.40 $(call htlatex,$@,$<) 1.41 cp $(image-sources:%.svg=%.png) $(dir $@) 1.42 + cp hgbook.css $(dir $@) 1.43 1.44 -html/split/hgbook.html: $(sources) $(image-html) examples 1.45 +html/split/hgbook.html: $(sources) $(image-html) examples hgbook.css bookhtml.cfg 1.46 $(call htlatex,$@,$<,2) 1.47 cp $(image-sources:%.svg=%.png) $(dir $@) 1.48 - 1.49 -beta: beta/pdf/hgbook.pdf beta/html/onepage/hgbook.html beta/html/split/hgbook.html 1.50 - 1.51 -beta/%.tex: %.tex 1.52 - ./fblinks $(hg_id) $(dir $@) $< 1.53 - 1.54 -beta/pdf/hgbook.pdf: $(sources:%.tex=beta/%.tex) $(image-sources:%.svg=%.pdf) examples fblinks 1.55 - $(call pdf) 1.56 - 1.57 -beta/html/onepage/hgbook.html: $(sources:%.tex=beta/%.tex) $(image-sources:%.svg=%.png) examples 1.58 - $(call htlatex,$@,$<) 1.59 - cp $(image-sources:%.svg=%.png) $(dir $@) 1.60 - 1.61 -beta/html/split/hgbook.html: $(sources:%.tex=beta/%.tex) $(image-sources:%.svg=%.png) examples 1.62 - $(call htlatex,$@,$<,2) 1.63 - cp $(image-sources:%.svg=%.png) $(dir $@) 1.64 + cp hgbook.css $(dir $@) 1.65 1.66 # Produce 90dpi PNGs for the web. 1.67 1.68 @@ -178,7 +169,7 @@ 1.69 echo -n $(hg_id) > build_id.tex 1.70 1.71 clean: 1.72 - rm -rf beta html pdf \ 1.73 + rm -rf html pdf \ 1.74 $(image-dot:%.dot=%.pdf) \ 1.75 $(image-dot:%.dot=%.png) \ 1.76 $(image-svg:%.svg=%.pdf) \
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/en/bookhtml.cfg Thu Mar 08 22:51:50 2007 -0800 2.3 @@ -0,0 +1,14 @@ 2.4 +% -*- latex -*- 2.5 + 2.6 +\Preamble{xhtml} 2.7 + 2.8 +\ConfigureList{itemize}% 2.9 + {\EndP\HCode{<dl>}\let\endItem=\empty} 2.10 + {\ifvmode \IgnorePar\fi 2.11 + \EndP\HCode{</dd></dl>}\ShowPar} 2.12 + {\endItem \def\endItem{\EndP\Tg</dd>}\HCode{<dt>}} 2.13 + {\HCode{</dt><dd>}} 2.14 + 2.15 +\begin{document} 2.16 + 2.17 +\EndPreamble
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/en/fixhtml.py Thu Mar 08 22:51:50 2007 -0800 3.3 @@ -0,0 +1,23 @@ 3.4 +#!/usr/bin/env python 3.5 + 3.6 +import os 3.7 +import sys 3.8 +import re 3.9 + 3.10 +unicode_re = re.compile(r'�([0-7][0-9a-f]);', re.I) 3.11 +fancyvrb_re = re.compile(r'id="fancyvrb\d+"', re.I) 3.12 + 3.13 +tmpsuffix = '.tmp.' + str(os.getpid()) 3.14 + 3.15 +def fix_ascii(m): 3.16 + return chr(int(m.group(1), 16)) 3.17 + 3.18 +for name in sys.argv[1:]: 3.19 + tmpname = name + tmpsuffix 3.20 + ofp = file(tmpname, 'w') 3.21 + for line in file(name): 3.22 + line = unicode_re.sub(fix_ascii, line) 3.23 + line = fancyvrb_re.sub('id="fancyvrb"', line) 3.24 + ofp.write(line) 3.25 + ofp.close() 3.26 + os.rename(tmpname, name)
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/en/hgbook.css Thu Mar 08 22:51:50 2007 -0800 4.3 @@ -0,0 +1,451 @@ 4.4 +body { 4.5 + font: 12px/1.5 Verdana, sans-serif; 4.6 + padding-top: 50px; 4.7 + padding-left: 80px; 4.8 + padding-right: 80px; 4.9 + padding-bottom: 90px; 4.10 +} 4.11 +.ptmr7t- { 4.12 + font-family: monospace; 4.13 +} 4.14 +.ptmr7t-x-x-172 { 4.15 + font-size: 172%; 4.16 + font-family: monospace; 4.17 +} 4.18 +.ptmr7t-x-x-172 { 4.19 + font-family: monospace; 4.20 +} 4.21 +.ptmr7t-x-x-120 { 4.22 + font-size: 120%; 4.23 + font-family: monospace; 4.24 +} 4.25 +.ptmr7t-x-x-120 { 4.26 + font-family: monospace; 4.27 +} 4.28 +.zpzccmry-x-x-120 { 4.29 + font-size: 120%; 4.30 + font-weight: bold; 4.31 + font-style: italic; 4.32 +} 4.33 +.zpzccmry-x-x-120 { 4.34 + font-weight: bold; 4.35 + font-style: italic; 4.36 +} 4.37 +.pcrr7tn- { 4.38 + font-family: monospace; 4.39 +} 4.40 +.ptmri7t- { 4.41 + font-style: italic; 4.42 +} 4.43 +.ptmr7t-x-x-50 { 4.44 + font-size: 50%; 4.45 + font-family: monospace; 4.46 +} 4.47 +.ptmr7t-x-x-50 { 4.48 + font-family: monospace; 4.49 +} 4.50 +.ptmb7t- { 4.51 + font-weight: bold; 4.52 +} 4.53 +.zptmcmr- { 4.54 + font-style: italic; 4.55 +} 4.56 +.zptmcmrm- { 4.57 + font-style: italic; 4.58 +} 4.59 +.zpzccmry- { 4.60 + font-weight: bold; 4.61 + font-style: italic; 4.62 +} 4.63 +.pcrb7t- { 4.64 + font-family: monospace; 4.65 + font-weight: bold; 4.66 +} 4.67 +.pcrro7t- { 4.68 + font-family: monospace; 4.69 + font-style: oblique; 4.70 +} 4.71 +p.noindent { 4.72 + text-indent: 0em; 4.73 + margin: 0em; 4.74 +} 4.75 +p.nopar { 4.76 + text-indent: 0em; 4.77 +} 4.78 +p.indent { 4.79 + text-indent: 1.5em; 4.80 + margin: 0em; 4.81 +} 4.82 +a img { 4.83 + border-top: 0; 4.84 + border-left: 0; 4.85 + border-right: 0; 4.86 +} 4.87 +center { 4.88 + margin-top: 1em; 4.89 + margin-bottom: 1em; 4.90 +} 4.91 +td center { 4.92 + margin-top: 0em; 4.93 + margin-bottom: 0em; 4.94 +} 4.95 +.Canvas { 4.96 + position: relative; 4.97 +} 4.98 +img.math { 4.99 + vertical-align: middle; 4.100 +} 4.101 +li p.indent { 4.102 + text-indent: 0em; 4.103 +} 4.104 +.enumerate1 { 4.105 + list-style-type: decimal; 4.106 +} 4.107 +.enumerate2 { 4.108 + list-style-type: lower-alpha; 4.109 +} 4.110 +.enumerate3 { 4.111 + list-style-type: lower-roman; 4.112 +} 4.113 +.enumerate4 { 4.114 + list-style-type: upper-alpha; 4.115 +} 4.116 +div.newtheorem { 4.117 + margin-bottom: 2em; 4.118 + margin-top: 2em; 4.119 +} 4.120 +.obeylines-h,.obeylines-v { 4.121 + white-space: nowrap; 4.122 +} 4.123 +div.obeylines-v p { 4.124 + margin-top: 0; 4.125 + margin-bottom: 0; 4.126 +} 4.127 +.overline { 4.128 + text-decoration: overline; 4.129 +} 4.130 +.overline img { 4.131 + border-top: 1px solid black; 4.132 +} 4.133 +td.displaylines { 4.134 + text-align: center; 4.135 + white-space: nowrap; 4.136 +} 4.137 +.centerline { 4.138 + text-align: center; 4.139 +} 4.140 +.rightline { 4.141 + text-align: right; 4.142 +} 4.143 +div.verbatim { 4.144 + font-family: monospace; 4.145 + white-space: nowrap; 4.146 +} 4.147 +table.verbatim { 4.148 + width: 100%; 4.149 +} 4.150 +.fbox { 4.151 + background: url(note.png) no-repeat #cec; 4.152 + padding-left: 58px; 4.153 + padding-top: 1em; 4.154 + padding-bottom: 1em; 4.155 + padding-right: 1em; 4.156 + text-indent: 0pt; 4.157 + border: dotted black 1px; 4.158 +} 4.159 +div.center div.fbox { 4.160 + text-align: center; 4.161 + clear: both; 4.162 + padding-left: 3.0pt; 4.163 + padding-right: 3.0pt; 4.164 + text-indent: 0pt; 4.165 + border: solid black 0.4pt; 4.166 +} 4.167 +table.minipage { 4.168 + width: 100%; 4.169 +} 4.170 +div.center, div.center div.center { 4.171 + text-align: center; 4.172 + margin-left: 1em; 4.173 + margin-right: 1em; 4.174 +} 4.175 +div.center div { 4.176 + text-align: left; 4.177 +} 4.178 +div.flushright, div.flushright div.flushright { 4.179 + text-align: right; 4.180 +} 4.181 +div.flushright div { 4.182 + text-align: left; 4.183 +} 4.184 +div.flushleft { 4.185 + text-align: left; 4.186 +} 4.187 +.underline { 4.188 + text-decoration: underline; 4.189 +} 4.190 +.underline img { 4.191 + border-bottom: 1px solid black; 4.192 + margin-bottom: 1pt; 4.193 +} 4.194 +.framebox-c, .framebox-l, .framebox-r { 4.195 + padding-left: 3.0pt; 4.196 + padding-right: 3.0pt; 4.197 + text-indent: 0pt; 4.198 + border: solid black 0.4pt; 4.199 +} 4.200 +.framebox-c { 4.201 + text-align: center; 4.202 +} 4.203 +.framebox-l { 4.204 + text-align: left; 4.205 +} 4.206 +.framebox-r { 4.207 + text-align: right; 4.208 +} 4.209 +span.thank-mark { 4.210 + vertical-align: super 4.211 +} 4.212 +span.footnote-mark sup.textsuperscript, span.footnote-mark a sup.textsuperscript { 4.213 + font-size: 80%; 4.214 +} 4.215 +div.tabular, div.center div.tabular { 4.216 + text-align: center; 4.217 + margin-top: 0.5em; 4.218 + margin-bottom: 0.5em; 4.219 +} 4.220 +table.tabular td p { 4.221 + margin-top: 0em; 4.222 +} 4.223 +table.tabular { 4.224 + margin-left: auto; 4.225 + margin-right: auto; 4.226 +} 4.227 +div.td00 { 4.228 + margin-left: 0pt; 4.229 + margin-right: 0pt; 4.230 +} 4.231 +div.td01 { 4.232 + margin-left: 0pt; 4.233 + margin-right: 5pt; 4.234 +} 4.235 +div.td10 { 4.236 + margin-left: 5pt; 4.237 + margin-right: 0pt; 4.238 +} 4.239 +div.td11 { 4.240 + margin-left: 5pt; 4.241 + margin-right: 5pt; 4.242 +} 4.243 +table[rules] { 4.244 + border-left: solid black 0.4pt; 4.245 + border-right: solid black 0.4pt; 4.246 +} 4.247 +td.td00 { 4.248 + padding-left: 0pt; 4.249 + padding-right: 0pt; 4.250 +} 4.251 +td.td01 { 4.252 + padding-left: 0pt; 4.253 + padding-right: 5pt; 4.254 +} 4.255 +td.td10 { 4.256 + padding-left: 5pt; 4.257 + padding-right: 0pt; 4.258 +} 4.259 +td.td11 { 4.260 + padding-left: 5pt; 4.261 + padding-right: 5pt; 4.262 +} 4.263 +table[rules] { 4.264 + border-left: solid black 0.4pt; 4.265 + border-right: solid black 0.4pt; 4.266 +} 4.267 +.hline hr, .cline hr { 4.268 + height : 1px; 4.269 + margin: 0px; 4.270 +} 4.271 +.tabbing-right { 4.272 + text-align: right; 4.273 +} 4.274 +span.TEX { 4.275 + letter-spacing: -0.125em; 4.276 +} 4.277 +span.TEX span.E { 4.278 + position: relative;top: 0.5ex;left: -0.0417em; 4.279 +} 4.280 +a span.TEX span.E { 4.281 + text-decoration: none; 4.282 +} 4.283 +span.LATEX span.A { 4.284 + position: relative; 4.285 + top: -0.5ex; 4.286 + left: -0.4em; 4.287 + font-size: 85%; 4.288 +} 4.289 +span.LATEX span.TEX { 4.290 + position: relative; 4.291 + left: -0.4em; 4.292 +} 4.293 +div.float img, div.float .caption { 4.294 + text-align: center; 4.295 +} 4.296 +div.figure img, div.figure .caption { 4.297 + text-align: center; 4.298 +} 4.299 +.marginpar { 4.300 + width: 20%; 4.301 + float: right; 4.302 + text-align: left; 4.303 + margin-left: auto; 4.304 + margin-top: 0.5em; 4.305 + font-size: 85%; 4.306 + text-decoration: underline; 4.307 +} 4.308 +.marginpar p { 4.309 + margin-top: 0.4em; 4.310 + margin-bottom: 0.4em; 4.311 +} 4.312 +table.equation { 4.313 + width: 100%; 4.314 +} 4.315 +.equation td { 4.316 + text-align: center; 4.317 +} 4.318 +td.equation { 4.319 + margin-top: 1em; 4.320 + margin-bottom: 1em; 4.321 +} 4.322 +td.equation-label { 4.323 + width: 5%; 4.324 + text-align: center; 4.325 +} 4.326 +td.eqnarray4 { 4.327 + width: 5%; 4.328 + white-space: normal; 4.329 +} 4.330 +td.eqnarray2 { 4.331 + width: 5%; 4.332 +} 4.333 +table.eqnarray-star, table.eqnarray { 4.334 + width: 100%; 4.335 +} 4.336 +div.eqnarray { 4.337 + text-align: center; 4.338 +} 4.339 +div.array { 4.340 + text-align: center; 4.341 +} 4.342 +div.pmatrix { 4.343 + text-align: center; 4.344 +} 4.345 +table.pmatrix { 4.346 + width: 100%; 4.347 +} 4.348 +span.pmatrix img { 4.349 + vertical-align: middle; 4.350 +} 4.351 +div.pmatrix { 4.352 + text-align: center; 4.353 +} 4.354 +table.pmatrix { 4.355 + width: 100%; 4.356 +} 4.357 +img.cdots { 4.358 + vertical-align: middle; 4.359 +} 4.360 +.partToc a, .partToc, .likepartToc a, .likepartToc { 4.361 + line-height: 200%; 4.362 + font-weight: bold; 4.363 + font-size: 110%; 4.364 +} 4.365 +.chapterToc a, .chapterToc, .likechapterToc a, .likechapterToc, .appendixToc a, .appendixToc { 4.366 + line-height: 200%; 4.367 + font-weight: bold; 4.368 +} 4.369 +.caption td.id { 4.370 + font-weight: bold; 4.371 + white-space: nowrap; 4.372 +} 4.373 +table.caption { 4.374 + text-align: center; 4.375 +} 4.376 +h1.partHead { 4.377 + text-align: center; 4.378 +} 4.379 +p.bibitem { 4.380 + text-indent: -2em; 4.381 + margin-left: 2em; 4.382 + margin-top: 0.6em; 4.383 + margin-bottom: 0.6em; 4.384 +} 4.385 +p.bibitem-p { 4.386 + text-indent: 0em; 4.387 + margin-left: 2em; 4.388 + margin-top: 0.6em; 4.389 + margin-bottom: 0.6em; 4.390 +} 4.391 +.paragraphHead, .likeparagraphHead { 4.392 + margin-top: 2em; 4.393 + font-weight: bold; 4.394 +} 4.395 +.subparagraphHead, .likesubparagraphHead { 4.396 + font-weight: bold; 4.397 +} 4.398 +.quote { 4.399 + margin-bottom: 0.25em; 4.400 + margin-top: 0.25em; 4.401 + margin-left: 1em; 4.402 + margin-right: 1em; 4.403 + text-align: justify; 4.404 +} 4.405 +.verse { 4.406 + white-space: nowrap; 4.407 + margin-left: 2em} 4.408 +div.maketitle { 4.409 + text-align: center; 4.410 +} 4.411 +h2.titleHead { 4.412 + text-align: center; 4.413 +} 4.414 +div.maketitle { 4.415 + margin-bottom: 2em; 4.416 +} 4.417 +div.author, div.date { 4.418 + text-align: center; 4.419 +} 4.420 +div.thanks { 4.421 + text-align: left; 4.422 + margin-left: 10%; 4.423 + font-size: 85%; 4.424 + font-style: italic; 4.425 +} 4.426 +div.author { 4.427 + white-space: nowrap; 4.428 +} 4.429 +.quotation { 4.430 + margin-bottom: 0.25em; 4.431 + margin-top: 0.25em; 4.432 + margin-left: 1em; 4.433 +} 4.434 +h1.partHead { 4.435 + text-align: center; 4.436 +} 4.437 +img.graphics { 4.438 + margin-left: 10%; 4.439 +} 4.440 +.figure { 4.441 + width: 100%; 4.442 +} 4.443 +P.fancyvrb { 4.444 + white-space: nowrap; 4.445 +} 4.446 +hr { 4.447 + border: 0; 4.448 + height: 1px; 4.449 +} 4.450 +div#fancyvrb { 4.451 + white-space: nowrap; 4.452 + background: #eee; 4.453 + padding: 1em; 4.454 +}