Browse Source

Fix intra-XEP links (regression from 609a081

Jonas Wielicki 1 year ago
parent
commit
238329a536
2 changed files with 24 additions and 8 deletions
  1. 24
    7
      Makefile
  2. 0
    1
      xep.xsl

+ 24
- 7
Makefile View File

@@ -7,8 +7,15 @@ XMLDEPS=xep.xsd xep.ent xep.dtd ref.xsl $(OUTDIR)
7 7
 TEXMLDEPS=xep2texml.xsl $(OUTDIR)/xmpp.pdf $(OUTDIR)/xmpp-text.pdf
8 8
 XEPDIRS=. inbox
9 9
 HTMLDEPS=xep.xsl $(CSSTARGETS) $(JSTARGETS)
10
-CSSTARGETS=$(OUTDIR)/xmpp.css $(OUTDIR)/prettify.css
11
-JSTARGETS=$(OUTDIR)/prettify.js
10
+
11
+base_CSSTARGETS=xmpp.css prettify.css
12
+CSSTARGETS=$(addprefix $(OUTDIR)/,$(base_CSSTARGETS))
13
+proto_CSSTARGETS=$(addprefix $(OUTDIR)/inbox/,$(base_CSSTARGETS))
14
+base_JSTARGETS=prettify.js
15
+JSTARGETS=$(addprefix $(OUTDIR)/,$(base_JSTARGETS))
16
+proto_JSTARGETS=$(addprefix $(OUTDIR)/inbox/,$(base_JSTARGETS))
17
+
18
+proto_HTMLDEPS=xep.xsl $(proto_CSSTARGETS) $(proto_JSTARGETS)
12 19
 
13 20
 DO_XELATEX=cd $(OUTDIR); xelatex --interaction=nonstopmode -no-shell-escape "$(notdir $(basename $@)).tex" >/dev/null
14 21
 
@@ -94,11 +101,15 @@ $(EXAMPLESDIR)/%.xml: xep-%.xml $(XMLDEPS) examples.xsl $(EXAMPLESDIR)
94 101
 $(REFSDIR)/reference.XSF.XEP-%.xml: xep-%.xml $(XMLDEPS) ref.xsl $(REFSDIR)
95 102
 	xsltproc --path $(CURDIR) ref.xsl "$<" > "$@" && echo "Finished building $@"
96 103
 
97
-$(all_xep_htmls): $(OUTDIR)/%.html: %.xml $(XMLDEPS) $(HTMLDEPS)
98
-	# we don’t put it as a dependency to avoid a rebuild due to a timestamp
99
-	# change on the directory
100
-	mkdir -p $(OUTDIR)/inbox
104
+$(xep_htmls): $(OUTDIR)/xep-%.html: xep-%.xml $(XMLDEPS) $(HTMLDEPS)
105
+	xmllint --nonet --noout --noent --loaddtd --valid "$<"
106
+	# Check for non-data URIs
107
+	! xmllint --nonet --noout --noent --loaddtd --xpath "//img/@src[not(starts-with(., 'data:'))]" $< 2>/dev/null && true
108
+
109
+	# Actually build the HTML
110
+	xsltproc --path $(CURDIR) --param htmlbase "$(if $(findstring inbox,$<),'../','./')" xep.xsl "$<" > "$@" && echo "Finished building $@"
101 111
 
112
+$(proto_xep_htmls): $(OUTDIR)/inbox/%.html: inbox/%.xml $(XMLDEPS) $(proto_HTMLDEPS)
102 113
 	xmllint --nonet --noout --noent --loaddtd --valid "$<"
103 114
 	# Check for non-data URIs
104 115
 	! xmllint --nonet --noout --noent --loaddtd --xpath "//img/@src[not(starts-with(., 'data:'))]" $< 2>/dev/null && true
@@ -130,7 +141,13 @@ $(JSTARGETS): $(OUTDIR)
130 141
 $(CSSTARGETS): $(OUTDIR)
131 142
 	cp "$(notdir $@)" "$@"
132 143
 
133
-$(EXAMPLESDIR) $(REFSDIR) $(OUTDIR):
144
+$(proto_JSTARGETS): $(OUTDIR)/inbox
145
+	cp "$(notdir $@)" "$@"
146
+
147
+$(proto_CSSTARGETS): $(OUTDIR)/inbox
148
+	cp "$(notdir $@)" "$@"
149
+
150
+$(EXAMPLESDIR) $(REFSDIR) $(OUTDIR) $(OUTDIR)/inbox:
134 151
 	mkdir -p "$@"
135 152
 
136 153
 .PHONY: clean

+ 0
- 1
xep.xsl View File

@@ -40,7 +40,6 @@ 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>
44 43
         <link rel='stylesheet' type='text/css' href='xmpp.css' />
45 44
         <link href="prettify.css" type="text/css" rel="stylesheet" />
46 45
         <link rel='shortcut icon' type='image/x-icon' href='/favicon.ico' />

Loading…
Cancel
Save