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:
@@ -97,8 +97,8 @@ class HTMLRenderer(Renderer):
|
|||||||
def strong_close(self, token: Token, tokens: Sequence[Token], i: int) -> str:
|
def strong_close(self, token: Token, tokens: Sequence[Token], i: int) -> str:
|
||||||
return "</strong></span>"
|
return "</strong></span>"
|
||||||
def fence(self, token: Token, tokens: Sequence[Token], i: int) -> str:
|
def fence(self, token: Token, tokens: Sequence[Token], i: int) -> str:
|
||||||
# TODO use token.info. docbook doesn't so we can't yet.
|
info = f" {escape(token.info, True)}" if token.info != "" else ""
|
||||||
return f'<pre class="programlisting">\n{escape(token.content)}</pre>'
|
return f'<pre class="programlisting{info}">\n{escape(token.content)}</pre>'
|
||||||
def blockquote_open(self, token: Token, tokens: Sequence[Token], i: int) -> str:
|
def blockquote_open(self, token: Token, tokens: Sequence[Token], i: int) -> str:
|
||||||
return '<div class="blockquote"><blockquote class="blockquote">'
|
return '<div class="blockquote"><blockquote class="blockquote">'
|
||||||
def blockquote_close(self, token: Token, tokens: Sequence[Token], i: int) -> str:
|
def blockquote_close(self, token: Token, tokens: Sequence[Token], i: int) -> str:
|
||||||
|
|||||||
@@ -496,8 +496,8 @@ class OptionsHTMLRenderer(OptionDocsRestrictions, HTMLRenderer):
|
|||||||
token.meta['compact'] = False
|
token.meta['compact'] = False
|
||||||
return super().bullet_list_open(token, tokens, i)
|
return super().bullet_list_open(token, tokens, i)
|
||||||
def fence(self, token: Token, tokens: Sequence[Token], i: int) -> str:
|
def fence(self, token: Token, tokens: Sequence[Token], i: int) -> str:
|
||||||
# TODO use token.info. docbook doesn't so we can't yet.
|
info = f" {html.escape(token.info, True)}" if token.info != "" else ""
|
||||||
return f'<pre class="programlisting">{html.escape(token.content)}</pre>'
|
return f'<pre class="programlisting{info}">{html.escape(token.content)}</pre>'
|
||||||
|
|
||||||
class HTMLConverter(BaseConverter[OptionsHTMLRenderer]):
|
class HTMLConverter(BaseConverter[OptionsHTMLRenderer]):
|
||||||
__option_block_separator__ = ""
|
__option_block_separator__ = ""
|
||||||
|
|||||||
Reference in New Issue
Block a user