nixos-render-docs: don't drop code languages anymore

this was needed because the nixos/nixpkgs manuals, for some
reason, *did* drop the languages. we no longer have to render exactly as
the docbook toolchain did, so we can finally fix this bug.
This commit is contained in:
pennae 2023-12-01 18:20:24 +01:00
parent cae1e33e8c
commit 229e6eb8ed
2 changed files with 4 additions and 4 deletions

View File

@ -97,8 +97,8 @@ class HTMLRenderer(Renderer):
def strong_close(self, token: Token, tokens: Sequence[Token], i: int) -> str:
return "</strong></span>"
def fence(self, token: Token, tokens: Sequence[Token], i: int) -> str:
# TODO use token.info. docbook doesn't so we can't yet.
return f'<pre class="programlisting">\n{escape(token.content)}</pre>'
info = f" {escape(token.info, True)}" if token.info != "" else ""
return f'<pre class="programlisting{info}">\n{escape(token.content)}</pre>'
def blockquote_open(self, token: Token, tokens: Sequence[Token], i: int) -> str:
return '<div class="blockquote"><blockquote class="blockquote">'
def blockquote_close(self, token: Token, tokens: Sequence[Token], i: int) -> str:

View File

@ -496,8 +496,8 @@ class OptionsHTMLRenderer(OptionDocsRestrictions, HTMLRenderer):
token.meta['compact'] = False
return super().bullet_list_open(token, tokens, i)
def fence(self, token: Token, tokens: Sequence[Token], i: int) -> str:
# TODO use token.info. docbook doesn't so we can't yet.
return f'<pre class="programlisting">{html.escape(token.content)}</pre>'
info = f" {html.escape(token.info, True)}" if token.info != "" else ""
return f'<pre class="programlisting{info}">{html.escape(token.content)}</pre>'
class HTMLConverter(BaseConverter[OptionsHTMLRenderer]):
__option_block_separator__ = ""