summaryrefslogtreecommitdiffstats
path: root/Documentation/sphinx/cdomain.py
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarit.de>2016-08-22 23:16:21 +0200
committerJonathan Corbet <corbet@lwn.net>2016-08-22 23:19:15 +0200
commite8f5c617f26626ef4915ffa176f4ae02c9e08531 (patch)
tree55b53a8c2100e59371ff44707d1072c5072512c1 /Documentation/sphinx/cdomain.py
parentMerge branch 'dev-tools' into doc/4.9 (diff)
downloadlinux-e8f5c617f26626ef4915ffa176f4ae02c9e08531.tar.xz
linux-e8f5c617f26626ef4915ffa176f4ae02c9e08531.zip
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>
Diffstat (limited to 'Documentation/sphinx/cdomain.py')
-rw-r--r--Documentation/sphinx/cdomain.py44
1 files changed, 44 insertions, 0 deletions
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 @@
+# -*- coding: utf-8; mode: python -*-
+u"""
+ cdomain
+ ~~~~~~~
+
+ Replacement for the sphinx c-domain.
+
+ :copyright: Copyright (C) 2016 Markus Heiser
+ :license: GPL Version 2, June 1991 see Linux/COPYING for details.
+"""
+
+from sphinx.domains.c import CObject as Base_CObject
+from sphinx.domains.c import CDomain as Base_CDomain
+
+__version__ = '1.0'
+
+def setup(app):
+
+ app.override_domain(CDomain)
+
+ return dict(
+ version = __version__,
+ parallel_read_safe = True,
+ parallel_write_safe = True
+ )
+
+class CObject(Base_CObject):
+
+ """
+ Description of a C language object.
+ """
+
+class CDomain(Base_CDomain):
+
+ """C language domain."""
+ name = 'c'
+ label = 'C'
+ directives = {
+ 'function': CObject,
+ 'member': CObject,
+ 'macro': CObject,
+ 'type': CObject,
+ 'var': CObject,
+ }