Mercurial > hgbook
changeset 21:ce3339dbeb6f
Get beta feedback stuff into better shape.
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Wed, 05 Jul 2006 00:14:15 -0700 |
parents | e6f4088ebe52 |
children | 5ad16196cef4 |
files | en/00book.tex en/Makefile en/fblinks |
diffstat | 3 files changed, 35 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/en/00book.tex Tue Jul 04 16:41:31 2006 -0700 +++ b/en/00book.tex Wed Jul 05 00:14:15 2006 -0700 @@ -1,4 +1,4 @@ -\documentclass{book} +\documentclass[oneside]{book} \usepackage{enumerate} \usepackage{fullpage} \usepackage{makeidx} @@ -7,7 +7,7 @@ \usepackage{pslatex} \usepackage{fancyvrb} % leave hyperref until last -\usepackage{hyperref} +\usepackage[colorlinks=true,bookmarks=true]{hyperref} \include{99defs}
--- a/en/Makefile Tue Jul 04 16:41:31 2006 -0700 +++ b/en/Makefile Wed Jul 05 00:14:15 2006 -0700 @@ -1,6 +1,6 @@ # This makefile requires GNU make. -hg_id := $(shell hg id 2>/dev/null | sed -e 's/ tip\>//' -e 's/ /,/g' || echo external) +hg_id := $(shell hg parents --template '{node|short}' | head -1) sources := \ 00book.tex \ @@ -29,12 +29,12 @@ define pdf mkdir -p $(dir $@) - pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1) + TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1) cp 99book.bib $(dir $@) cd $(dir $@) && bibtex $(basename $(notdir $@)) cd $(dir $@) && makeindex $(basename $(notdir $@)) - pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1) - pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1) + TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1) + TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1) endef pdf/hgbook.pdf: $(sources) $(image-sources:%.svg=%_pdf.png) examples @@ -56,7 +56,7 @@ head -3 $(shell which htlatex) >> $(dir $(1))/htlatex.book echo 'echo status $$$$' >> $(dir $(1))/htlatex.book chmod 755 $(dir $(1))/htlatex.book - $(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) "xhtml,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/�([0-7][0-9a-f]);/chr(hex($$1))/egi' $(dir $(1))/*.html
--- a/en/fblinks Tue Jul 04 16:41:31 2006 -0700 +++ b/en/fblinks Wed Jul 05 00:14:15 2006 -0700 @@ -5,12 +5,12 @@ import re import sys -hg_id = sys.argv[1][:12] +hg_id = sys.argv[1] dest_dir = sys.argv[2] -empty_re = re.compile('^\s*$') -line_re = re.compile('^(\w+)(.*)') +empty_re = re.compile(r'^\s*$') +line_re = re.compile(r'^(\w+)(.*)') try: os.makedirs(dest_dir) @@ -19,7 +19,19 @@ raise def feedback(name, text, line): - return r'\marginpar{\scriptsize \href{http://www.sourcecontrol.org/book/feedback.cgi?id=%s&file=%s&line=%d}{Feedback?}}' % (hg_id, name, line) + return r'\marginpar{\scriptsize \href{http://demesne:8000/book/feedback/submit/%s/%s/%d/}{Feedback}}' % (hg_id, name, line) + +ctxs = {} +try: + cfp = open(os.path.join(dest_dir, 'rev-' + hg_id + '.ctx'), 'r+') + for line in cfp: + f, l, c = line.split(':', 2) + ctxs[(f, int(l))] = c.strip() +except IOError, err: + if err.errno != errno.ENOENT: raise + cfp = open(os.path.join(dest_dir, 'rev-' + hg_id + '.ctx'), 'w+') + +changes = 0 for name in sys.argv[3:]: if not name.endswith('.tex'): @@ -34,8 +46,20 @@ if new_par: m = line_re.match(line) if m: + ls = line.strip() + if ctxs.get((name, line_num)) != ls: + ctxs[(name, line_num)] = ls + changes += 1 line = m.group(1) + feedback(name, line, line_num) + m.group(2) new_par = False elif not line.strip(): new_par = True ofp.write(line) + +if changes: + cfp.seek(0) + print '%s: %d changes' % (cfp.name, changes) + ctxs = ctxs.items() + ctxs.sort() + for ((file, line), content) in ctxs: + cfp.write('%s:%d: %s\n' % (file, line, content))