Convert man page source to asciidoc
Phil Sutter
reviewerRFC PATCH 1/1 Convert man page source to asciidoc
Beware: The conversion is incomplete and merely serves as base for discussion.
This patch converts nft.xml into asciidoc markup, top down until (and including) stateful objects description. I stopped there because it's the first chance of demonstrating my idea of splitting the documentation into smaller pieces for convenience and maintainability.
Regarding package dependencies, this "just" exchanges docbook with asciidoc - dblatex is still required for PDF creation.
The conversion is a bit inconsequent regarding synopsis sections: I didn't keep the old (somewhat broken) syntax completely but also didn't fix up the previously identified shortcomings.
--- configure.ac | 16 +- doc/Makefile.am | 19 +- doc/nft.txt | 490 +++++ doc/nft.xml | 5139 --------------------------------------------------- doc/sfo-counter.txt | 16 + doc/sfo-ct.txt | 40 + doc/sfo-quota.txt | 17 + 7 files changed, 580 insertions(+), 5157 deletions(-) create mode 100644 doc/nft.txt delete mode 100644 doc/nft.xml create mode 100644 doc/sfo-counter.txt create mode 100644 doc/sfo-ct.txt create mode 100644 doc/sfo-quota.txt
configure.ac +4 -12
@@ -56,23 +56,15 @@ then exit 1 fi -AC_CHECK_PROG(DOCBOOK2X_MAN, [docbook2x-man], [docbook2x-man], [no]) -AC_CHECK_PROG(DOCBOOK2MAN, [docbook2man], [docbook2man], [no]) -AC_CHECK_PROG(DB2X_DOCBOOK2MAN, [db2x_docbook2man], [db2x_docbook2man], [no]) -AS_IF([test "$DOCBOOK2X_MAN" != "no"], [DB2MAN="$DOCBOOK2X_MAN"], - [AS_IF([test "$DOCBOOK2MAN" != "no"], [DB2MAN="$DOCBOOK2MAN"], - [AS_IF([test "$DB2X_DOCBOOK2MAN" != "no"], [DB2MAN="$DB2X_DOCBOOK2MAN"], - [AC_MSG_WARN([docbookx2-man/db2x_docbook2man not found, no manpages will be built])] - )] - )] -) -AC_SUBST(DB2MAN) -AM_CONDITIONAL([BUILD_MAN], [test -n "$DB2MAN"]) +AC_CHECK_PROG(A2X, [a2x], [a2x]) +AM_CONDITIONAL([BUILD_MAN], [test -n "$A2X"]) AM_COND_IF([BUILD_PDF], [ AC_CHECK_PROG(DBLATEX, [dblatex], [found], [no]) AS_IF([test "$DBLATEX" == "no"], [AC_MSG_ERROR([dblatex not found])]) + AS_IF([test -z "$A2X"], + [AC_MSG_ERROR([a2x not found])]) ]) # Checks for libraries.
doc/Makefile.am +13 -6
@@ -6,14 +6,21 @@ if BUILD_PDF pdf_DATA = nft.pdf endif +ASCIIDOC_MAIN = nft.txt +ASCIIDOC_INCLUDES = \ + sfo-counter.txt \ + sfo-ct.txt \ + sfo-quota.txt +ASCIIDOCS = ${ASCIIDOC_MAIN} ${ASCIIDOC_INCLUDES} + pdfdir=${docdir}/pdf -.xml.pdf: - ${AM_V_GEN}dblatex -q -t pdf -o $@ $< +nft.8: ${ASCIIDOCS} + ${AM_V_GEN}${A2X} --doctype manpage --format manpage ${ASCIIDOC_MAIN} -.xml.8: - ${AM_V_GEN}${DB2MAN} --xinclude $< +nft.pdf: ${ASCIIDOCS} + ${AM_V_GEN}${A2X} --doctype manpage --format pdf ${ASCIIDOC_MAIN} -EXTRA_DIST = nft.xml +EXTRA_DIST = ${ASCIIDOCS} -CLEANFILES = nft.pdf nft.8 *~ +CLEANFILES = nft.xml nft.pdf nft.8 *~
doc/nft.txt new file +490 -0
490 lines not on this page · raw message
doc/nft.xml deleted +0 -5139
2,456 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.13.1
Part of the diff is not shown here. View the raw message.
Quoted 11 lines · Phil Sutter
Beware: The conversion is incomplete and merely serves as base for discussion.
This patch converts nft.xml into asciidoc markup, top down until (and including) stateful objects description. I stopped there because it's the first chance of demonstrating my idea of splitting the documentation into smaller pieces for convenience and maintainability.
Regarding package dependencies, this "just" exchanges docbook with asciidoc - dblatex is still required for PDF creation.
Hi Phil,
thanks for your initiative and hard work, it's really appreciated :-)
Regarding the change, why asciidoc? why not markdown, or org-mode or reStructuredText?
There are many markup languages, it reminds me to xkcd #927 [0]. I would prefer if we stick to groff, which seems to be the standard in Linux.
Regarding the separation of text in different includes, why not creating different manpages?
Netfilter did this in the past with iptables(8) and iptables-extensions(8).
Brainstorming:
* nft(8) <-- main document, general info
* nft-ct(8) <-- concrete info for ct objects
* nft-counter(8) <-- concrete info for counter objets
* nft-flowtables(8) <-- about flow tables
* nft-quota(8) <--- concrete info for quotas
* nft-performance(8) <--- concrete info about nftables sets, maps, dicts, concatenations, etc.
* nft-ha(8) <--- for HA environments, loadbalancing etc
Pablo Neira Ayuso
maintainerHi Arturo,
Quoted 13 lines · Arturo Borrero Gonzalez
Quoted 11 lines · Phil Sutter
Beware: The conversion is incomplete and merely serves as base for discussion.
This patch converts nft.xml into asciidoc markup, top down until (and including) stateful objects description. I stopped there because it's the first chance of demonstrating my idea of splitting the documentation into smaller pieces for convenience and maintainability.
Regarding package dependencies, this "just" exchanges docbook with asciidoc - dblatex is still required for PDF creation.
Quoted 8 lines
Hi Phil,
thanks for your initiative and hard work, it's really appreciated :-)
Regarding the change, why asciidoc? why not markdown, or org-mode or reStructuredText?
There are many markup languages, it reminds me to xkcd #927 [0]. I would prefer if we stick to groff, which seems to be the standard in Linux.
Not willing to create a large thread debating what markup language choice is better here, but I think asciidoc is a reasonable option.
Quoted 4 lines
Regarding the separation of text in different includes, why not creating different manpages?
Netfilter did this in the past with iptables(8) and iptables-extensions(8).
Quoted 9 lines
Brainstorming:
* nft(8) <-- main document, general info
* nft-ct(8) <-- concrete info for ct objects
* nft-counter(8) <-- concrete info for counter objets
* nft-flowtables(8) <-- about flow tables
* nft-quota(8) <--- concrete info for quotas
* nft-performance(8) <--- concrete info about nftables sets, maps, dicts, concatenations, etc.
* nft-ha(8) <--- for HA environments, loadbalancing etc
Splitting manpage is a sensible option if we consider it's getting too large, we can do this in incremental steps after the conversion.
Cheers.
Quoted 4 lines · Arturo Borrero Gonzalez
Regarding the separation of text in different includes, why not creating different manpages? Netfilter did this in the past with iptables(8) and iptables-extensions(8).
The split into iptables-extensions.8 happened not because of size or topic, but because iptables.8 and ip6tables.8 had redundant copies of numerous sections of each other, and they sometimes were quite small sections too (for this reason, it only has 9 manuals in total, not 96).
Quoted 3 lines
Brainstorming:
* nft-performance(8) <--- concrete info about nftables sets, maps, dicts, concatenations, etc.
those seem more like "datatypes" than "performance".
Phil Sutter
reviewerHi Arturo,
Quoted 9 lines · Arturo Borrero Gonzalez
Quoted 8 lines · Phil Sutter
Beware: The conversion is incomplete and merely serves as base for discussion.
This patch converts nft.xml into asciidoc markup, top down until (and including) stateful objects description. I stopped there because it's the first chance of demonstrating my idea of splitting the documentation into smaller pieces for convenience and maintainability.
Quoted 7 lines
Quoted 3 lines
Regarding package dependencies, this "just" exchanges docbook with asciidoc - dblatex is still required for PDF creation.
Hi Phil,
thanks for your initiative and hard work, it's really appreciated :-)
Thanks!
Quoted 2 lines
Regarding the change, why asciidoc? why not markdown, or org-mode or reStructuredText?
Well, asciidoc is basicaly markdown on steroids, I fear we'll soon miss features if we stuck to plain markdown. Also see this URL for a
comparison: [1].
I tend to ignore org-mode because I'm not an emacs user, and I guess about 50% of (potential) nftables contributors feel the same about that. :)
Regarding reStructuredText, did you look at how tables are written there? If not, see here[2]. I really think that speaks for itself.
Quoted 1 line
There are many markup languages, it reminds me to xkcd #927 [0].
Well, the difference here is that I'm not inventing anything new but search for better options amongst the existing solutions. :P
Quoted 1 line
I would prefer if we stick to groff, which seems to be the standard in Linux.
Yes, this is the very basic alternative but as said I think providing users with an easier to use markup makes sense.
Quoted 4 lines
Regarding the separation of text in different includes, why not creating different manpages?
Netfilter did this in the past with iptables(8) and iptables-extensions(8).
Quoted 9 lines
Brainstorming:
* nft(8) <-- main document, general info
* nft-ct(8) <-- concrete info for ct objects
* nft-counter(8) <-- concrete info for counter objets
* nft-flowtables(8) <-- about flow tables
* nft-quota(8) <--- concrete info for quotas
* nft-performance(8) <--- concrete info about nftables sets, maps, dicts, concatenations, etc.
* nft-ha(8) <--- for HA environments, loadbalancing etc
Well, I don't think nft.8's current size requires to split it into smaller files at this point.
Cheers, Phil
[1] https://github.com/asciidoctor/asciidoctor.org/blob/master/docs/_includes/asciidoc-vs-markdown.adoc
[2] http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#tables
Quoted 3 lines · Phil Sutter
Regarding reStructuredText, did you look at how tables are written there? If not, see here[2]. I really think that speaks for itself.
Markup is the least problem. Tables, when rendered, have a tendency to quickly grow too large for the display container because there is just so much data to show.
Knowing that, people just avoid them most of the time for groff - and if I may say so, it has not reduced the document quality.
Quoted 4 lines
Quoted 1 line
There are many markup languages, it reminds me to xkcd #927 [0].
Well, the difference here is that I'm not inventing anything new but search for better options amongst the existing solutions. :P
That would be to stay with docbook then, because RST/MD/A2 do not seem to have left themselves a lot of room for later extension.
Quoted 4 lines
Quoted 1 line
I would prefer if we stick to groff, which seems to be the standard in Linux.
Yes, this is the very basic alternative but as said I think providing users with an easier to use markup makes sense.
Users read the rendered text, not the markup.
All of the glorious old markups are "unreadable" enough to be fed through a program to give a visually-cooked, markup-free rendering (browser, /usr/bin/man, evince, etc.) MediaWiki, RST, MD and asciidoc on the other hand however seem to propagate the use of just cat/less with very short markup, which, to a user, is not too bad to look at, but also not too visually pleasing either, giving the worst of both worlds :-p
Phil Sutter
reviewerHi,
Quoted 8 lines · Jan Engelhardt
Quoted 3 lines · Phil Sutter
Regarding reStructuredText, did you look at how tables are written there? If not, see here[2]. I really think that speaks for itself.
Markup is the least problem. Tables, when rendered, have a tendency to quickly grow too large for the display container because there is just so much data to show.
It really matters if the markup specs suggest to draw ASCII art pictures. The real problem though is that reStructuredText is meant to be read as is and that is not required nor wanted in our case since we generate a man page anyway.
Quoted 2 lines
Knowing that, people just avoid them most of the time for groff - and if I may say so, it has not reduced the document quality.
Right now, nft.8 makes extensive use of tables which is why I considered proper table support an important feature. OTOH I didn't experience rendering issues with them in nft.8, did you?
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
There are many markup languages, it reminds me to xkcd #927 [0].
Well, the difference here is that I'm not inventing anything new but search for better options amongst the existing solutions. :P
That would be to stay with docbook then, because RST/MD/A2 do not seem to have left themselves a lot of room for later extension.
What extensions do you have in mind?
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
I would prefer if we stick to groff, which seems to be the standard in Linux.
Yes, this is the very basic alternative but as said I think providing users with an easier to use markup makes sense.
Users read the rendered text, not the markup.
Yes, you are right of course. I mixed up users with contributors again.
Quoted 6 lines
All of the glorious old markups are "unreadable" enough to be fed through a program to give a visually-cooked, markup-free rendering (browser,
/usr/bin/man, evince, etc.) MediaWiki, RST, MD and asciidoc on the other hand however seem to propagate the use of just cat/less with very short markup, which, to a user, is not too bad to look at, but also not too visually pleasing either, giving the worst of both worlds :-p
Now you seem to mix up users and contributors: I never suggested to provide documentation to users in a different format than roff (rendered by 'man'), but to provide people editing the documentation with something more intuitive than docbook or roff.
Cheers, Phil
Quoted 6 lines · Phil Sutter
Quoted 2 lines
Knowing that, people just avoid them most of the time for groff - and if I may say so, it has not reduced the document quality.
Right now, nft.8 makes extensive use of tables which is why I considered proper table support an important feature. OTOH I didn't experience rendering issues with them in nft.8, did you?
I do. For some reason, the right margin of the table is 60% of the terminal width. (width 120 => table up to col #63, terminal 80 cols => table up to col #50).
┌────────────┬─────────────────────────────────────────┐
│Hook │ Description │
├────────────┼─────────────────────────────────────────┤
│prerouting │ All packets entering the system are │
│ │ processed by the prerouting hook. It is │
│ │ invoked before the routing process and │
│ │ is used for early filtering or changing │
│ │ packet attributes that affect routing. │
├────────────┼─────────────────────────────────────────┤
│input │ Packets delivered to the local system │
│ │ are processed by the input hook. │
├────────────┼─────────────────────────────────────────┤
│forward │ Packets forwarded to a different host │
│ │ are processed by the forward hook. │
├────────────┼─────────────────────────────────────────┤
│output │ Packets sent by local processes are │
│ │ processed by the output hook. │
├────────────┼─────────────────────────────────────────┤
│postrouting │ All packets leaving the system are pro- │
│ │ cessed by the postrouting hook. │
└────────────┴─────────────────────────────────────────┘However, what I tried to express is the problem with tables is that one column has almost no text and another has a lot of it, like this one. This causes large amounts of whitespace in column 1 in this case. Personally, I would have placed the hooks and their explanations as (the equivalent of)
.TP
\fBprerouting\fP
All packets enter ...
.TP
\fBinput\fP
Packets delivered ...
Or if the source material was HTML, perhaps just
<ul>
<li><b>prerouting</b>: All packets enter...</li>
<li><b>input</b>: Packets delivered...</li>
</ul>
The rectangular grid is overkill, because you are not trying to do a figurative police lineup (leave tables for e.g.
https://en.wikipedia.org/wiki/Comparison_of_Linux_distributions#Instruction_set_architecture_support
)
In another way, I could also ask why hooks are in tables, and commands ("add", "flush", etc.) are in TP-style. What makes hooks so special that they deserve a table, despite their keyword being the same short length as the commands.
Quoted 9 lines
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
There are many markup languages, it reminds me to xkcd #927 [0].
Well, the difference here is that I'm not inventing anything new but search for better options amongst the existing solutions. :P
That would be to stay with docbook then, because RST/MD/A2 do not seem to have left themselves a lot of room for later extension.
What extensions do you have in mind?
I kind of left that open; it seemed you implied there is something (the "better option") that MD couldn't do that asciidoc could. That thing, docbook should already have.
Phil Sutter
reviewerQuoted 5 lines · Jan Engelhardt
Quoted 3 lines · Phil Sutter
Quoted 2 lines
Knowing that, people just avoid them most of the time for groff - and if I may say so, it has not reduced the document quality.
Quoted 7 lines
Quoted 3 lines
Right now, nft.8 makes extensive use of tables which is why I considered proper table support an important feature. OTOH I didn't experience rendering issues with them in nft.8, did you?
I do. For some reason, the right margin of the table is 60% of the terminal width. (width 120 => table up to col #63, terminal 80 cols => table up to col #50).
Oh, I see that too, also in my asciidoc PoC. Explicitly setting the table width to 100% doesn't help either. Maybe this is a problem in groff? The tables span the whole page in asciidoc's PDF output at least.
[...]
Quoted 13 lines
However, what I tried to express is the problem with tables is that one column has almost no text and another has a lot of it, like this one. This causes large amounts of whitespace in column 1 in this case. Personally, I would have placed the hooks and their explanations as (the equivalent of)
.TP
\fBprerouting\fP
All packets enter ...
.TP
\fBinput\fP
Packets delivered ...
Quoted 6 lines
Or if the source material was HTML, perhaps just
<ul>
<li><b>prerouting</b>: All packets enter...</li>
<li><b>input</b>: Packets delivered...</li>
</ul>
Yes, we should indeed convert two-column tables to these labeled lists if they are merely keyword descriptions. I'm not sure about other cases, sometimes having the table headings allows to provide information in a more compact form than embedding everything into a paragraph of text.
[...]
Quoted 4 lines
In another way, I could also ask why hooks are in tables, and commands ("add", "flush", etc.) are in TP-style. What makes hooks so special that they deserve a table, despite their keyword being the same short length as the commands.
Many of the tables seem to be there for reasons of document structure, e.g. those below DATA TYPES. I don't think that is a bad thing per se.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 1 line
There are many markup languages, it reminds me to xkcd #927 [0].
Well, the difference here is that I'm not inventing anything new but search for better options amongst the existing solutions. :P
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
That would be to stay with docbook then, because RST/MD/A2 do not seem to have left themselves a lot of room for later extension.
What extensions do you have in mind?
I kind of left that open; it seemed you implied there is something (the "better option") that MD couldn't do that asciidoc could. That thing, docbook should already have.
I think docbook is the most "feature complete" solution amongst those mentioned. My personal motivation to replace it is basically founded by two things:
1) XML is not quite editor-friendly. I found myself spending way more time opening and closing tags than I had anticipated for whenever I worked on content.
2) I didn't like how docbook formats synopfragment/synopfragmentref constructs. Maybe this could be changed by using some customization though. Also I didn't see an equivalent to it in asciidoc - BNF-style referencing is done manually there.
Cheers, Phil