nixos-render-docs: don't render options during manual parsing

we should really be rendering options at *rendering* time, not at parse
time. currently this is just an academic exercise, but the html renderer
will have to inspect the options.json data after the entire document has
been parsed, but before anything gets rendered.

pennae 5b8be28e 068916ae

Changed files
+7 -5
pkgs
tools
nix
nixos-render-docs
src
nixos_render_docs
+7 -5
pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/manual.py
···
raise RuntimeError(f"rendering {path}") from e
return "".join(result)
def included_options(self, token: Token, tokens: Sequence[Token], i: int) -> str:
-
return cast(str, token.meta['rendered-options'])
# TODO minimize docbook diffs with existing conversions. remove soon.
def paragraph_open(self, token: Token, tokens: Sequence[Token], i: int) -> str:
···
" ".join(items.keys()))
try:
-
conv = options.DocBookConverter(
-
self._renderer._manpage_urls, self._renderer._revision, False, 'fragment', varlist_id, id_prefix)
with open(self._base_paths[-1].parent / source, 'r') as f:
-
conv.add_options(json.load(f))
-
token.meta['rendered-options'] = conv.finalize(fragment=True)
except Exception as e:
raise RuntimeError(f"processing options block in line {token.map[0] + 1}") from e
···
raise RuntimeError(f"rendering {path}") from e
return "".join(result)
def included_options(self, token: Token, tokens: Sequence[Token], i: int) -> str:
+
conv = options.DocBookConverter(self._manpage_urls, self._revision, False, 'fragment',
+
token.meta['list-id'], token.meta['id-prefix'])
+
conv.add_options(token.meta['source'])
+
return conv.finalize(fragment=True)
# TODO minimize docbook diffs with existing conversions. remove soon.
def paragraph_open(self, token: Token, tokens: Sequence[Token], i: int) -> str:
···
" ".join(items.keys()))
try:
with open(self._base_paths[-1].parent / source, 'r') as f:
+
token.meta['id-prefix'] = id_prefix
+
token.meta['list-id'] = varlist_id
+
token.meta['source'] = json.load(f)
except Exception as e:
raise RuntimeError(f"processing options block in line {token.map[0] + 1}") from e