From 609a081f273d4d2b7c9e074bebc8c7b951242b54 Mon Sep 17 00:00:00 2001 From: Jonas Wielicki Date: Wed, 23 Aug 2017 13:22:06 +0200 Subject: [PATCH] Add build for inbox/ --- Dockerfile | 3 ++- Makefile | 45 +++++++++++++++++++++++++++++++++++++++------ xep.xsl | 1 + 3 files changed, 42 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1b529dbb..29af9e94 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,10 +4,11 @@ FROM xmppxsf/xeps-base:latest ARG NCORES=1 -ARG TARGETS="html pdf" +ARG TARGETS="html inbox-html inbox-xml pdf" COPY *.xml xep.* *.css *.xsl *.js *.xsl Makefile /src/ COPY resources/*.pdf /src/resources/ +COPY inbox/*.xml inbox/*.ent inbox/*.dtd /src/inbox/ WORKDIR /src RUN OUTDIR=/var/www/html/extensions/ make -j$NCORES $TARGETS diff --git a/Makefile b/Makefile index 8c9773b9..cbd03489 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,22 @@ JSTARGETS=$(OUTDIR)/prettify.js DO_XELATEX=cd $(OUTDIR); xelatex --interaction=nonstopmode -no-shell-escape "$(notdir $(basename $@)).tex" >/dev/null +xeps=$(wildcard *.xml) +proto_xeps=$(wildcard inbox/*.xml) +all_xeps=$(xeps) $(proto_xeps) + +xep_xmls=$(patsubst %.xml,$(OUTDIR)/%.xml,$(xeps)) +proto_xep_xmls=$(patsubst %.xml,$(OUTDIR)/%.xml,$(proto_xeps)) +all_xep_xmls=$(xep_xmls) $(proto_xep_xmls) + +xep_htmls=$(patsubst %.xml,$(OUTDIR)/%.html,$(xeps)) +proto_xep_htmls=$(patsubst %.xml,$(OUTDIR)/%.html,$(proto_xeps)) +all_xep_htmls=$(xep_htmls) $(proto_xep_htmls) + +xep_pdfs=$(patsubst %.xml,$(OUTDIR)/%.pdf,$(xeps)) +xep_refs=$(patsubst xep-%.xml, $(REFSDIR)/reference.XSF.XEP-%.xml, $(xeps)) +xep_examples=$(patsubst xep-%.xml, $(EXAMPLESDIR)/%.xml, $(xeps)) + .PHONY: help help: @@ -33,17 +49,30 @@ help: .PHONY: all all: html +$(OUTDIR)/inbox/%: build/inbox +build/inbox: + mkdir -p build/inbox + .PHONY: html -html: $(patsubst %.xml, $(OUTDIR)/%.html, $(wildcard *.xml)) +html: $(xep_htmls) + +.PHONY: xml +xml: $(xep_xmls) + +.PHONY: inbox-html +inbox-html: $(proto_xep_htmls) + +.PHONY: inbox-xml +inbox-xml: $(proto_xep_xmls) .PHONY: pdf -pdf: $(patsubst %.xml, $(OUTDIR)/%.pdf, $(wildcard *.xml)) +pdf: $(xep_pdfs) .PHONY: refs -refs: $(patsubst xep-%.xml, $(REFSDIR)/reference.XSF.XEP-%.xml, $(wildcard *.xml)) +refs: $(xep_refs) .PHONY: examples -examples: $(patsubst xep-%.xml, $(EXAMPLESDIR)/%.xml, $(wildcard *.xml)) +examples: $(xep_examples) .PHONY: xep-% xep-%: $(OUTDIR)/xep-%.html $(REFSDIR)/reference.XSF.XEP-%.xml $(OUTDIR)/xep-%.pdf $(EXAMPLESDIR)/%.xml; @@ -54,19 +83,23 @@ xep-%.html: $(OUTDIR)/xep-%.html ; .PHONY: xep-%.pdf xep-%.pdf: $(OUTDIR)/xep-%.pdf ; +$(all_xep_xmls): $(OUTDIR)/%.xml: %.xml + cp $< $@ + $(EXAMPLESDIR)/%.xml: xep-%.xml $(XMLDEPS) examples.xsl $(EXAMPLESDIR) xsltproc --path $(CURDIR) examples.xsl "$<" > "$@" && echo "Finished building $@" $(REFSDIR)/reference.XSF.XEP-%.xml: xep-%.xml $(XMLDEPS) ref.xsl $(REFSDIR) xsltproc --path $(CURDIR) ref.xsl "$<" > "$@" && echo "Finished building $@" -$(OUTDIR)/%.html: %.xml $(XMLDEPS) $(HTMLDEPS) +$(all_xep_htmls): $(OUTDIR)/%.html: %.xml $(XMLDEPS) $(HTMLDEPS) + mkdir -p $(OUTDIR)/inbox xmllint --nonet --noout --noent --loaddtd --valid "$<" # Check for non-data URIs ! xmllint --nonet --noout --noent --loaddtd --xpath "//img/@src[not(starts-with(., 'data:'))]" $< 2>/dev/null && true # Actually build the HTML - xsltproc --path $(CURDIR) xep.xsl "$<" > "$@" && echo "Finished building $@" + xsltproc --path $(CURDIR) --param htmlbase "$(if $(findstring inbox,$<),'../','./')" xep.xsl "$<" > "$@" && echo "Finished building $@" $(OUTDIR)/xmpp.pdf $(OUTDIR)/xmpp-text.pdf: $(OUTDIR) cp "resources/$(notdir $@)" "$@" diff --git a/xep.xsl b/xep.xsl index 5d6b2c5f..7e8c38dc 100644 --- a/xep.xsl +++ b/xep.xsl @@ -40,6 +40,7 @@ OR OTHER DEALINGS IN THE SOFTWARE. XEP-<xsl:value-of select='/xep/header/number'/>:<xsl:text> </xsl:text><xsl:value-of select='/xep/header/title' /> +