diff options
Diffstat (limited to 'docs')
-rw-r--r-- | docs/markdown/Adding-arguments.md | 2 | ||||
-rw-r--r-- | docs/markdown/Yaml-RefMan.md | 2 | ||||
-rw-r--r-- | docs/meson.build | 1 | ||||
-rw-r--r-- | docs/refman/generatormd.py | 12 | ||||
-rw-r--r-- | docs/refman/main.py | 3 | ||||
-rw-r--r-- | docs/refman/templates/root.mustache | 3 |
6 files changed, 16 insertions, 7 deletions
diff --git a/docs/markdown/Adding-arguments.md b/docs/markdown/Adding-arguments.md index 2aaa889..adbc23e 100644 --- a/docs/markdown/Adding-arguments.md +++ b/docs/markdown/Adding-arguments.md @@ -22,7 +22,7 @@ This makes Meson add the define to all C compilations. Usually you would use this setting for flags for global settings. Note that for setting the C/C++ language standard (the `-std=c99` argument in GCC), you would probably want to use a default option of the `project()` -function. For details see the [reference manual](RefMan.md). +function. For details see the [reference manual](Reference-manual.md). Global arguments have certain limitations. They all have to be defined before any build targets are specified. This ensures that the global diff --git a/docs/markdown/Yaml-RefMan.md b/docs/markdown/Yaml-RefMan.md index 704bddf..f4275b6 100644 --- a/docs/markdown/Yaml-RefMan.md +++ b/docs/markdown/Yaml-RefMan.md @@ -5,7 +5,7 @@ short-description: Editing and maintaining the Reference manual # Reference Manual -The [Reference Manual](RefMan.md) is automatically generated out of YAML +The [Reference Manual](Reference-manual.md) is automatically generated out of YAML files in `docs/yaml`. This allows the Meson project to enforce a consistent style of the Reference Manual and enables easier style changes to the generated Markdown files without touching the actual documentation. diff --git a/docs/meson.build b/docs/meson.build index fcb4f7f..c53abcb 100644 --- a/docs/meson.build +++ b/docs/meson.build @@ -28,6 +28,7 @@ refman_gen = custom_target( '--link-defs', '@OUTPUT1@', '--depfile', '@DEPFILE@', '--force-color', + '--no-modules', ], ) diff --git a/docs/refman/generatormd.py b/docs/refman/generatormd.py index abf8a99..d04014a 100644 --- a/docs/refman/generatormd.py +++ b/docs/refman/generatormd.py @@ -49,7 +49,7 @@ FunctionDictType = T.Dict[ ] ] -_ROOT_BASENAME = 'RefMan' +_ROOT_BASENAME = 'Reference-manual' _OBJ_ID_MAP = { ObjectType.ELEMENTARY: 'elementary', @@ -74,12 +74,13 @@ def code_block(code: str) -> str: return f'<pre><code class="language-meson">{code}</code></pre>' class GeneratorMD(GeneratorBase): - def __init__(self, manual: ReferenceManual, sitemap_out: Path, sitemap_in: Path, link_def_out: Path) -> None: + def __init__(self, manual: ReferenceManual, sitemap_out: Path, sitemap_in: Path, link_def_out: Path, enable_modules: bool) -> None: super().__init__(manual) self.sitemap_out = sitemap_out.resolve() self.sitemap_in = sitemap_in.resolve() self.link_def_out = link_def_out.resolve() self.out_dir = self.sitemap_out.parent + self.enable_modules = enable_modules self.generated_files: T.Dict[str, str] = {} # Utility functions @@ -323,6 +324,7 @@ class GeneratorMD(GeneratorBase): 'builtins': gen_obj_links(self.builtins), 'modules': gen_obj_links(self.modules), 'functions': [{'indent': '', 'link': self._link_to_object(x), 'brief': self.brief(x)} for x in self.functions], + 'enable_modules': self.enable_modules, } dummy = {'root': self._gen_filename('root')} @@ -331,7 +333,9 @@ class GeneratorMD(GeneratorBase): self._write_template({**dummy, 'name': 'Elementary types'}, f'root.{_OBJ_ID_MAP[ObjectType.ELEMENTARY]}', 'dummy') self._write_template({**dummy, 'name': 'Builtin objects'}, f'root.{_OBJ_ID_MAP[ObjectType.BUILTIN]}', 'dummy') self._write_template({**dummy, 'name': 'Returned objects'}, f'root.{_OBJ_ID_MAP[ObjectType.RETURNED]}', 'dummy') - self._write_template({**dummy, 'name': 'Modules'}, f'root.{_OBJ_ID_MAP[ObjectType.MODULE]}', 'dummy') + + if self.enable_modules: + self._write_template({**dummy, 'name': 'Modules'}, f'root.{_OBJ_ID_MAP[ObjectType.MODULE]}', 'dummy') def generate(self) -> None: @@ -339,6 +343,8 @@ class GeneratorMD(GeneratorBase): with mlog.nested(): self._write_functions() for obj in self.objects: + if not self.enable_modules and (obj.obj_type == ObjectType.MODULE or obj.defined_by_module is not None): + continue self._write_object(obj) self._root_refman_docs() self._configure_sitemap() diff --git a/docs/refman/main.py b/docs/refman/main.py index cb040ce..913a0f3 100644 --- a/docs/refman/main.py +++ b/docs/refman/main.py @@ -37,6 +37,7 @@ def main() -> int: parser.add_argument('--link-defs', type=Path, help='Output file for the MD generator link definition file') parser.add_argument('--depfile', type=Path, default=None, help='Set to generate a depfile') parser.add_argument('--force-color', action='store_true', help='Force enable colors') + parser.add_argument('--no-modules', action='store_true', help='Disable building modules') args = parser.parse_args() if args.force_color: @@ -52,7 +53,7 @@ def main() -> int: generators: T.Dict[str, T.Callable[[], GeneratorBase]] = { 'print': lambda: GeneratorPrint(refMan), 'pickle': lambda: GeneratorPickle(refMan, args.out), - 'md': lambda: GeneratorMD(refMan, args.out, args.sitemap, args.link_defs), + 'md': lambda: GeneratorMD(refMan, args.out, args.sitemap, args.link_defs, not args.no_modules), } generator = generators[args.generator]() diff --git a/docs/refman/templates/root.mustache b/docs/refman/templates/root.mustache index cd846ac..3752a22 100644 --- a/docs/refman/templates/root.mustache +++ b/docs/refman/templates/root.mustache @@ -41,11 +41,12 @@ or other methods. {{indent}}- {{&link}} {{/returned}} +{{#enable_modules}} ## Modules {{#modules}} {{indent}}- {{&link}} {{/modules}} - +{{/enable_modules}} <!-- The links used to be generated wit {>root_link}, but this is a bit hard to read --> |