Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to reconcile README, Asciidoc and GitHub (v3) #2049

Merged
merged 46 commits into from
Sep 14, 2023

Conversation

jimklimov
Copy link
Member

@jimklimov jimklimov commented Sep 13, 2023

Closes: #226
Closes: #669
Related-to: #1953 and #2048

Includes earlier attempts from https://github.com/aquette/nut/tree/gh_adoc, https://github.com/zykh/nut/tree/rename_readme and https://github.com/clepple/nut/tree/rename_readme - thanks to @zykh for figuring out much of the magic behind the scenes, and @clepple and @aquette for earlier blueprints!

Also, note that the proposed solution is rather clumsy due to github/markup#1095 (lack of custom asciidoc macros, configuration files, and include:...[] pre-processing) in the GitHub Web-UI renderer - so the least-bad approach, maintainable and working, was to define the needed asciidoc attributes in a new docs/asciidoc-vars.conf file and source it into original documents that use these multi-targeted features with make maintainer-asciidocs. If GH eventually solves their end, or at least some layers of it, the clumsy part in NUT sources and recipes can be easily retracted:

  • use of docs/asciidoc-vars.conf file might become a run-time include (anticipated syntax commented in README.adoc
  • vars themselves might not be needed and macros would be usable, for a less confusing syntax than currently with chains of prefix, separator and suffix expandable variables (attributes).

This change currently also renders cross-reference links from one NUT document to potentially another's section as URLs to the published NUT web site, not as links to some neighboring document filename (not easy to guess statically) and hash-anchors there, hosted in the same Git branch, which would have been more helpful.

Checked to render reasonably while browsing the NUT repo on GitHub (with links pointing to expected-looking locations on the NUT website, even if they have not been published there yet - chicken-and-egg problem), as well as PDF renders (e.g. user-manual.pdf has internal cross-section links as well as external ones pointing to the NUT website or other "nearby" PDFs).

Further work in this area should include:

  • Conversion of other major docs to *.adoc and the asciidoc-vars.conf hacks, if only to make their maintenance consistent; possibly the MAN page sources can be exempt as an island of their own (not so many links and includes to worry about, and original asciidoc is more readable as source there even on github, not too much readability benefit from pretty rendering);
  • Revise cross-references in those docs (convert to variables where needed, to cover different target media);
  • Consider ifdef ... choice of link types, as used already in some documents now for website/txt builds - to use http (or xref) links to document sections vs. pointers to individual filenames (the latter may help with GitHub source browsing, to auto-point to doc files in the same commit or branch under development);
  • Consider embedding default top_srcdir and top_builddir (as respective {srcdir}/.. etc.) into newly christened *.adoc sources based on their location in codebase (. for workspace root, .. for docs/, lib/ and such, ../../ for docs/man, scripts/something, etc.)

clepple and others added 30 commits August 6, 2015 22:18
Also:
- add 'foreign' to AM_INIT_AUTOMAKE macro so that automake doesn't fail as a consequence of the lack of a 'README' file (since we now have 'README.adoc');
- make sure README.adoc is distributed.
As the link was still pointing to the old -no longer generated- 'blazer' manpage, take the chance to reword the paragraph so that it points to the new nutdrv_qx driver.
Since GitHub doesn't allow custom macros, only use ours when generating docs, replacing their occurrences with attributes that produce links when on GitHub.
This approach should work properly as long as we use them in contexts where attributes are evaluated and substituted before macros.

Also, use a common attribute that points to the URL of the website.

Reference: networkupstools#226
Substitute the shorthand '<< >>' syntax with attributes that conditionally expand to:
- links on GitHub (references can point at most to a section of level docs/common.xsl's <chunk.section.depth>),
- xref macros when generating docs.

In order to achieve the result, 'chunked' docs get now their pages named after IDs.
So, update all the links that use the old auto-generated names.

Reference: networkupstools#226
AsciiDoc <= ~8.6.9 tests the wrong attribute and, as a consequence of that, it produces both <link> and <xref>.
To workaround this issue, implement the xref macro by ourselves.
Add a new 'linksingledoc' AsciiDoc macro which guarantees that, when chunked HTML is generated, the link always points to a non-chunked file.
Add a new 'linkman2' AsciiDoc macro to support different names for the manpage and the command shown.
This is also needed to properly display links to manpages in both GitHub and generated docs without defining an attribute for each manpage.

Reference: networkupstools#226
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…evicted from README.adoc

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…he trailing slash is part of `(top_)srcdir` and `(top_)builddir` attributes, so empty values are non-toxic

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…r-dependent attribute definitions

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…dable docs/asciidoc-vars.conf

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…up as far as asciidoc is concerned

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…docs/asciidoc-vars.conf

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…ic fashion

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…include

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
This reverts commit 07a39b950b40857c8d8e5c806551e1c40278d3bb.
… syntactic fashion"

This reverts commit 300942904bef0921bba382103c9c4b96cc1c5f04.
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…: 234b70422 (2023-09-13)

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…rtability checks" per GNU docs)

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…36f4f03 (2023-09-13)

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…and (top_)(src|build)dir attributes

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…7c5e901 (2023-09-13)

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…ed filenames [networkupstools#1953]

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
@jimklimov jimklimov added enhancement packaging documentation CI Entries related to continuous integration infrastructure (historically also recipes like Makefiles) labels Sep 13, 2023
@jimklimov jimklimov added this to the 2.8.1 milestone Sep 13, 2023
…DME file

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
Thanks for Tomas Laurinavicius <tomas@saas.group> for the suggestion.

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI Entries related to continuous integration infrastructure (historically also recipes like Makefiles) documentation enhancement packaging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants