diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-05-14 16:02:04 +0200 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-05-21 02:49:44 +0200 |
| commit | 76068215ca8a7d985b0d10a07ac3026261ea3a05 (patch) | |
| tree | 61647680bf4400666a1e1186491f07dacdac8a0e /Documentation/sphinx | |
| parent | ab8f48ff06c8bc48a94d34db991a4a54f6a2d40f (diff) | |
| download | sparse-dev-76068215ca8a7d985b0d10a07ac3026261ea3a05.tar.gz | |
autodoc: add markup to argument's references
The syntax for a parameter is '@<name>'. Let also use this when
referencing a parameter name in another section (other parameters
or long description) and mark these references in bold (the same
as the parameters themseelves are presented).
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'Documentation/sphinx')
| -rwxr-xr-x | Documentation/sphinx/cdoc.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Documentation/sphinx/cdoc.py b/Documentation/sphinx/cdoc.py index 56d31cb1..75eb241a 100755 --- a/Documentation/sphinx/cdoc.py +++ b/Documentation/sphinx/cdoc.py @@ -180,6 +180,11 @@ def process_file(f): return docs +def decorate(l): + # type: (str) -> str + l = re.sub(r"@(\w+)", "**\\1**", l) + return l + def convert_to_rst(info): # type: (Dict[str, Any]) -> List[Tuple[int, str]] lst = [] @@ -214,6 +219,7 @@ def convert_to_rst(info): for (n, name, l) in info.get('tags', []): if name != 'return': name = 'param ' + name + l = decorate(l) l = '\t:%s: %s' % (name, l) lst.append((n, l)) lst.append((n+1, '')) @@ -222,6 +228,7 @@ def convert_to_rst(info): n = desc[0] r = '' for l in desc[1:]: + l = decorate(l) r += '\t' + l + '\n' lst.append((n, r)) return lst |
