Commits

Leontius Adhika Pradhana committed 5885928

Added reStructuredText domain with rst:directive and rst:role directive.

Comments (0)

Files changed (2)

sphinx/domains/__init__.py

 from sphinx.domains.std import StandardDomain
 from sphinx.domains.python import PythonDomain
 from sphinx.domains.javascript import JavaScriptDomain
+from sphinx.domains.rst import ReSTDomain
 
 BUILTIN_DOMAINS = {
     'std': StandardDomain,
     'c': CDomain,
     'cpp': CPPDomain,
     'js': JavaScriptDomain,
+    'rst': ReSTDomain
 }

sphinx/domains/rst.py

+# -*- coding: utf-8 -*-
+"""
+    sphinx.domains.rst
+    ~~~~~~~~~~~~~~~~~~
+
+    The reStructuredText domain.
+
+    :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS.
+    :license: BSD, see LICENSE for details.
+"""
+
+import re
+
+from sphinx import addnodes
+from sphinx.domains import Domain, ObjType
+from sphinx.locale import l_, _
+from sphinx.directives import ObjectDescription
+from sphinx.domains.python import py_paramlist_re as js_paramlist_re
+from sphinx.roles import XRefRole
+from sphinx.util.nodes import make_refnode
+from sphinx.util.docfields import Field, GroupedField, TypedField
+
+class ReSTDirective(ObjectDescription):
+    pass
+
+class ReSTRole(ObjectDescription):
+    pass
+    
+class ReSTXRefRole(XRefRole):
+    pass
+
+class ReSTDomain(Domain):
+    """ReStructuredText domain."""
+    name = 'rst'
+    label = 'reStructuredText'
+    
+    object_types = {
+        'directive': ObjType(l_('reStructuredText directive'), 'dir'),
+        'role':      ObjType(l_('reStructuredText role'),      'role'),
+    }
+    directives = {
+        'directive': ReSTDirective,
+        'role':      ReSTRole,
+    }
+    roles = {
+        'dir':  ReSTXRefRole(),
+        'role': ReSTXRefRole(),
+    }
+    
+
+
+
+
+
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.