use lynx to produce better formatted text documentation from markdown
PATCH 1/1 use lynx to produce better formatted text documentation 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.
docs/Docs.mk +1 -0
@@ -10,3 +10,4 @@ POD2TEXT := pod2text DOT := dot NEATO := neato MARKDOWN := markdown +LYNX := lynx
docs/Makefile +21 -4
@@ -103,7 +103,16 @@ html/%.html: %.markdown html/%.txt: %.txt @$(INSTALL_DIR) $(@D) - cp $< $@ + @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 html/man/%.1.html: man/%.pod.1 Makefile $(INSTALL_DIR) $(@D)
@@ -131,9 +140,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)
Quoted 3 lines · Matt Wilson
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.
The markdown syntax is supposed to be readable as plain text too, if there are particular instances where this is not the case perhaps we can tidy them up with that in mind?
Why wouldn't you just run lynx on the generated .html instead of less on the generated .txt if you wanted something a bit better formatted?
Quoted 19 lines
Signed-off-by Matt Wilson <[email protected]>diff -r
c3a6e679bdfa-ref1271aef866docs/Docs.mkdocs/Docs.mk +1
-0@@ -10,3 +10,4 @@ POD2TEXT := pod2text DOT := dot NEATO := neato MARKDOWN := markdown +LYNX := lynxdiff -r
c3a6e679bdfa-ref1271aef866docs/Makefiledocs/Makefile +0
-1@@ -103,7 +103,16 @@ html/%.html: %.markdown html/%.txt: %.txt @$(INSTALL_DIR) $(@D) - cp $< $@
docs/Makefile html/%.html: %.markdown · line 115
Quoted 10 lines
docs/Makefile +10
-0+ @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
Does formatting a non-markdown .txt file like this produce reasonable results for all the random ASCII formatting used under misc?
Quoted 28 lines
docs/Makefile +11
-3html/man/%.1.html: man/%.pod.1 Makefile $(INSTALL_DIR) $(@D)@@ -131,9 +140,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)_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 8 lines · Ian Campbell
Quoted 3 lines · Matt Wilson
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.
The markdown syntax is supposed to be readable as plain text too, if there are particular instances where this is not the case perhaps we can tidy them up with that in mind?
I'm not sure how much the markdown can be tidied for constructs like:
### apic
Quoted 1 line
= summit | bigsmp | default
Override Xen's logic for choosing the APIC driver. By default, if there are more than 8 CPUs, Xen will switch to bigsmp over default.
### allow\_unsafe
Quoted 3 lines
= <boolean>Default:
false
Force boot on potentially unsafe systems. By default Xen will refuse to boot on systems with the following errata:
* AMD Erratum 121. Processors with this erratum are subject to a guest triggerable Denial of Service. Override only if you trust all of your PV guests.
When processed as I propose, it looks like:
apic
= summit | bigsmp | default
Override Xen's logic for choosing the APIC driver. By default, if there are more than 8 CPUs, Xen will switch to bigsmp over default.
allow_unsafe
= <boolean>
Default: false Force boot on potentially unsafe systems. By default Xen will refuse to boot on systems with the following errata:
* AMD Erratum 121. Processors with this erratum are subject to a guest triggerable Denial of Service. Override only if you trust all of your PV guests.
Quoted 2 lines
Why wouldn't you just run lynx on the generated .html instead of less on the generated .txt if you wanted something a bit better formatted?
I generally don't have lynx installed on my production machines.
Quoted 15 lines
Quoted 15 lines
Signed-off-by Matt Wilson <[email protected]>diff -r
c3a6e679bdfa-ref1271aef866docs/Docs.mkdocs/Docs.mk +1
-0@@ -10,3 +10,4 @@ POD2TEXT := pod2text DOT := dot NEATO := neato MARKDOWN := markdown +LYNX := lynxdiff -r
c3a6e679bdfa-ref1271aef866docs/Makefiledocs/Makefile +0
-0@@ -103,7 +103,16 @@ html/%.html: %.markdown
Quoted 16 lines
docs/Makefile html/%.html: %.markdown · line 115
Quoted 13 lines
docs/Makefile +10
-1html/%.txt: %.txt @$(INSTALL_DIR) $(@D) - cp $< $@ + @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 $< $@; \ + fiDoes formatting a non-markdown .txt file like this produce reasonable results for all the random ASCII formatting used under misc?
Oops, sorry. This is bogus. I'll resubmit with it removed.
Matt
Quoted 30 lines
Quoted 28 lines
docs/Makefile +11
-3html/man/%.1.html: man/%.pod.1 Makefile $(INSTALL_DIR) $(@D)@@ -131,9 +140,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)_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 53 lines · Matt Wilson
Quoted 8 lines · Ian Campbell
Quoted 3 lines · Matt Wilson
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.
The markdown syntax is supposed to be readable as plain text too, if there are particular instances where this is not the case perhaps we can tidy them up with that in mind?
I'm not sure how much the markdown can be tidied for constructs like:
### apic
Quoted 1 line
= summit | bigsmp | defaultOverride Xen's logic for choosing the APIC driver. By default, if there are more than 8 CPUs, Xen will switch to
bigsmpoverdefault.### allow\_unsafe
Quoted 3 lines
= <boolean>Default:
falseForce boot on potentially unsafe systems. By default Xen will refuse to boot on systems with the following errata:
* AMD Erratum 121. Processors with this erratum are subject to a guest triggerable Denial of Service. Override only if you trust all of your PV guests.
When processed as I propose, it looks like:
apic
= summit | bigsmp | default
Override Xen's logic for choosing the APIC driver. By default, if there are more than 8 CPUs, Xen will switch to bigsmp over default.
allow_unsafe= <boolean> Default: falseForce boot on potentially unsafe systems. By default Xen will refuse to boot on systems with the following errata:
* AMD Erratum 121. Processors with this erratum are subject to a guest triggerable Denial of Service. Override only if you trust all of your PV guests.
Quoted 4 lines
Quoted 2 lines
Why wouldn't you just run lynx on the generated .html instead of less on the generated .txt if you wanted something a bit better formatted?
I generally don't have lynx installed on my production machines.
Ian,
Any further concerns?
Matt
Quoted 71 lines
Quoted 15 lines
Quoted 15 lines
Signed-off-by Matt Wilson <[email protected]>diff -r
c3a6e679bdfa-ref1271aef866docs/Docs.mkdocs/Docs.mk +1
-0@@ -10,3 +10,4 @@ POD2TEXT := pod2text DOT := dot NEATO := neato MARKDOWN := markdown +LYNX := lynxdiff -r
c3a6e679bdfa-ref1271aef866docs/Makefiledocs/Makefile +0
-0@@ -103,7 +103,16 @@ html/%.html: %.markdownQuoted 16 lines
docs/Makefile html/%.html: %.markdown · line 115
Quoted 13 lines
docs/Makefile +10
-1html/%.txt: %.txt @$(INSTALL_DIR) $(@D) - cp $< $@ + @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 $< $@; \ + fiDoes formatting a non-markdown .txt file like this produce reasonable results for all the random ASCII formatting used under misc?
Oops, sorry. This is bogus. I'll resubmit with it removed.
Matt
Quoted 21 lines
Quoted 21 lines
docs/Makefile +11
-3html/man/%.1.html: man/%.pod.1 Makefile $(INSTALL_DIR) $(@D)@@ -131,9 +140,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 $< $@; \ + fiQuoted 9 lines
Quoted 7 lines
docs/Makefile +0
-0txt/man/%.1.txt: man/%.pod.1 Makefile $(INSTALL_DIR) $(@D)_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 5 lines · Matt Wilson
Quoted 4 lines · Matt Wilson
Quoted 2 lines
Why wouldn't you just run lynx on the generated .html instead of less on the generated .txt if you wanted something a bit better formatted?
I generally don't have lynx installed on my production machines.
You can read it on your workstation or on line at
http://xenbits.xen.org/docs/unstable/misc/xen-command-line.html
Quoted 1 line
Any further concerns?
I'm afraid I just don't see the point. The plain markdown docs are serviceable enough, if not great, and there are plenty of ways to view the html docs both on and off line if you want something prettier, without adding a web browser to our build dependencies.
Ian.
Quoted 10 lines · Ian Campbell
Quoted 5 lines · Matt Wilson
Quoted 4 lines · Matt Wilson
Quoted 2 lines
Why wouldn't you just run lynx on the generated .html instead of less on the generated .txt if you wanted something a bit better formatted?
I generally don't have lynx installed on my production machines.
You can read it on your workstation or on line at
http://xenbits.xen.org/docs/unstable/misc/xen-command-line.html
Quoted 6 lines
Quoted 1 line
Any further concerns?
I'm afraid I just don't see the point. The plain markdown docs are serviceable enough, if not great, and there are plenty of ways to view the html docs both on and off line if you want something prettier, without adding a web browser to our build dependencies.
I'm certainly not suggesting that we add a web browser to the build dependencies. If lynx isn't installed, the current behavior of copying the markdown file is maintained.
If a packager wishes to produce prettier text documentation, they can elect to add lynx to their build dependencies. Today doing this post-build from build control files is a bit tricky, since we drop the semantic information conveyed by the .markdown suffix by calling the final file .txt.
4.2 will be the first release with markdown documentation. I think that making it well formatted, just as the previous .txt documentation, will be a better experience for the user.
Matt
Matt Wilson writes ("Re: [Xen-devel] [PATCH DOCDAY] use lynx to produce better formatted text documentation from markdown"):
Quoted 10 lines
I'm certainly not suggesting that we add a web browser to the build dependencies. If lynx isn't installed, the current behavior of copying the markdown file is maintained.
If a packager wishes to produce prettier text documentation, they can elect to add lynx to their build dependencies. Today doing this post-build from build control files is a bit tricky, since we drop the semantic information conveyed by the .markdown suffix by calling the final file .txt.
Quoted 3 lines
4.2 will be the first release with markdown documentation. I think that making it well formatted, just as the previous .txt documentation, will be a better experience for the user.
I tend to agree with this line of argument. But I have orthogonal queries:
Firstly, why lynx and not w3m ? Is lynx even maintained upstream any more ? Secondly, shouldn't we do the testing for the presence of markdown and the html formatter in configure ?
Ian.
Quoted 15 lines · Ian Jackson
Matt Wilson writes ("Re: [Xen-devel] [PATCH DOCDAY] use lynx to produce better formatted text documentation from markdown"):
Quoted 10 lines
I'm certainly not suggesting that we add a web browser to the build dependencies. If lynx isn't installed, the current behavior of copying the markdown file is maintained.
If a packager wishes to produce prettier text documentation, they can elect to add lynx to their build dependencies. Today doing this post-build from build control files is a bit tricky, since we drop the semantic information conveyed by the .markdown suffix by calling the final file .txt.
Quoted 3 lines
4.2 will be the first release with markdown documentation. I think that making it well formatted, just as the previous .txt documentation, will be a better experience for the user.
Quoted 6 lines
I tend to agree with this line of argument. But I have orthogonal queries:
Firstly, why lynx and not w3m ? Is lynx even maintained upstream any more ? Secondly, shouldn't we do the testing for the presence of markdown and the html formatter in configure ?
I suppose links or w3m work equally well. I tend to personally like links' formatting over w3m. The last lynx development release was in 2010, whereas the latest links release was June 26, 2012. The latest w3m release was in January 2011.
Adding these checks in configure is a good idea. It's a good method of communicating the tools that can be or must be present for a successful build of the auxiliary pieces of Xen.
Unfortunately I lost the build environment I set up that has the correct version of autoconf, etc. so it might take a few days before I can cook up a new version that adds autoconf checks.
Thanks for the suggestions.
Matt