docs: use lynx to produce better formatted text from markdown
PATCH v3 1/1 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 <[email protected]>
docs/Docs.mk +1 -0
@@ -10,3 +10,4 @@ POD2TEXT := pod2text DOT := dot NEATO := neato MARKDOWN := markdown +LYNX := lynx
docs/Makefile +11 -3
@@ -131,9 +131,17 @@ txt/%.txt: %.txt $(call move-if-changed,[email protected],$@) txt/%.txt: %.markdown - $(INSTALL_DIR) $(@D) - cp $< [email protected] - $(call move-if-changed,[email protected],$@) + @$(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 > [email protected] ; \ + $(call move-if-changed,[email protected],$@) ; \ + else \ + echo "markdown or lynx not installed; just copying $<."; \ + cp $< $@; \ + fi txt/man/%.1.txt: man/%.pod.1 Makefile $(INSTALL_DIR) $(@D)