docs: Temporarily disable modules and move RefMan --> Reference-manual

pull/9347/head
Daniel Mensinger 3 years ago
parent 800c3462f0
commit a8189d0c70
  1. 2
      docs/markdown/Adding-arguments.md
  2. 2
      docs/markdown/Yaml-RefMan.md
  3. 1
      docs/meson.build
  4. 10
      docs/refman/generatormd.py
  5. 3
      docs/refman/main.py
  6. 3
      docs/refman/templates/root.mustache

@ -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 would use this setting for flags for global settings. Note that for
setting the C/C++ language standard (the `-std=c99` argument in GCC), setting the C/C++ language standard (the `-std=c99` argument in GCC),
you would probably want to use a default option of the `project()` 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 Global arguments have certain limitations. They all have to be defined
before any build targets are specified. This ensures that the global before any build targets are specified. This ensures that the global

@ -5,7 +5,7 @@ short-description: Editing and maintaining the Reference manual
# 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 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 style of the Reference Manual and enables easier style changes to the generated
Markdown files without touching the actual documentation. Markdown files without touching the actual documentation.

@ -28,6 +28,7 @@ refman_gen = custom_target(
'--link-defs', '@OUTPUT1@', '--link-defs', '@OUTPUT1@',
'--depfile', '@DEPFILE@', '--depfile', '@DEPFILE@',
'--force-color', '--force-color',
'--no-modules',
], ],
) )

@ -49,7 +49,7 @@ FunctionDictType = T.Dict[
] ]
] ]
_ROOT_BASENAME = 'RefMan' _ROOT_BASENAME = 'Reference-manual'
_OBJ_ID_MAP = { _OBJ_ID_MAP = {
ObjectType.ELEMENTARY: 'elementary', ObjectType.ELEMENTARY: 'elementary',
@ -74,12 +74,13 @@ def code_block(code: str) -> str:
return f'<pre><code class="language-meson">{code}</code></pre>' return f'<pre><code class="language-meson">{code}</code></pre>'
class GeneratorMD(GeneratorBase): 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) super().__init__(manual)
self.sitemap_out = sitemap_out.resolve() self.sitemap_out = sitemap_out.resolve()
self.sitemap_in = sitemap_in.resolve() self.sitemap_in = sitemap_in.resolve()
self.link_def_out = link_def_out.resolve() self.link_def_out = link_def_out.resolve()
self.out_dir = self.sitemap_out.parent self.out_dir = self.sitemap_out.parent
self.enable_modules = enable_modules
self.generated_files: T.Dict[str, str] = {} self.generated_files: T.Dict[str, str] = {}
# Utility functions # Utility functions
@ -323,6 +324,7 @@ class GeneratorMD(GeneratorBase):
'builtins': gen_obj_links(self.builtins), 'builtins': gen_obj_links(self.builtins),
'modules': gen_obj_links(self.modules), 'modules': gen_obj_links(self.modules),
'functions': [{'indent': '', 'link': self._link_to_object(x), 'brief': self.brief(x)} for x in self.functions], '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')} dummy = {'root': self._gen_filename('root')}
@ -331,6 +333,8 @@ class GeneratorMD(GeneratorBase):
self._write_template({**dummy, 'name': 'Elementary types'}, f'root.{_OBJ_ID_MAP[ObjectType.ELEMENTARY]}', 'dummy') 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': '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': 'Returned objects'}, f'root.{_OBJ_ID_MAP[ObjectType.RETURNED]}', 'dummy')
if self.enable_modules:
self._write_template({**dummy, 'name': 'Modules'}, f'root.{_OBJ_ID_MAP[ObjectType.MODULE]}', 'dummy') self._write_template({**dummy, 'name': 'Modules'}, f'root.{_OBJ_ID_MAP[ObjectType.MODULE]}', 'dummy')
@ -339,6 +343,8 @@ class GeneratorMD(GeneratorBase):
with mlog.nested(): with mlog.nested():
self._write_functions() self._write_functions()
for obj in self.objects: 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._write_object(obj)
self._root_refman_docs() self._root_refman_docs()
self._configure_sitemap() self._configure_sitemap()

@ -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('--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('--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('--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() args = parser.parse_args()
if args.force_color: if args.force_color:
@ -52,7 +53,7 @@ def main() -> int:
generators: T.Dict[str, T.Callable[[], GeneratorBase]] = { generators: T.Dict[str, T.Callable[[], GeneratorBase]] = {
'print': lambda: GeneratorPrint(refMan), 'print': lambda: GeneratorPrint(refMan),
'pickle': lambda: GeneratorPickle(refMan, args.out), '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]() generator = generators[args.generator]()

@ -41,11 +41,12 @@ or other methods.
{{indent}}- {{&link}} {{indent}}- {{&link}}
{{/returned}} {{/returned}}
{{#enable_modules}}
## Modules ## Modules
{{#modules}} {{#modules}}
{{indent}}- {{&link}} {{indent}}- {{&link}}
{{/modules}} {{/modules}}
{{/enable_modules}}
<!-- The links used to be generated wit {>root_link}, but this is a bit hard to read --> <!-- The links used to be generated wit {>root_link}, but this is a bit hard to read -->

Loading…
Cancel
Save