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

Made Commands.md dynamically generated #7346

Merged
merged 2 commits into from
Jun 30, 2020

Conversation

TheQwertiest
Copy link
Contributor

@TheQwertiest TheQwertiest commented Jun 17, 2020

Replaced docs/markdown/Commands.md with dynamic generation from template:

  • Added a helper script tools/regenerate_docs.py:
    This script generates docs/markdown/Commands.md from docs/markdown_dynamic/Commands.md, using the current meson.py to get the relevant data. Template rendering is implemented via jinja2 Python package.
  • Added a call to tools/regenerate_docs.py from docs/meson.build (which is used to generate site docs during release).
  • Rewrote corresponding unit-test: now it only checks two things:
    • All commands are present (i.e. section names).
    • All commands have corresponding place-holders.

@TheQwertiest TheQwertiest force-pushed the docs/auto branch 3 times, most recently from 0840773 to a519162 Compare June 17, 2020 21:31
@TheQwertiest
Copy link
Contributor Author

TheQwertiest commented Jun 17, 2020

PS: I can rewrite the test properly if the jinja2 requirement can be satisfied somehow (e.g. install jinja2 on CI. The test can be optional so that users could run the whole test suite even if they don't have jinja on their machine).

@TheQwertiest
Copy link
Contributor Author

TheQwertiest commented Jun 17, 2020

Another option would be to make doc generation actually dynamic and move this script invocation to meson/docs/meson.build and template to docs/markdown (instead of a current fully-rendered Commands.md). This way there would be no need to test any options at all (only commands presence), since docs will always contain the up-to-date info. There won't be a need for user to manually invoke the script as well.

@TheQwertiest
Copy link
Contributor Author

Added a test to enforce template usage: test checks if the markdown/Commands.md is consistent with templates/Commands.md

@TheQwertiest
Copy link
Contributor Author

Rebased to resolve conflicts

@jpakkane
Copy link
Member

Fully dynamic is better. Whenever something can be done so it works without manual labor, it should be done.

@TheQwertiest
Copy link
Contributor Author

TheQwertiest commented Jun 21, 2020

@jpakkane , done. But please check if it works on your machine as well, since site generation (and upload) is not covered by any tests (AFAIK).

@TheQwertiest TheQwertiest changed the title Added a helper script to regenerate Commands.md Made Commands.md dynamically generated Jun 21, 2020
@lgtm-com
Copy link

lgtm-com bot commented Jun 21, 2020

This pull request introduces 2 alerts when merging 68cf874 into d6c6b93 - view on LGTM.com

new alerts:

  • 1 for Wrong name for an argument in a call
  • 1 for Unused import

@jpakkane
Copy link
Member

It currently fails because regenerate_docs.py does not have the executable bit set.

Testing it yourself is simple:

  • Install hotdoc (most easily via pip)
  • go in the docs subdir
  • run ../meson.py . builddir && ninja -C builddir

@TheQwertiest
Copy link
Contributor Author

TheQwertiest commented Jun 29, 2020

Strange, it works for me :\
I'll add the flag anyway =)

@TheQwertiest
Copy link
Contributor Author

Added a flag, renamed templates to markdown_dynamic (for better discoverability) and rebased for good measure :D

@jpakkane jpakkane merged commit b6981bd into mesonbuild:master Jun 30, 2020
@TheQwertiest TheQwertiest deleted the docs/auto branch June 30, 2020 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants