Browse Source

Add build for inbox/

Jonas Wielicki 1 year ago
parent
commit
609a081f27
3 changed files with 42 additions and 7 deletions
  1. 2
    1
      Dockerfile
  2. 39
    6
      Makefile
  3. 1
    0
      xep.xsl

+ 2
- 1
Dockerfile View File

@@ -4,10 +4,11 @@
4 4
 FROM xmppxsf/xeps-base:latest
5 5
 
6 6
 ARG NCORES=1
7
-ARG TARGETS="html pdf"
7
+ARG TARGETS="html inbox-html inbox-xml pdf"
8 8
 
9 9
 COPY *.xml xep.* *.css *.xsl *.js *.xsl Makefile /src/
10 10
 COPY resources/*.pdf /src/resources/
11
+COPY inbox/*.xml inbox/*.ent inbox/*.dtd /src/inbox/
11 12
 
12 13
 WORKDIR /src
13 14
 RUN OUTDIR=/var/www/html/extensions/ make -j$NCORES $TARGETS

+ 39
- 6
Makefile View File

@@ -12,6 +12,22 @@ JSTARGETS=$(OUTDIR)/prettify.js
12 12
 
13 13
 DO_XELATEX=cd $(OUTDIR); xelatex --interaction=nonstopmode -no-shell-escape "$(notdir $(basename $@)).tex" >/dev/null
14 14
 
15
+xeps=$(wildcard *.xml)
16
+proto_xeps=$(wildcard inbox/*.xml)
17
+all_xeps=$(xeps) $(proto_xeps)
18
+
19
+xep_xmls=$(patsubst %.xml,$(OUTDIR)/%.xml,$(xeps))
20
+proto_xep_xmls=$(patsubst %.xml,$(OUTDIR)/%.xml,$(proto_xeps))
21
+all_xep_xmls=$(xep_xmls) $(proto_xep_xmls)
22
+
23
+xep_htmls=$(patsubst %.xml,$(OUTDIR)/%.html,$(xeps))
24
+proto_xep_htmls=$(patsubst %.xml,$(OUTDIR)/%.html,$(proto_xeps))
25
+all_xep_htmls=$(xep_htmls) $(proto_xep_htmls)
26
+
27
+xep_pdfs=$(patsubst %.xml,$(OUTDIR)/%.pdf,$(xeps))
28
+xep_refs=$(patsubst xep-%.xml, $(REFSDIR)/reference.XSF.XEP-%.xml, $(xeps))
29
+xep_examples=$(patsubst xep-%.xml, $(EXAMPLESDIR)/%.xml, $(xeps))
30
+
15 31
 
16 32
 .PHONY: help
17 33
 help:
@@ -33,17 +49,30 @@ help:
33 49
 .PHONY: all
34 50
 all: html
35 51
 
52
+$(OUTDIR)/inbox/%: build/inbox
53
+build/inbox:
54
+	mkdir -p build/inbox
55
+
36 56
 .PHONY: html
37
-html: $(patsubst %.xml, $(OUTDIR)/%.html, $(wildcard *.xml))
57
+html: $(xep_htmls)
58
+
59
+.PHONY: xml
60
+xml: $(xep_xmls)
61
+
62
+.PHONY: inbox-html
63
+inbox-html: $(proto_xep_htmls)
64
+
65
+.PHONY: inbox-xml
66
+inbox-xml: $(proto_xep_xmls)
38 67
 
39 68
 .PHONY: pdf
40
-pdf: $(patsubst %.xml, $(OUTDIR)/%.pdf, $(wildcard *.xml))
69
+pdf: $(xep_pdfs)
41 70
 
42 71
 .PHONY: refs
43
-refs: $(patsubst xep-%.xml, $(REFSDIR)/reference.XSF.XEP-%.xml, $(wildcard *.xml))
72
+refs: $(xep_refs)
44 73
 
45 74
 .PHONY: examples
46
-examples: $(patsubst xep-%.xml, $(EXAMPLESDIR)/%.xml, $(wildcard *.xml))
75
+examples: $(xep_examples)
47 76
 
48 77
 .PHONY: xep-%
49 78
 xep-%: $(OUTDIR)/xep-%.html $(REFSDIR)/reference.XSF.XEP-%.xml $(OUTDIR)/xep-%.pdf $(EXAMPLESDIR)/%.xml;
@@ -54,19 +83,23 @@ xep-%.html: $(OUTDIR)/xep-%.html ;
54 83
 .PHONY: xep-%.pdf
55 84
 xep-%.pdf: $(OUTDIR)/xep-%.pdf ;
56 85
 
86
+$(all_xep_xmls): $(OUTDIR)/%.xml: %.xml
87
+	cp $< $@
88
+
57 89
 $(EXAMPLESDIR)/%.xml: xep-%.xml $(XMLDEPS) examples.xsl $(EXAMPLESDIR)
58 90
 	xsltproc --path $(CURDIR) examples.xsl "$<" > "$@" && echo "Finished building $@"
59 91
 
60 92
 $(REFSDIR)/reference.XSF.XEP-%.xml: xep-%.xml $(XMLDEPS) ref.xsl $(REFSDIR)
61 93
 	xsltproc --path $(CURDIR) ref.xsl "$<" > "$@" && echo "Finished building $@"
62 94
 
63
-$(OUTDIR)/%.html: %.xml $(XMLDEPS) $(HTMLDEPS)
95
+$(all_xep_htmls): $(OUTDIR)/%.html: %.xml $(XMLDEPS) $(HTMLDEPS)
96
+	mkdir -p $(OUTDIR)/inbox
64 97
 	xmllint --nonet --noout --noent --loaddtd --valid "$<"
65 98
 	# Check for non-data URIs
66 99
 	! xmllint --nonet --noout --noent --loaddtd --xpath "//img/@src[not(starts-with(., 'data:'))]" $< 2>/dev/null && true
67 100
 
68 101
 	# Actually build the HTML
69
-	xsltproc --path $(CURDIR) xep.xsl "$<" > "$@" && echo "Finished building $@"
102
+	xsltproc --path $(CURDIR) --param htmlbase "$(if $(findstring inbox,$<),'../','./')" xep.xsl "$<" > "$@" && echo "Finished building $@"
70 103
 
71 104
 $(OUTDIR)/xmpp.pdf $(OUTDIR)/xmpp-text.pdf: $(OUTDIR)
72 105
 	cp "resources/$(notdir $@)" "$@"

+ 1
- 0
xep.xsl View File

@@ -40,6 +40,7 @@ OR OTHER DEALINGS IN THE SOFTWARE.
40 40
     <html>
41 41
       <head>
42 42
         <title>XEP-<xsl:value-of select='/xep/header/number'/>:<xsl:text> </xsl:text><xsl:value-of select='/xep/header/title' /></title>
43
+        <base><xsl:attribute name='href'><xsl:value-of select='$htmlbase'/></xsl:attribute></base>
43 44
         <link rel='stylesheet' type='text/css' href='xmpp.css' />
44 45
         <link href="prettify.css" type="text/css" rel="stylesheet" />
45 46
         <link rel='shortcut icon' type='image/x-icon' href='/favicon.ico' />

Loading…
Cancel
Save