Makefile: Use asciidoc and Pandoc to generate MediaWiki doc versions pandoc-mediawiki
authorW. Trevor King <wking@tremily.us>
Thu, 30 Jan 2014 00:16:56 +0000 (16:16 -0800)
committerW. Trevor King <wking@tremily.us>
Sat, 14 Jun 2014 15:58:26 +0000 (08:58 -0700)
We need this because hosting content under:

  https://www.gentoo.org/proj/

is deprecated, with per-project documentation migrating to the wiki [1]

* `--attribute 'toc!'` disables AsciiDoc's table of contents [2],
  which Pandoc doesn't like.
* The Pandoc invocation is about as basic as it gets [3].

[1]: https://wiki.gentoo.org/wiki/Gentoo_Wiki:Developer_Central/Project_pages#Migration_from_www.gentoo.org.2Fproj.2F
[2]: http://asciidoc.org/userguide.html#X91
[3]: http://johnmacfarlane.net/pandoc/README.html#using-pandoc

Makefile

index 757113c5694e0cdb66e8b2ad72944f0a510fc657..63cbc0b117f94fc1299d63940686f7d5b238cdce 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -8,6 +8,7 @@ MAN_PAGE_INCLUDES = doc/subarches.generated.txt doc/targets.generated.txt
 DOC_SOURCES = $(filter-out $(MAN_PAGE_SOURCES) $(MAN_PAGE_INCLUDES),$(wildcard doc/*.txt))
 DOCS = $(patsubst doc/%.txt,files/%.html,$(DOC_SOURCES))
 DOC_SIDE_EFFECTS  = files/docbook-xsl.css
+MEDIAWIKI_DOCS = $(patsubst files/%.html, wiki/%.mw, $(DOCS))
 EXTRA_DIST = $(MAN_PAGES) $(DOCS) $(DOC_SIDE_EFFECTS)
 GENERATED_FILES = $(MAN_PAGES) $(MAN_PAGE_INCLUDES) $(DOCS) $(DOC_SIDE_EFFECTS)
 
@@ -16,6 +17,8 @@ distdir = catalyst-$(PACKAGE_VERSION)
 
 all: $(EXTRA_DIST)
 
+mediawiki: $(MEDIAWIKI_DOCS)
+
 $(MAN_PAGES): files/%: doc/%.txt doc/asciidoc.conf Makefile catalyst
        a2x --conf-file=doc/asciidoc.conf --attribute="catalystversion=$(PACKAGE_VERSION)" \
                 --format=manpage -D files "$<"
@@ -34,6 +37,16 @@ $(DOCS): files/%.html: doc/%.txt doc/asciidoc.conf Makefile
        a2x --conf-file=doc/asciidoc.conf --attribute="catalystversion=$(PACKAGE_VERSION)" \
                 --format=xhtml -D files "$<"
 
+wiki/%.html: doc/%.txt doc/asciidoc.conf Makefile | wiki
+       a2x --conf-file=doc/asciidoc.conf --attribute="catalystversion=$(PACKAGE_VERSION)" \
+                --format=xhtml --attribute 'toc!' -D wiki "$<"
+
+wiki/%.mw: wiki/%.html
+       pandoc -f html -t mediawiki -o "$@" "$<"
+
+wiki:
+       mkdir -p wiki
+
 $(DOC_SIDE_EFFECTS): $(firstword $(DOCS))
 
 clean: