diff options
author | Markus Heiser <markus.heiser@darmarit.de> | 2016-08-22 17:16:21 -0400 |
---|---|---|
committer | Jonathan Corbet <corbet@lwn.net> | 2016-08-22 17:19:15 -0400 |
commit | e8f5c617f26626ef4915ffa176f4ae02c9e08531 (patch) | |
tree | 55b53a8c2100e59371ff44707d1072c5072512c1 | |
parent | 5512128f027aec63a9a2ca792858801554a57baf (diff) |
doc-rst: add boilerplate to customize c-domain
Add a sphinx-extension to customize the sphinx c-domain. No functional
changes right yet, just the boilerplate code.
Signed-off-by: Markus Heiser <markus.heiser@darmarIT.de>
[ jc: coding-style tweak ]
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
-rw-r--r-- | Documentation/conf.py | 2 | ||||
-rw-r--r-- | Documentation/sphinx/cdomain.py | 44 |
2 files changed, 45 insertions, 1 deletions
diff --git a/Documentation/conf.py b/Documentation/conf.py index 23e2f0bbcfc8..88c377d468d0 100644 --- a/Documentation/conf.py +++ b/Documentation/conf.py | |||
@@ -34,7 +34,7 @@ from load_config import loadConfig | |||
34 | # Add any Sphinx extension module names here, as strings. They can be | 34 | # Add any Sphinx extension module names here, as strings. They can be |
35 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom | 35 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom |
36 | # ones. | 36 | # ones. |
37 | extensions = ['kernel-doc', 'rstFlatTable', 'kernel_include'] | 37 | extensions = ['kernel-doc', 'rstFlatTable', 'kernel_include', 'cdomain'] |
38 | 38 | ||
39 | # The name of the math extension changed on Sphinx 1.4 | 39 | # The name of the math extension changed on Sphinx 1.4 |
40 | if minor > 3: | 40 | if minor > 3: |
diff --git a/Documentation/sphinx/cdomain.py b/Documentation/sphinx/cdomain.py new file mode 100644 index 000000000000..d6e66e289808 --- /dev/null +++ b/Documentation/sphinx/cdomain.py | |||
@@ -0,0 +1,44 @@ | |||
1 | # -*- coding: utf-8; mode: python -*- | ||
2 | u""" | ||
3 | cdomain | ||
4 | ~~~~~~~ | ||
5 | |||
6 | Replacement for the sphinx c-domain. | ||
7 | |||
8 | :copyright: Copyright (C) 2016 Markus Heiser | ||
9 | :license: GPL Version 2, June 1991 see Linux/COPYING for details. | ||
10 | """ | ||
11 | |||
12 | from sphinx.domains.c import CObject as Base_CObject | ||
13 | from sphinx.domains.c import CDomain as Base_CDomain | ||
14 | |||
15 | __version__ = '1.0' | ||
16 | |||
17 | def setup(app): | ||
18 | |||
19 | app.override_domain(CDomain) | ||
20 | |||
21 | return dict( | ||
22 | version = __version__, | ||
23 | parallel_read_safe = True, | ||
24 | parallel_write_safe = True | ||
25 | ) | ||
26 | |||
27 | class CObject(Base_CObject): | ||
28 | |||
29 | """ | ||
30 | Description of a C language object. | ||
31 | """ | ||
32 | |||
33 | class CDomain(Base_CDomain): | ||
34 | |||
35 | """C language domain.""" | ||
36 | name = 'c' | ||
37 | label = 'C' | ||
38 | directives = { | ||
39 | 'function': CObject, | ||
40 | 'member': CObject, | ||
41 | 'macro': CObject, | ||
42 | 'type': CObject, | ||
43 | 'var': CObject, | ||
44 | } | ||