From f7fc6e0d2d1cb273a1179572eac2112716a1e9db Mon Sep 17 00:00:00 2001 From: Sam Whited Date: Mon, 28 Sep 2015 12:07:47 -0500 Subject: [PATCH 1/2] Add `make preview' to generate HTML on XML save Uses inotifywatch to generate an HTML file anytime an XML file is saved. --- Makefile | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Makefile b/Makefile index f9308d0a..f9cfa86b 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,7 @@ help: @echo ' pdf - build all XEPs' @echo ' html - build all XEPs' @echo ' clean - recursively unlink the build tree' + @echo ' preview - builds html whenever an XEP changes (requires inotify-tools)' @echo ' xep-xxxx - build xep-xxxx.html and xep-xxxx.pdf' @echo ' xep-xxxx.html - build xep-xxxx.html' @echo ' xep-xxxx.pdf - build xep-xxxx.html' @@ -70,3 +71,12 @@ $(TEMPDIR) $(OUTDIR) $(RESOURCESDIR): .PHONY: clean clean: rm -rf $(OUTDIR) + +.PHONY: preview +preview: + inotifywait -m -e close_write,moved_to --format '%e %f' . | \ + while read -r event file; do \ + if [ "$${file: -4}" == ".xml" ]; then \ + xsltproc --path $(CURDIR) xep.xsl "$${file}" > "$(OUTDIR)/$${file: :8}.html" && echo "Built $${file: :8}.html $${event}"; \ + fi \ + done From 8c69d78de4d502111479cbfc208cf9d86b06ddb2 Mon Sep 17 00:00:00 2001 From: Sam Whited Date: Sat, 10 Oct 2015 09:25:21 -0500 Subject: [PATCH 2/2] Make sure make preview supports inbox files --- Makefile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index f9cfa86b..9b17fe29 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,7 @@ TEMPDIR?=$(OUTDIR)/xepbuild XMLDEPS=xep.xsl xep.xsd xep.ent xep.dtd ref.xsl $(OUTDIR) TEXMLDEPS=xep2texml.xsl $(TEMPDIR) $(XMLDEPS) $(RESOURCESDIR)/xmpp.pdf $(RESOURCESDIR)/xmpp-text.pdf XMPPIMAGESURL=https://xmpp.org/images +XEPDIRS=. inbox .PHONY: help @@ -74,9 +75,9 @@ clean: .PHONY: preview preview: - inotifywait -m -e close_write,moved_to --format '%e %f' . | \ - while read -r event file; do \ + inotifywait -m -e close_write,moved_to --format '%e %w %f' $(XEPDIRS) | \ + while read -r event dir file; do \ if [ "$${file: -4}" == ".xml" ]; then \ - xsltproc --path $(CURDIR) xep.xsl "$${file}" > "$(OUTDIR)/$${file: :8}.html" && echo "Built $${file: :8}.html $${event}"; \ + xsltproc --path $(CURDIR) xep.xsl "$${dir}/$${file}" > "$(OUTDIR)/$${file%.*}.html" && echo "Built $${file%.*}.html $${event}"; \ fi \ done