Bryan O'Sullivan  committed e6f4088

Generate a PDF file with a feedback link on each paragraph.

  • Participants
  • Parent commits 2668e15
  • Branches default

Comments (0)

Files changed (5)

 syntax: glob

File en/00book.tex

 % leave hyperref until last
+# This makefile requires GNU make.
+hg_id := $(shell hg id 2>/dev/null | sed -e 's/ tip\>//' -e 's/ /,/g' || echo external)
 sources := \
 	00book.tex \
 	99book.bib \
 pdf: pdf/hgbook.pdf
-pdf/hgbook.pdf: $(sources) $(image-sources:%.svg=%_pdf.png) examples
+define pdf
 	mkdir -p $(dir $@)
 	pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
 	cp 99book.bib $(dir $@)
 	cd $(dir $@) && makeindex $(basename $(notdir $@))
 	pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
 	pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
+pdf/hgbook.pdf: $(sources) $(image-sources:%.svg=%_pdf.png) examples
+	$(call pdf)
 html: html/onepage/hgbook.html 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
+# include verbatim the big wad of TeX that is repeated in that script,
+# so instead I mangle the script itself.
 define htlatex
 	mkdir -p $(dir $(1))
 	head -2 $(shell which htlatex) > $(dir $(1))/
 	$(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.png) 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 $@)
+# Produce 90dpi PNGs for the web.
 %.png: %.svg
 	inkscape -D -e $@ $<
+# Produce 300dpi PNGs for PDF.
 %_pdf.png: %.svg
 	inkscape -D -d 300 -e $@ $<
-%.eps: %.svg
-	inkscape -E $@ $<
 examples: examples/.run
 examples/.run: $(example-sources)
 	cd examples && ./run-example
-	echo 'in-place build' > $@
-	hg id | sed -e 's/ tip\>//' > build_id.tex
+build_id.tex: $(wildcard ../.hg/00changelog.[id])
+	echo $(hg_id) > build_id.tex
-	rm -rf html pdf *.eps *.png *.aux *.dvi *.log *.out examples/*.out examples/.run buildrev.tex
+	rm -rf beta html pdf *.eps *.png *.aux *.dvi *.log *.out \
+		examples/*.out examples/.run build_id.tex
 Here's an example that illustrates how you can use this ability.
 Let's say you're developing a new feature as two patches.  The first
-is a change to the core of your software, and the second--layered on
-top of the first--changes the user interface to use the code you just
+is a change to the core of your software, and the second---layered on
+top of the first---changes the user interface to use the code you just
 added to the core.  If you notice a bug in the core while you're
 working on the UI patch, it's easy to fix the core.  Simply
 \hgcmd{qrefresh} the UI patch to save your in-progress changes, and
 \item The context in the middle of a hunk has changed.
 \item A hunk is missing some context at the beginning or end.
-\item A large hunk might apply better--either entirely or in part--if
-  it was broken up into smaller hunks.
+\item A large hunk might apply better---either entirely or in
+  part---if it was broken up into smaller hunks.
 \item A hunk removes lines with slightly different content than those
   currently present in the file.
 The \command{diffstat} command~\cite{web:diffstat} generates a
 histogram of the modifications made to each file in a patch.  It
-provides a good way to ``get a sense of'' a patch--which files it
+provides a good way to ``get a sense of'' a patch---which files it
 affects, and how much change it introduces to each file and as a
 whole.  (I find that it's a good idea to use \command{diffstat}'s
 \texttt{-p} option as a matter of course, as otherwise it will try to