1
0
mirror of https://github.com/moparisthebest/xeps synced 2024-11-24 02:02:16 -05:00

Merge pull request #99 from SamWhited/make_preview

Add `make preview' to generate HTML on XML save
This commit is contained in:
Matthew A. Miller 2015-10-27 09:30:22 -06:00
commit e4803f5592

View File

@ -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
@ -17,6 +18,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 +72,12 @@ $(TEMPDIR) $(OUTDIR) $(RESOURCESDIR):
.PHONY: clean
clean:
rm -rf $(OUTDIR)
.PHONY: preview
preview:
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 "$${dir}/$${file}" > "$(OUTDIR)/$${file%.*}.html" && echo "Built $${file%.*}.html $${event}"; \
fi \
done