docs: fixup envvar output

Sphinx 2.x has changed how this works, and some of this whitespace now
gets stripped as a result. So let's instead actual whitespace as separate
text-nodes instead.

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5706>
This commit is contained in:
Erik Faye-Lund 2020-07-02 14:15:57 +02:00 committed by Marge Bot
parent c8537744bb
commit 026615c0f9

View File

@ -9,10 +9,12 @@ import sphinx.addnodes
def parse_envvar(env, sig, signode):
envvar, t, default = sig.split(" ", 2)
envvar = envvar.strip().upper()
t = " Type: %s" % t.strip(" <>").lower()
default = " Default: %s" % default.strip(" ()")
t = "Type: %s" % t.strip(" <>").lower()
default = "Default: %s" % default.strip(" ()")
signode += sphinx.addnodes.desc_name(envvar, envvar)
signode += docutils.nodes.Text(' ')
signode += sphinx.addnodes.desc_type(t, t)
signode += docutils.nodes.Text(', ')
signode += sphinx.addnodes.desc_annotation(default, default)
return envvar