Added a :js:func: role to refer to functions described with the js:function:: directive.

This commit is contained in:
Daniel Neuhäuser 2010-03-30 19:14:01 +00:00
parent 9837a08294
commit 25b8e87fee
3 changed files with 11 additions and 0 deletions

View File

@ -556,3 +556,7 @@ The JavaScript domain (name **js**) provides the following directives:
Describe a JavaScript function. If you want to document optional
arguments use square brackets as :ref:`documented <signatures>` for Python
signatures.
These roles are provided to refer to the described objects:
.. role:: js:func

View File

@ -15,6 +15,7 @@ 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
js_sig_re = re.compile(r'(\w+)\s*\((.*)\)')
@ -63,3 +64,6 @@ class JavaScriptDomain(Domain):
directives = {
"function": JSFunction,
}
roles = {
"func": XRefRole(fix_parens=True),
}

View File

@ -90,6 +90,9 @@ With target: :c:func:`Sphinx_DoSomething()` (parentheses are handled),
Without target: :c:func:`CFunction`. :c:func:`!malloc`.
:js:func:`foo()`
:js:func:`foo`
Others
======