nixos-render-docs: style file literals in manpages

similar to inline code these were indistinguishale from other text.
render then in italic font instead, like mdoc .Pa does.
This commit is contained in:
pennae 2023-02-01 03:03:14 +01:00 committed by pennae
parent 29252d1477
commit 1e4bafdbc5

View file

@ -285,9 +285,7 @@ class ManpageRenderer(Renderer):
env: MutableMapping[str, Any]) -> str:
if token.meta['name'] in [ 'command', 'env', 'option' ]:
return f'\\fB{man_escape(token.content)}\\fP'
elif token.meta['name'] == 'file':
return f'{man_escape(token.content)}'
elif token.meta['name'] == 'var':
elif token.meta['name'] in [ 'file', 'var' ]:
return f'\\fI{man_escape(token.content)}\\fP'
elif token.meta['name'] == 'manpage':
[page, section] = [ s.strip() for s in token.content.rsplit('(', 1) ]