[PATCH v2 07/13] autodoc: add markup to argument's references

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 Documentation/sphinx/cdoc.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/Documentation/sphinx/cdoc.py b/Documentation/sphinx/cdoc.py
index 7137b2a67..410a55ea2 100755
--- a/Documentation/sphinx/cdoc.py
+++ b/Documentation/sphinx/cdoc.py
@@ -183,6 +183,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 = []
@@ -217,6 +222,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, ''))
@@ -225,6 +231,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
-- 
2.17.0

--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux