Skip to content

Conversation

@wenzeslaus
Copy link
Member

The modifies the build scripts to support combining addon documentation into the main documentation. Links to keyword index, topics, and tool family now work from addons. Keyword index contains keywords from addons and link to addons.

HTML_PAGE_FOOTER_PAGES_PATH build-only helper env var is used to provide a prefix for URL during the build of addons (this would be set to '../'). The already generated keyword section is replaced by a new one which has the links with a prefix. This copies how the HTML documentation deals with the keywords. The name HTML_PAGE_FOOTER_PAGES_PATH comes from the usage in the HTML documentation and does not apply for Markdown as the footer is not generated on the page level. Following the HTML documentation, the links are corrected during processing in Python rather than during the original creation in the command line parser C code.

Separate, yet related, issue is dealing with empty keywords in the tools. The original code just fails with addons which don't have any keywords. This addresses that issue by printing the message to stderr, but skipping the empty keyword. (The HTML does not have that issue presumably because the parsed list of keywords is empty while the Markdown parsing results in an one empty item in a list. This may change how this is handled in Markdown in the future depending on how we deal with custom keywords versus mkdoc tags.)

The modifies the build scripts to support combining addon documentation into the main documentation.

HTML_PAGE_FOOTER_PAGES_PATH build-only helper env var is used to provide a prefix for URL during the build of addons (this would be set to '../'). The already generated keyword section is replaced by a new one which has the links with a prefix. This copies how the HTML documentation deals with the keywords. The name HTML_PAGE_FOOTER_PAGES_PATH comes from the usage in the HTML documentation and does not apply for Markdown as the footer is not generated on the page level. Following the HTML documentation, the links are corrected during processing in Python rather than during the original creation in the command line parser C code.

Separate, yet related, issue is dealing with empty keywords in the tools. The original code just fails with addons which don't have any keywords. This addresses that issue by printing the message to stderr, but skipping the empty keyword. (The HTML does not have that issue presuably because the parsed list of keywords is empty while the Markdown parsing results in an one empty item in a list. This may change how this is handled in Markdown in the future depending on how we deal with custom keywords versus mkdoc tags.)
…. Add comment for no keywords section which we don't handle as an error. Use reg exp for matching the line and extracting the value.
@github-actions github-actions bot added Python Related code is in Python docs labels Feb 21, 2025
wenzeslaus added a commit to wenzeslaus/grass that referenced this pull request Feb 21, 2025
The original Markdown support from OSGeo#3849 breaks generating addon keywords on the doc build server because the parameter for addons used in the build script was ignored. The addon keywords are currently integated for 8.4, but are not integrated into the index for 8.5. This update should fix that.

The new code allows for the original usage of the script where documentation directories are supplied as parameters. This assumes HTML documentation and corresponds to the usage on the build server.

The intended usage from OSGeo#3849 for the new build where both Markdown and HTML are build using the script without the build system providing parameters is preserved.

Finally, with parameters md <core-path> <addon-path>, the script allows for creating Markdown keyword list with optionally integrated addons using the paths provided.
Unfortunately, ARCH_DISTDIR still needs to be set even in this case because it used directly a import time and a lot of other code uses that variable.

This also adds a main function to separate the variables and handle the parameters in one place. Additionally, it creates the dict for the first letter TOC only for HTML where it is used (which allows the script to execute without the fixes for empty keyword list from OSGeo#5175).
@wenzeslaus
Copy link
Member Author

The fixes of links are now visible in the CI (after #5152).

In CI Documentation, the number of lines in mkdocs output is reduced by roughly 800. The following warnings are present on main, but are not here as keyword links in addon files now correctly point to ../keywords.md.

WARNING -  Doc file 'addons/v.profile.points.md' contains a link 'keywords.md#profile', but the target 'addons/keywords.md' is not found among documentation files.
WARNING -  Doc file 'addons/v.profile.points.md' contains a link 'keywords.md#transect', but the target 'addons/keywords.md' is not found among documentation files.

wenzeslaus added a commit that referenced this pull request Feb 25, 2025
The original Markdown support from #3849 breaks generating addon keywords on the doc build server because the parameter for addons used in the build script was ignored. The addon keywords are currently integrated for 8.4, but are not integrated into the index for 8.5. This update should fix that.

The new code allows for the original usage of the script where documentation directories are supplied as parameters. This assumes HTML documentation and corresponds to the usage on the build server.

The intended usage from #3849 for the new build where both Markdown and HTML are build using the script without the build system providing parameters is preserved.

Finally, with parameters md <core-path> <addon-path>, the script allows for creating Markdown keyword list with optionally integrated addons using the paths provided. Unfortunately, ARCH_DISTDIR still needs to be set even in this case because it used directly a import time and a lot of other code uses that variable.

This also adds a main function to separate the variables and handle the parameters in one place. Additionally, it creates the dict for the first letter TOC only for HTML where it is used (which allows the script to execute without the fixes for empty keyword list from #5175).

Updates the CI to use the renewed API to get addon keywords into keyword index in Markdown for both core and addons.

Additionally, in the CI, it uses actual arch (just because it is possible), fixes logs dir path, uses more strict and verbose build.
@wenzeslaus wenzeslaus merged commit e60ee63 into OSGeo:main Feb 25, 2025
29 checks passed
@wenzeslaus wenzeslaus deleted the md-support-keywords-for-addon branch February 25, 2025 15:11
@github-actions github-actions bot added this to the 8.5.0 milestone Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Python Related code is in Python

Projects

Development

Successfully merging this pull request may close these issues.

2 participants