nixos-render-docs: remove literalDocBook support
with literalDocBook itself gone we can also remove the support code in nixos-render-docs.
This commit is contained in:
@@ -216,12 +216,6 @@ class DocBookConverter(BaseConverter[OptionsDocBookRenderer]):
|
|||||||
def _parallel_render_init_worker(cls, a: Any) -> DocBookConverter:
|
def _parallel_render_init_worker(cls, a: Any) -> DocBookConverter:
|
||||||
return cls(*a)
|
return cls(*a)
|
||||||
|
|
||||||
def _render_code(self, option: dict[str, Any], key: str) -> list[str]:
|
|
||||||
if lit := option_is(option, key, 'literalDocBook'):
|
|
||||||
return [ f"<para><emphasis>{key.capitalize()}:</emphasis> {lit['text']}</para>" ]
|
|
||||||
else:
|
|
||||||
return super()._render_code(option, key)
|
|
||||||
|
|
||||||
def _render_description(self, desc: str | dict[str, Any]) -> list[str]:
|
def _render_description(self, desc: str | dict[str, Any]) -> list[str]:
|
||||||
if isinstance(desc, str) and not self._markdown_by_default:
|
if isinstance(desc, str) and not self._markdown_by_default:
|
||||||
return [ f"<nixos:option-description><para>{desc}</para></nixos:option-description>" ]
|
return [ f"<nixos:option-description><para>{desc}</para></nixos:option-description>" ]
|
||||||
@@ -327,14 +321,11 @@ class ManpageConverter(BaseConverter[OptionsManpageRenderer]):
|
|||||||
return super().add_options(options)
|
return super().add_options(options)
|
||||||
|
|
||||||
def _render_code(self, option: dict[str, Any], key: str) -> list[str]:
|
def _render_code(self, option: dict[str, Any], key: str) -> list[str]:
|
||||||
if lit := option_is(option, key, 'literalDocBook'):
|
try:
|
||||||
raise RuntimeError("can't render manpages in the presence of docbook")
|
self._renderer.inline_code_is_quoted = False
|
||||||
else:
|
return super()._render_code(option, key)
|
||||||
try:
|
finally:
|
||||||
self._renderer.inline_code_is_quoted = False
|
self._renderer.inline_code_is_quoted = True
|
||||||
return super()._render_code(option, key)
|
|
||||||
finally:
|
|
||||||
self._renderer.inline_code_is_quoted = True
|
|
||||||
|
|
||||||
def _render_description(self, desc: str | dict[str, Any]) -> list[str]:
|
def _render_description(self, desc: str | dict[str, Any]) -> list[str]:
|
||||||
if isinstance(desc, str) and not self._markdown_by_default:
|
if isinstance(desc, str) and not self._markdown_by_default:
|
||||||
@@ -431,14 +422,6 @@ class CommonMarkConverter(BaseConverter[OptionsCommonMarkRenderer]):
|
|||||||
def _parallel_render_init_worker(cls, a: Any) -> CommonMarkConverter:
|
def _parallel_render_init_worker(cls, a: Any) -> CommonMarkConverter:
|
||||||
return cls(*a)
|
return cls(*a)
|
||||||
|
|
||||||
def _render_code(self, option: dict[str, Any], key: str) -> list[str]:
|
|
||||||
# NOTE this duplicates the old direct-paste behavior, even if it is somewhat
|
|
||||||
# incorrect, since users rely on it.
|
|
||||||
if lit := option_is(option, key, 'literalDocBook'):
|
|
||||||
return [ f"*{key.capitalize()}:* {lit['text']}" ]
|
|
||||||
else:
|
|
||||||
return super()._render_code(option, key)
|
|
||||||
|
|
||||||
def _render_description(self, desc: str | dict[str, Any]) -> list[str]:
|
def _render_description(self, desc: str | dict[str, Any]) -> list[str]:
|
||||||
# NOTE this duplicates the old direct-paste behavior, even if it is somewhat
|
# NOTE this duplicates the old direct-paste behavior, even if it is somewhat
|
||||||
# incorrect, since users rely on it.
|
# incorrect, since users rely on it.
|
||||||
@@ -487,14 +470,6 @@ class AsciiDocConverter(BaseConverter[OptionsAsciiDocRenderer]):
|
|||||||
def _parallel_render_init_worker(cls, a: Any) -> AsciiDocConverter:
|
def _parallel_render_init_worker(cls, a: Any) -> AsciiDocConverter:
|
||||||
return cls(*a)
|
return cls(*a)
|
||||||
|
|
||||||
def _render_code(self, option: dict[str, Any], key: str) -> list[str]:
|
|
||||||
# NOTE this duplicates the old direct-paste behavior, even if it is somewhat
|
|
||||||
# incorrect, since users rely on it.
|
|
||||||
if lit := option_is(option, key, 'literalDocBook'):
|
|
||||||
return [ f"*{key.capitalize()}:* {lit['text']}" ]
|
|
||||||
else:
|
|
||||||
return super()._render_code(option, key)
|
|
||||||
|
|
||||||
def _render_description(self, desc: str | dict[str, Any]) -> list[str]:
|
def _render_description(self, desc: str | dict[str, Any]) -> list[str]:
|
||||||
# NOTE this duplicates the old direct-paste behavior, even if it is somewhat
|
# NOTE this duplicates the old direct-paste behavior, even if it is somewhat
|
||||||
# incorrect, since users rely on it.
|
# incorrect, since users rely on it.
|
||||||
@@ -557,12 +532,6 @@ class HTMLConverter(BaseConverter[OptionsHTMLRenderer]):
|
|||||||
def _parallel_render_init_worker(cls, a: Any) -> HTMLConverter:
|
def _parallel_render_init_worker(cls, a: Any) -> HTMLConverter:
|
||||||
return cls(*a)
|
return cls(*a)
|
||||||
|
|
||||||
def _render_code(self, option: dict[str, Any], key: str) -> list[str]:
|
|
||||||
if lit := option_is(option, key, 'literalDocBook'):
|
|
||||||
raise RuntimeError("can't render html in the presence of docbook")
|
|
||||||
else:
|
|
||||||
return super()._render_code(option, key)
|
|
||||||
|
|
||||||
def _render_description(self, desc: str | dict[str, Any]) -> list[str]:
|
def _render_description(self, desc: str | dict[str, Any]) -> list[str]:
|
||||||
if isinstance(desc, str) and not self._markdown_by_default:
|
if isinstance(desc, str) and not self._markdown_by_default:
|
||||||
raise RuntimeError("can't render html in the presence of docbook")
|
raise RuntimeError("can't render html in the presence of docbook")
|
||||||
|
|||||||
Reference in New Issue
Block a user