mirror of
https://github.com/moparisthebest/xeps
synced 2024-11-21 08:45:04 -05:00
Makefile: add 'check' target, consolidating xmllint invocations
Previously the html and pdf targets would also verify the input via xmllint. This caused some code duplication and overloaded the targets which an arguably unrelated task (verification). Furthermore, something changed and the ! xmllint --nonet --noout --noent --loaddtd --xpath "//img/@src[not(starts-with(., 'data:'))]" $< 2>/dev/null && true no fails. It seems that xmllint does no longer (?) report an error exit status if the XPath result set is empty [1]. Therfore, this rule is currently commented out, which fixed #1316. 1: https://gitlab.gnome.org/GNOME/libxml2/-/issues/673
This commit is contained in:
parent
773d1e73a1
commit
67945f2ae3
6
.github/workflows/xep-validation.yml
vendored
6
.github/workflows/xep-validation.yml
vendored
@ -31,5 +31,11 @@ jobs:
|
|||||||
if ! tools/validate-xep0001-conformance.sh "$xep"; then
|
if ! tools/validate-xep0001-conformance.sh "$xep"; then
|
||||||
result=1
|
result=1
|
||||||
fi
|
fi
|
||||||
|
if [[ ${xep} == xep-* ]]; then
|
||||||
|
echo Checking ${xep} by invoking \"make .${xep}.check.ok\"
|
||||||
|
if ! make ".${xep}.check.ok"; then
|
||||||
|
result=1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
exit $result
|
exit $result
|
||||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -75,3 +75,5 @@ Session.vim
|
|||||||
/tools/xeps-email.conf
|
/tools/xeps-email.conf
|
||||||
/tmp/
|
/tmp/
|
||||||
/pr-worktree/
|
/pr-worktree/
|
||||||
|
|
||||||
|
.*.xml.check.ok
|
||||||
|
25
Makefile
25
Makefile
@ -36,6 +36,7 @@ xep_pdfs=$(patsubst %.xml,$(OUTDIR)/%.pdf,$(xeps))
|
|||||||
xep_refs=$(patsubst xep-%.xml, $(REFSDIR)/reference.XSF.XEP-%.xml, $(xeps))
|
xep_refs=$(patsubst xep-%.xml, $(REFSDIR)/reference.XSF.XEP-%.xml, $(xeps))
|
||||||
xep_examples=$(patsubst xep-%.xml, $(EXAMPLESDIR)/%.xml, $(xeps))
|
xep_examples=$(patsubst xep-%.xml, $(EXAMPLESDIR)/%.xml, $(xeps))
|
||||||
|
|
||||||
|
all_xep_check_ok=$(patsubst %.xml, .%.xml.check.ok, $(xeps))
|
||||||
|
|
||||||
.PHONY: help
|
.PHONY: help
|
||||||
help:
|
help:
|
||||||
@ -46,6 +47,7 @@ help:
|
|||||||
@echo ' refs - build all IETF refs'
|
@echo ' refs - build all IETF refs'
|
||||||
@echo ' html - build all XEPs'
|
@echo ' html - build all XEPs'
|
||||||
@echo ' inbox-html - build all ProtoXEPs'
|
@echo ' inbox-html - build all ProtoXEPs'
|
||||||
|
@echo ' check - check all XEPs for errors'
|
||||||
@echo ' clean - recursively unlink the build tree'
|
@echo ' clean - recursively unlink the build tree'
|
||||||
@echo ' preview - builds html whenever an XEP changes (requires inotify-tools)'
|
@echo ' preview - builds html whenever an XEP changes (requires inotify-tools)'
|
||||||
@echo ' examples - extract all examples'
|
@echo ' examples - extract all examples'
|
||||||
@ -82,6 +84,9 @@ refs: $(xep_refs)
|
|||||||
.PHONY: examples
|
.PHONY: examples
|
||||||
examples: $(xep_examples)
|
examples: $(xep_examples)
|
||||||
|
|
||||||
|
.PHONY: check
|
||||||
|
check: $(all_xep_check_ok)
|
||||||
|
|
||||||
.PHONY: xep-%
|
.PHONY: xep-%
|
||||||
xep-%: $(OUTDIR)/xep-%.html $(REFSDIR)/reference.XSF.XEP-%.xml $(OUTDIR)/xep-%.pdf $(EXAMPLESDIR)/%.xml;
|
xep-%: $(OUTDIR)/xep-%.html $(REFSDIR)/reference.XSF.XEP-%.xml $(OUTDIR)/xep-%.pdf $(EXAMPLESDIR)/%.xml;
|
||||||
|
|
||||||
@ -106,30 +111,24 @@ $(EXAMPLESDIR)/%.xml: xep-%.xml $(XMLDEPS) examples.xsl | $(EXAMPLESDIR)
|
|||||||
$(REFSDIR)/reference.XSF.XEP-%.xml: xep-%.xml $(XMLDEPS) ref.xsl | $(REFSDIR)
|
$(REFSDIR)/reference.XSF.XEP-%.xml: xep-%.xml $(XMLDEPS) ref.xsl | $(REFSDIR)
|
||||||
xsltproc --path $(CURDIR) ref.xsl "$<" > "$@" && echo "Finished building $@"
|
xsltproc --path $(CURDIR) ref.xsl "$<" > "$@" && echo "Finished building $@"
|
||||||
|
|
||||||
$(xep_htmls): $(OUTDIR)/xep-%.html: xep-%.xml $(XMLDEPS) $(HTMLDEPS) | $(OUTDIR)
|
.%.xml.check.ok: %.xml
|
||||||
xmllint --nonet --noout --noent --loaddtd --valid "$<"
|
xmllint --nonet --noout --noent --loaddtd --valid "$<"
|
||||||
# Check for non-data URIs
|
# Check for non-data URIs, the result set of the XPath expression below should be empty
|
||||||
! xmllint --nonet --noout --noent --loaddtd --xpath "//img/@src[not(starts-with(., 'data:'))]" $< 2>/dev/null && true
|
# Disabled for now, see
|
||||||
|
# https://github.com/xsf/xeps/issues/1316 and https://gitlab.gnome.org/GNOME/libxml2/-/issues/673
|
||||||
|
# xmllint --loaddtd --xpath "//img/@src[not(starts-with(., 'data:'))]" $< > /dev/null
|
||||||
|
touch $@
|
||||||
|
|
||||||
# Actually build the HTML
|
$(xep_htmls): $(OUTDIR)/xep-%.html: xep-%.xml $(XMLDEPS) $(HTMLDEPS) | $(OUTDIR)
|
||||||
xsltproc --path $(CURDIR) --param htmlbase "$(if $(findstring inbox,$<),'../','./')" xep.xsl "$<" > "$@" && echo "Finished building $@"
|
xsltproc --path $(CURDIR) --param htmlbase "$(if $(findstring inbox,$<),'../','./')" xep.xsl "$<" > "$@" && echo "Finished building $@"
|
||||||
|
|
||||||
$(proto_xep_htmls): $(OUTDIR)/inbox/%.html: inbox/%.xml $(XMLDEPS) $(proto_HTMLDEPS) | $(OUTDIR)
|
$(proto_xep_htmls): $(OUTDIR)/inbox/%.html: inbox/%.xml $(XMLDEPS) $(proto_HTMLDEPS) | $(OUTDIR)
|
||||||
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) --param htmlbase "$(if $(findstring inbox,$<),'../','./')" 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)
|
$(OUTDIR)/xmpp.pdf $(OUTDIR)/xmpp-text.pdf: | $(OUTDIR)
|
||||||
cp "resources/$(notdir $@)" "$@"
|
cp "resources/$(notdir $@)" "$@"
|
||||||
|
|
||||||
$(OUTDIR)/%.pdf: %.xml $(XMLDEPS) $(TEXMLDEPS)
|
$(OUTDIR)/%.pdf: %.xml $(XMLDEPS) $(TEXMLDEPS)
|
||||||
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
|
|
||||||
|
|
||||||
xsltproc --path $(CURDIR) xep2texml.xsl "$<" > "$(@:.pdf=.tex.xml)"
|
xsltproc --path $(CURDIR) xep2texml.xsl "$<" > "$(@:.pdf=.tex.xml)"
|
||||||
texml -e utf8 "$(@:.pdf=.tex.xml)" "$(@:.pdf=.tex)"
|
texml -e utf8 "$(@:.pdf=.tex.xml)" "$(@:.pdf=.tex)"
|
||||||
sed -i -e 's|\([\s"]\)\([^"]http://[^ "]*\)|\1\\path{\2}|g' \
|
sed -i -e 's|\([\s"]\)\([^"]http://[^ "]*\)|\1\\path{\2}|g' \
|
||||||
|
Loading…
Reference in New Issue
Block a user