base: Makefiles and default files added
authorFredrik Unger <fred@tree.se>
Wed, 31 Jul 2013 08:54:26 +0000 (10:54 +0200)
committerFredrik Unger <fred@tree.se>
Wed, 31 Jul 2013 08:54:26 +0000 (10:54 +0200)
Two Makefiles that recursively scans and build each tag subdirectory
with the availible style sheets.

Default style sheets to simplify adding the external Docbook stylesheet
from the tag subdirectories.

Makefile [new file with mode: 0644]
Makefile.tag [new file with mode: 0644]
default.html.xsl [new file with mode: 0644]
default.pdf.xsl [new file with mode: 0644]

diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..0f658bf
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,19 @@
+### Makefile ---
+
+## Author: Fredrik Unger <fred@tree.se>
+
+TAGS=$(shell find . -type d -regex './[a-z]+')
+clean_TAGS=$(addprefix clean_,$(TAGS))
+
+all: $(TAGS)
+clean: $(clean_TAGS)
+
+.PHONY: $(TAGS) $(clean_TAGS)
+
+$(TAGS):
+       make -f ../Makefile.tag -C $@
+
+$(clean_TAGS):
+       make -f ../Makefile.tag -C $(patsubst clean_%,%,$@) clean
+
+### Makefile ends here
diff --git a/Makefile.tag b/Makefile.tag
new file mode 100644 (file)
index 0000000..4dbeb78
--- /dev/null
@@ -0,0 +1,46 @@
+### Makefile ---
+
+## Author: Fredrik Unger <fred@tree.se>
+
+EXAMPLE_HTML=$(shell find . -type f -name '*.html.xsl')
+HTML_FILES=$(patsubst %.html.xsl, %.html, $(EXAMPLE_HTML))
+HTML_PNG_FILES=$(patsubst %.html.xsl, %.html.png, $(EXAMPLE_HTML))
+
+EXAMPLE_PDF=$(shell find . -type f -name '*.pdf.xsl')
+PDF_FILES=$(patsubst %.pdf.xsl, %.pdf, $(EXAMPLE_PDF))
+PDF_PNG_FILES=$(patsubst %.pdf.xsl, %.pdf.png, $(EXAMPLE_PDF))
+
+DEFAULT_FILES=default.html default.html.png default.pdf default.pdf.png
+
+all: $(HTML_FILES) $(HTML_PNG_FILES) $(PDF_FILES) $(PDF_PNG_FILES) $(DEFAULT_FILES)
+
+%.html.png: %.html
+       python -m SimpleHTTPServer 8000 & echo "$$!" > server.pid
+       sleep 1
+       cutycapt --url=http://localhost:8000/"$<" --out="$@"
+       kill `cat server.pid`
+       rm server.pid
+
+%.pdf.png: %.pdf
+       convert "$<" "$@"
+
+default.html: ../default.html.xsl example.xml
+       xsltproc --xinclude --output "$@" "$<" example.xml
+
+default.pdf:  ../default.pdf.xsl example.xml
+       xsltproc --xinclude --output ex.fo "$<" example.xml
+       fop ex.fo "$@"
+       rm ex.fo
+
+%.html: %.html.xsl example.xml
+       xsltproc --xinclude --output "$@" "$<" example.xml
+
+%.pdf:  %.pdf.xsl example.xml
+       xsltproc --xinclude --output ex.fo "$<" example.xml
+       fop ex.fo "$@"
+       rm ex.fo
+
+clean:
+       rm -f *~ server.pid ex.fo $(HTML_FILES) $(HTML_PNG_FILES) $(PDF_FILES) $(PDF_PNG_FILES) $(DEFAULT_FILES)
+
+### Makefile ends here
diff --git a/default.html.xsl b/default.html.xsl
new file mode 100644 (file)
index 0000000..8feb2a8
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet version="1.0" xmlns="http://www.w3.org/1999/xhtml"
+               xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+               xmlns:d="http://docbook.org/ns/docbook">
+
+<xsl:import href="file:///usr/share/xml/docbook/stylesheet/docbook-xsl-ns/html/docbook.xsl"/>
+
+</xsl:stylesheet>
diff --git a/default.pdf.xsl b/default.pdf.xsl
new file mode 100644 (file)
index 0000000..ff489ed
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet version="1.0" xmlns="http://www.w3.org/1999/xhtml"
+               xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+               xmlns:d="http://docbook.org/ns/docbook">
+
+<xsl:import href="file:///usr/share/xml/docbook/stylesheet/docbook-xsl-ns/fo/docbook.xsl"/>
+
+</xsl:stylesheet>