Mercurial > hgbook
changeset 24:a752b0fd3c10
Merge.
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Sun, 09 Jul 2006 21:47:15 -0700 |
parents | 9457add294b8 (diff) 2888fe6176b3 (current diff) |
children | 9d5b6d303ef5 |
files | en/Makefile en/examples/run-example |
diffstat | 4 files changed, 42 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/en/00book.tex Fri Jul 07 20:09:20 2006 -0700 +++ b/en/00book.tex Sun Jul 09 21:47: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 Fri Jul 07 20:09:20 2006 -0700 +++ b/en/Makefile Sun Jul 09 21:47: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 \ @@ -32,12 +32,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 @@ -59,7 +59,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/examples/run-example Fri Jul 07 20:09:20 2006 -0700 +++ b/en/examples/run-example Sun Jul 09 21:47:15 2006 -0700 @@ -87,11 +87,12 @@ pid, fd = pty.fork() if pid == 0: #os.execl(self.shell, self.shell) - os.system('/bin/bash --noediting --noprofile --rcfile %s' % rcfile) + os.system('/bin/bash --noediting --noprofile --norc') sys.exit(0) self.cfp = os.fdopen(fd, 'w+') try: - self.receive() + # setup env and prompt + self.sendreceive('source %s\n\n' % rcfile) for hunk in self.parse(): # is this line a processing instruction? m = self.pi_re.match(hunk)
--- a/en/fblinks Fri Jul 07 20:09:20 2006 -0700 +++ b/en/fblinks Sun Jul 09 21:47: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) @@ -18,8 +18,20 @@ if err.errno != errno.EEXIST: 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) +def feedback(name, text, ctx_id): + return r'\marginpar{\scriptsize \href{http://demesne:8000/book/feedback/submit/%s/%s/%d/}{Feedback}}' % (hg_id, name, ctx_id) + +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'): @@ -29,13 +41,27 @@ ofp = open(dest_name, 'w') new_par = True line_num = 0 + par_num = 0 for line in ifp: line_num += 1 if new_par: m = line_re.match(line) if m: - line = m.group(1) + feedback(name, line, line_num) + m.group(2) + par_num += 1 + ls = line.strip() + if ctxs.get((name, par_num)) != ls: + ctxs[(name, par_num)] = ls + changes += 1 + line = m.group(1) + feedback(name, line, par_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))