revert 213 commits (to 56092) from the last month. 10 still need work to resolve...
[AROS.git] / workbench / libs / mesa / src / gallium / docs / source / exts / formatting.py
blob14865f3603384494f2ba03cc3add44075a323e2d
1 # formatting.py
2 # Sphinx extension providing formatting for Gallium-specific data
3 # (c) Corbin Simpson 2010
4 # Public domain to the extent permitted; contact author for special licensing
6 import docutils.nodes
7 import sphinx.addnodes
9 def parse_envvar(env, sig, signode):
10 envvar, t, default = sig.split(" ", 2)
11 envvar = envvar.strip().upper()
12 t = " Type: %s" % t.strip(" <>").lower()
13 default = " Default: %s" % default.strip(" ()")
14 signode += sphinx.addnodes.desc_name(envvar, envvar)
15 signode += sphinx.addnodes.desc_type(t, t)
16 signode += sphinx.addnodes.desc_annotation(default, default)
17 return envvar
19 def parse_opcode(env, sig, signode):
20 opcode, desc = sig.split("-", 1)
21 opcode = opcode.strip().upper()
22 desc = " (%s)" % desc.strip()
23 signode += sphinx.addnodes.desc_name(opcode, opcode)
24 signode += sphinx.addnodes.desc_annotation(desc, desc)
25 return opcode
27 def setup(app):
28 app.add_description_unit("envvar", "envvar", "%s (environment variable)",
29 parse_envvar)
30 app.add_description_unit("opcode", "opcode", "%s (TGSI opcode)",
31 parse_opcode)