hgbook
changeset 21:ce3339dbeb6f
Get beta feedback stuff into better shape.
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Wed Jul 05 00:14:15 2006 -0700 (2006-07-05) |
parents | e6f4088ebe52 |
children | 5ad16196cef4 |
files | en/00book.tex en/Makefile en/fblinks |
line diff
1.1 --- a/en/00book.tex Tue Jul 04 16:41:31 2006 -0700 1.2 +++ b/en/00book.tex Wed Jul 05 00:14:15 2006 -0700 1.3 @@ -1,4 +1,4 @@ 1.4 -\documentclass{book} 1.5 +\documentclass[oneside]{book} 1.6 \usepackage{enumerate} 1.7 \usepackage{fullpage} 1.8 \usepackage{makeidx} 1.9 @@ -7,7 +7,7 @@ 1.10 \usepackage{pslatex} 1.11 \usepackage{fancyvrb} 1.12 % leave hyperref until last 1.13 -\usepackage{hyperref} 1.14 +\usepackage[colorlinks=true,bookmarks=true]{hyperref} 1.15 1.16 \include{99defs} 1.17
2.1 --- a/en/Makefile Tue Jul 04 16:41:31 2006 -0700 2.2 +++ b/en/Makefile Wed Jul 05 00:14:15 2006 -0700 2.3 @@ -1,6 +1,6 @@ 2.4 # This makefile requires GNU make. 2.5 2.6 -hg_id := $(shell hg id 2>/dev/null | sed -e 's/ tip\>//' -e 's/ /,/g' || echo external) 2.7 +hg_id := $(shell hg parents --template '{node|short}' | head -1) 2.8 2.9 sources := \ 2.10 00book.tex \ 2.11 @@ -29,12 +29,12 @@ 2.12 2.13 define pdf 2.14 mkdir -p $(dir $@) 2.15 - pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1) 2.16 + TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1) 2.17 cp 99book.bib $(dir $@) 2.18 cd $(dir $@) && bibtex $(basename $(notdir $@)) 2.19 cd $(dir $@) && makeindex $(basename $(notdir $@)) 2.20 - pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1) 2.21 - pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1) 2.22 + TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1) 2.23 + TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1) 2.24 endef 2.25 2.26 pdf/hgbook.pdf: $(sources) $(image-sources:%.svg=%_pdf.png) examples 2.27 @@ -56,7 +56,7 @@ 2.28 head -3 $(shell which htlatex) >> $(dir $(1))/htlatex.book 2.29 echo 'echo status $$$$' >> $(dir $(1))/htlatex.book 2.30 chmod 755 $(dir $(1))/htlatex.book 2.31 - $(dir $(1))/htlatex.book $(2) "xhtml,html4-uni,$(3)" " -cunihtf -utf8" "" "$(call latex-options,$(1))" || (rm -f $(1); exit 1) 2.32 + TEXINPUTS=$(dir $(2)): $(dir $(1))/htlatex.book $(2) "xhtml,html4-uni,$(3)" " -cunihtf -utf8" "" "$(call latex-options,$(1))" || (rm -f $(1); exit 1) 2.33 cd $(dir $(1)) && tex4ht -f/$(basename $(notdir $(1))) -cvalidate -cunihtf 2.34 cd $(dir $(1)) && t4ht -f/$(basename $(notdir $(1))) 2.35 perl -pi -e 's/�([0-7][0-9a-f]);/chr(hex($$1))/egi' $(dir $(1))/*.html
3.1 --- a/en/fblinks Tue Jul 04 16:41:31 2006 -0700 3.2 +++ b/en/fblinks Wed Jul 05 00:14:15 2006 -0700 3.3 @@ -5,12 +5,12 @@ 3.4 import re 3.5 import sys 3.6 3.7 -hg_id = sys.argv[1][:12] 3.8 +hg_id = sys.argv[1] 3.9 3.10 dest_dir = sys.argv[2] 3.11 3.12 -empty_re = re.compile('^\s*$') 3.13 -line_re = re.compile('^(\w+)(.*)') 3.14 +empty_re = re.compile(r'^\s*$') 3.15 +line_re = re.compile(r'^(\w+)(.*)') 3.16 3.17 try: 3.18 os.makedirs(dest_dir) 3.19 @@ -19,7 +19,19 @@ 3.20 raise 3.21 3.22 def feedback(name, text, line): 3.23 - return r'\marginpar{\scriptsize \href{http://www.sourcecontrol.org/book/feedback.cgi?id=%s&file=%s&line=%d}{Feedback?}}' % (hg_id, name, line) 3.24 + return r'\marginpar{\scriptsize \href{http://demesne:8000/book/feedback/submit/%s/%s/%d/}{Feedback}}' % (hg_id, name, line) 3.25 + 3.26 +ctxs = {} 3.27 +try: 3.28 + cfp = open(os.path.join(dest_dir, 'rev-' + hg_id + '.ctx'), 'r+') 3.29 + for line in cfp: 3.30 + f, l, c = line.split(':', 2) 3.31 + ctxs[(f, int(l))] = c.strip() 3.32 +except IOError, err: 3.33 + if err.errno != errno.ENOENT: raise 3.34 + cfp = open(os.path.join(dest_dir, 'rev-' + hg_id + '.ctx'), 'w+') 3.35 + 3.36 +changes = 0 3.37 3.38 for name in sys.argv[3:]: 3.39 if not name.endswith('.tex'): 3.40 @@ -34,8 +46,20 @@ 3.41 if new_par: 3.42 m = line_re.match(line) 3.43 if m: 3.44 + ls = line.strip() 3.45 + if ctxs.get((name, line_num)) != ls: 3.46 + ctxs[(name, line_num)] = ls 3.47 + changes += 1 3.48 line = m.group(1) + feedback(name, line, line_num) + m.group(2) 3.49 new_par = False 3.50 elif not line.strip(): 3.51 new_par = True 3.52 ofp.write(line) 3.53 + 3.54 +if changes: 3.55 + cfp.seek(0) 3.56 + print '%s: %d changes' % (cfp.name, changes) 3.57 + ctxs = ctxs.items() 3.58 + ctxs.sort() 3.59 + for ((file, line), content) in ctxs: 3.60 + cfp.write('%s:%d: %s\n' % (file, line, content))