Skip to content
This repository has been archived by the owner on Apr 17, 2022. It is now read-only.

improve documentation generation #4751

Closed
wzdev-ci opened this issue Feb 21, 2018 · 13 comments
Closed

improve documentation generation #4751

wzdev-ci opened this issue Feb 21, 2018 · 13 comments

Comments

@wzdev-ci
Copy link
Contributor

resolution_fixed type_patch (an actual patch, not a request for one) | by Forgon


Man page

When executing a2x -f manpage -D . ./warzone2100.6.asciidoc, Asciidoc prints a warning:

a2x: WARNING: --destination-dir option is only applicable to HTML based outputs

This is an inconsequential error, which can be suppressed by instead executing a2x -f manpage ./warzone2100.6.asciidoc, which is functionally equivalent.

JavaScript API reference

The JavaScript API reference is generated with the following commands:

grep ./src/qtscript.cpp -e '_==' | sed 's/\/\/==_' > doc/globals.tex
grep ./src/qtscriptfuncs.cpp -e '_==' | sed 's/\/\/==_' >> doc/globals.tex
grep ./src/qtscript.cpp -e '___' | sed 's/\/\/___' > doc/events.tex
grep ./src/qtscript.cpp -e '_--' | sed 's/\/\/--_' > doc/functions.tex
grep ./src/qtscriptfuncs.cpp -e '_--' | sed 's/\/\/--_' >> doc/functions.tex
grep ./src/qtscriptfuncs.cpp -e '_;;' | sed 's/\/\/;;_' > doc/objects.tex
grep ./data/base/script/campaign/libcampaign.js -e '_;;' | sed 's/\/\/;;_' > doc/campaign.tex
test /home/x/warzone2100-backup/warzone2100 = /home/x/warzone2100-backup/warzone2100 || cp ./doc/javascript.tex doc/

Sed substitution commands are now delimited with a colon rather than a dash, which renders escape characters obsolete and improves readability.

(cd doc; hevea javascript.tex; hevea javascript.tex)
./javascript.tex:4: Warning: Command not found: \lstloadlanguages
./javascript.tex:10: Warning: No author given
./javascript.tex:28: Warning: keyval, unknown key: 'AI'
./javascript.tex:75: Warning: keyval, unknown key: 'scripts'
./javascript.tex:86: Warning: keyval, unknown key: 'player_2'
./functions.tex:149: Warning: Undefined label: 'objects:structure'
./functions.tex:156: Warning: Undefined label: 'objects:structure'
HeVeA Warning: Label(s) may have changed. Rerun me to get cross-references right.
./javascript.tex:4: Warning: Command not found: \lstloadlanguages
./javascript.tex:10: Warning: No author given
./javascript.tex:28: Warning: keyval, unknown key: 'AI'
./javascript.tex:75: Warning: keyval, unknown key: 'scripts'
./javascript.tex:86: Warning: keyval, unknown key: 'player_2'
HeVeA Warning: Label(s) may have changed. Rerun me to get cross-references right.
(cd doc; hacha -o javascript-index.html javascript.html)

The command '\lstloadlanguages' is not found because HeVea implements only a subset of the LaTeX package "listings" (read this section for more details) to which it belongs.

All references to programming languages have been removed since JavaScript, JSON and INI are not in the list of languages supported by "listings" (read page 13 of its documentation). These languages could be defined (read section 3.2 of the User's guide in the documentation), yet this would unlikely be worth the necessary effort since the JavaScript API documentation will soon be converted from LaTeX to Markdown.

In 3 cases, literal square brackets were confused with optional environment arguments, as in this example:

\begin{lstlisting}
	[AI]
	name = "Semperfi JS"
	js = semperfi.js
\end{lstlisting}

The problem was solved by declaring the "lstlisting" environment with an empty set of optional arguments.

The warning about no author being given was suppressed by declaring '\author{}' with an empty set of names.

Warnings about undefined labels commonly occur in LaTeX even in the absence of syntax errors. In such cases, the proper way to fix them when using HeVeA is to execute hevea -fix <file> rather than running the program several times.

The only label used in the JavaScript API documentation was renamed from "objects:structure" to "subsec:Structure", which is more in line with LaTeX conventions.


Issue migrated from trac:4751 at 2022-04-16 13:03:35 -0700

@wzdev-ci
Copy link
Contributor Author

Forgon uploaded file a2x_warning.patch (0.9 KiB)

patch file created with git format-patch (part 1/4)

@wzdev-ci
Copy link
Contributor Author

Forgon uploaded file sed_syntax.patch (1.9 KiB)

patch file created with git format-patch (part 2/4)

@wzdev-ci
Copy link
Contributor Author

Forgon uploaded file hevea_corrections.patch (3.3 KiB)

patch file created with git format-patch (part 3/4)

@wzdev-ci
Copy link
Contributor Author

Forgon uploaded file label_renaming.patch (2.3 KiB)

patch file created with git format-patch (part 4/4)

@wzdev-ci
Copy link
Contributor Author

Forgon uploaded file make_javascript-doc-html_error.log (1.6 KiB)

command line output when generating JavaScript API reference before applying this patch series

@wzdev-ci
Copy link
Contributor Author

Forgon uploaded file make_javascript-doc-html_success.log (1.1 KiB)

command line output when generating JavaScript API reference after applying this patch series

@wzdev-ci
Copy link
Contributor Author

Forgon2100 <forgon2100@...> changed status from new to closed

@wzdev-ci
Copy link
Contributor Author

Forgon2100 <forgon2100@...> changed owner from `` to Forgon2100 <forgon2100@gmail.com>

@wzdev-ci
Copy link
Contributor Author

Forgon2100 <forgon2100@...> changed resolution from `` to fixed

@wzdev-ci
Copy link
Contributor Author

Forgon2100 <forgon2100@...> committed [35245]


In Warzone2100/warzone2100@35245d9:

#CommitTicketReference repository="" revision="35245d92ef14170d4fc01fe1531477a063c5413b"
fixes #4751: fix erroneous AsciiDoc warning when generating man pages (patch 1/4)

@wzdev-ci
Copy link
Contributor Author

Forgon2100 <forgon2100@...> committed [15]


In Warzone2100/warzone2100@15fa86d:

#CommitTicketReference repository="" revision="15fa86d039b8eb3665970a87139fa92d2e6efd02"
fixes #4751: more readable sed syntax (patch 2/4)

@wzdev-ci
Copy link
Contributor Author

Forgon2100 <forgon2100@...> committed [3]


In Warzone2100/warzone2100@3fb2dc2:

#CommitTicketReference repository="" revision="3fb2dc2e90d9a9e0bb2c626880720d9082e3b04e"
fixes #4751: fixed warnings and errors when generating JavaScript API reference (patch 3/4)
- removed unused commands for syntax highlighting
- literal square brackets no longer confused with optional environment arguments
- suppressed warning about missing author
- ensured correct references by using `hevea -fix <file>`

@wzdev-ci
Copy link
Contributor Author

Forgon2100 <forgon2100@...> commented


In Warzone2100/warzone2100@a8a5955:

#CommitTicketReference repository="" revision="a8a59557587cf810963148791f7236ec3533e441"
fixes #4751: renamed LaTeX label and its references (patch 4/4)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant