cla docs - Help and Documentation Generation
cla docs: Exports the help docs into a Mkdocs static site, one folder per language.
Note: For this command to work, you need to install Mkdocs, which in turn requires Python.
Site layout¶
Each language is exported into its own folder under the site root:
root/static/mkdocs/ index.html <- sends the browser to its own language en/ es/
The prefix is not cosmetic. The documentation theme rewrites every absolute link and image to start with the language it was built for, and the language selector in the header swaps that same prefix. A site without the folders cannot resolve either, and every page answers with a 404.
Running cla docs with no options exports every language found under docs/, so
the language selector always has somewhere to go. The site root is emptied first.
Publishing the site¶
To publish the documentation on a web server, copy the contents of each
language folder into the folder of the same name in the web root, and the root
index.html into the web root itself:
cla docs --doc-langs en,es cp -r root/static/mkdocs/en/. /path/to/webroot/en/ cp -r root/static/mkdocs/es/. /path/to/webroot/es/ cp root/static/mkdocs/index.html /path/to/webroot/
Do not copy the whole site root into a language folder
(cp -r root/static/mkdocs/* /path/to/webroot/en/). That nests en/en/ and
replaces en/index.html with the root index.html, which only redirects to a
language, so /en/ keeps redirecting to itself.
Serving the site locally¶
cla docs-serve
cla docs-serve exports the site first and then serves it, so what you read is
always what is on disk. Pass --no-rebuild to skip the export and serve the last
build, which is what you want when you are only looking around.
It takes port 5555, or a free port picked by the operating system when something
else already holds it. It resolves folder URLs to their index.html, so the
pretty links Mkdocs writes work the same as they do in production, and it closes
the listening socket on Ctrl-C so the port is free immediately afterwards.
Checking the links¶
cla docs-check cla docs-check --feature genexus
cla docs-check looks for broken links in the installed documentation, the way the in-app help
resolves them: the docs of the core and of every feature, in every language. With --feature it
checks only the docs and the code of that feature. It does not need Mkdocs.
It checks:
- links to docs, absolute (
/concepts/topic) or relative, with or without extension: the target must exist in the language of the doc, in English or in any other language the docs have; - anchors, on the same page or on another (
/hcl/people#role), with the anchor Mkdocs and the help give a heading; - images and files:
/static/...in aroot/folder,/feature/<id>/...in thepublic/folder of that feature; - the doc paths in code:
Cla.help_pushandCla.help_showin the core screens,sdk.addHelpandsdk.useHelpin thesrc/folder of a feature.
Links written as examples inside code are skipped, and other sites are not fetched. Each broken link
is printed as file:line link reason, followed by a summary:
docs/en/rulebook/intro.markdown:100 /rulebook/api doc /rulebook/api not found 1 broken link in 1 file of the installed documentation.
It exits with 0 when there is none and 1 otherwise, so a pipeline can run it. t/docs.t runs the
same check on the core documentation.
Options:
--feature id¶
cla docs-check only: check the docs and code of that feature. Fails when it is not installed.
--doc-lang en|es¶
Export a single language instead of all of them. The site root still keeps the
per-language folder, so --doc-lang es produces es/ and nothing else.
Defaults to the language of your shell.
--doc-langs en,es¶
Export a specific list of languages. Takes precedence over --doc-lang.
--mkdocs-path dir¶
The path to the folder where the temporary Mkdocs site will be created.
Warning: everytime this command executes, the mkdocs folder is completely deleted before being written to.
--site-dir dir¶
The final destination site.
If no dir is specified, the documentation static site will be created under /static/mkdocs in your Clarive server.
--no-rebuild¶
Serve the existing build instead of exporting first. Fails if there is nothing built yet.
--serve-port 5555¶
The port cla docs-serve listens on. Without it, 5555 is used when free and a
random free port otherwise.
--serve-host 127.0.0.1¶
The address cla docs-serve binds to. Pass 0.0.0.0 to reach the site from
another machine.