[build-path-prefix-map-spec] 43/50: Use pandoc to generate DocBook HTML output
Ximin Luo
infinity0 at debian.org
Fri Mar 10 15:17:23 UTC 2017
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch master
in repository build-path-prefix-map-spec.
commit c348e7d3e266c364cf0fb15c35891ee76fc22fc4
Author: Ximin Luo <infinity0 at debian.org>
Date: Fri Feb 24 19:25:55 2017 +0100
Use pandoc to generate DocBook HTML output
---
Makefile | 13 +++++++------
spec-main.rst | 8 ++++----
spec.t.xml | 37 +++++++++++++++++++++++++++++++++++++
spec.xsl | 22 ++++++++++++++++++++++
4 files changed, 70 insertions(+), 10 deletions(-)
diff --git a/Makefile b/Makefile
index b0e69b9..9d0c991 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,11 @@
all: spec.html
-%.html: %.rst %.css
- rst2html5 --stylesheet minimal.css,"$*.css" "$<" > "$@"
+%.xml: %.rst %.t.xml
+ # ain't nobody got time to manually type XML tags
+ pandoc --template "$*.t.xml" -s "$<" -t docbook > "$@"
+
+%.html: %.xml %.xsl
+ xmlto -x "$*.xsl" html-nochunks "$<"
spec.rst: spec-main.rst spec-testcases.rst
cat $^ > "$@"
@@ -14,9 +18,6 @@ consume/$(T):
spec-testcases.rst: consume/testcases-pecsplit.rst
cp "$<" "$@"
-spec.css: consume/testcases-rst.css
- cp "$<" "$@"
-
.PHONY: clean
clean:
- rm -f *.html spec.css spec-testcases.rst spec.rst
+ rm -f *.html spec-testcases.rst spec.rst
diff --git a/spec-main.rst b/spec-main.rst
index 9150cf4..3e1bb86 100644
--- a/spec-main.rst
+++ b/spec-main.rst
@@ -81,23 +81,23 @@ The encoding is as follows:
Our recommended approach for a high-level language with string replace:
- A. decoding:
+ A. Decoding:
1. check elem does not match the regex ``/%[^#+.]|%$/g``, then
2. ``elem.replace("%.", ":").replace("%+", "=").replace("%#", "%")``
- B. encoding:
+ B. Encoding:
1. ``elem.replace("%#", "%").replace("%+", "=").replace("%.", ":")``
Our recommended approach for a low-level language without string replace:
- A. decoding:
+ A. Decoding:
- one single left-to-right pass with lookahead (e.g. our C example), or
- one single left-to-right pass with lookbehind (e.g. our Rust example)
- B. encoding:
+ B. Encoding:
- We don't anticipate this to be a major use-case
diff --git a/spec.t.xml b/spec.t.xml
new file mode 100644
index 0000000..e907a4c
--- /dev/null
+++ b/spec.t.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8" ?>
+$if(comment)$
+<!-- This template was generated with `pandoc -D docbook` then hand-edited -->
+$endif$
+$if(mathml)$
+<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook EBNF Module V1.1CR1//EN"
+ "http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd">
+$else$
+<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
+$endif$
+<article>
+ <articleinfo>
+ <title><envar>BUILD_PATH_PREFIX_MAP</envar> specification</title>
+ <revhistory>
+ <revision>
+ <revnumber>1.0-DRAFT-DO-NOT-USE-YET</revnumber>
+ <date>24 February 2017</date>
+ <revremark>Initial version.</revremark>
+ </revision>
+ </revhistory>
+ <author>
+ <firstname>Ximin</firstname>
+ <surname>Luo</surname>
+ <affiliation>
+ <address><email>infinity0 at debian.org</email></address>
+ </affiliation>
+ </author>
+ </articleinfo>
+$for(include-before)$
+$include-before$
+$endfor$
+$body$
+$for(include-after)$
+$include-after$
+$endfor$
+</article>
diff --git a/spec.xsl b/spec.xsl
new file mode 100644
index 0000000..96f5270
--- /dev/null
+++ b/spec.xsl
@@ -0,0 +1,22 @@
+<?xml version='1.0'?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+<xsl:import href="/usr/share/xml/docbook/stylesheet/docbook-xsl/html/docbook.xsl"/>
+<xsl:template name="user.head.content">
+<style type="text/css">
+/* make compact lists actually compact */
+.compact li.listitem p {
+ margin: 0;
+}
+/* in the test vectors, make verbatim output aligned with the "output is same as" text */
+blockquote.blockquote, pre.programlisting {
+ margin: auto 40px;
+}
+/* word-wrap long code literals */
+code.literal {
+ white-space: normal;
+ word-break: break-all;
+}
+</style>
+</xsl:template>
+<xsl:output method="html" encoding="utf-8"/>
+</xsl:stylesheet>
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/build-path-prefix-map-spec.git
More information about the Reproducible-commits
mailing list