Matt Wilson
2012-Jul-31 15:39 UTC
[PATCH DOCDAY v3] docs: use lynx to produce better formatted text from markdown
Markdown, while easy to read and write, isn''t the most consumable format for users reading documentation on a terminal. This patch uses lynx to format markdown produced HTML into text files. Changes since v3: * remove bogus "html/%.txt: %.txt" rule Signed-off-by: Matt Wilson <msw@amazon.com> diff -r 1809175cdc9b -r c3faef18d97d docs/Docs.mk --- a/docs/Docs.mk Mon Jul 30 19:04:59 2012 +0000 +++ b/docs/Docs.mk Mon Jul 30 19:33:41 2012 +0000 @@ -10,3 +10,4 @@ POD2TEXT := pod2text DOT := dot NEATO := neato MARKDOWN := markdown +LYNX := lynx diff -r 1809175cdc9b -r c3faef18d97d docs/Makefile --- a/docs/Makefile Mon Jul 30 19:04:59 2012 +0000 +++ b/docs/Makefile Mon Jul 30 19:33:41 2012 +0000 @@ -131,9 +131,17 @@ txt/%.txt: %.txt $(call move-if-changed,$@.tmp,$@) txt/%.txt: %.markdown - $(INSTALL_DIR) $(@D) - cp $< $@.tmp - $(call move-if-changed,$@.tmp,$@) + @$(INSTALL_DIR) $(@D) + @set -e ; \ + if which $(MARKDOWN) >/dev/null 2>&1 && \ + which $(LYNX) >/dev/null 2>&1 ; then \ + echo "Running markdown to generate $*.txt ... "; \ + $(MARKDOWN) $< | lynx -dump -stdin > $@.tmp ; \ + $(call move-if-changed,$@.tmp,$@) ; \ + else \ + echo "markdown or lynx not installed; just copying $<."; \ + cp $< $@; \ + fi txt/man/%.1.txt: man/%.pod.1 Makefile $(INSTALL_DIR) $(@D)