summaryrefslogtreecommitdiff
path: root/sphinx/domains/javascript.py
diff options
context:
space:
mode:
authorDaniel Neuhäuser <ich@danielneuhaeuser.de>2010-03-30 21:20:21 +0000
committerDaniel Neuhäuser <ich@danielneuhaeuser.de>2010-03-30 21:20:21 +0000
commit8bc0248a14682a3eb9eff55804573c4090aca3ac (patch)
tree928019dfc15c47652bdafd9188627a53ad6d4ecd /sphinx/domains/javascript.py
parent9d53f460ea1b1cd5231f75691a4cc595aaf4e017 (diff)
downloadsphinx-git-8bc0248a14682a3eb9eff55804573c4090aca3ac.tar.gz
Changed js_sig_re to handle JavaScript identifiers such as `$`.
Diffstat (limited to 'sphinx/domains/javascript.py')
-rw-r--r--sphinx/domains/javascript.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/sphinx/domains/javascript.py b/sphinx/domains/javascript.py
index c2b28e66b..184ab88af 100644
--- a/sphinx/domains/javascript.py
+++ b/sphinx/domains/javascript.py
@@ -17,9 +17,13 @@ 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*\((.*)\)')
+js_sig_re = re.compile(
+ r'''([^ .]+\.)? # object name
+ ([^ .]+\s*) # name
+ \((.*)\)$ # arguments
+''', re.VERBOSE)
-class JSFunction(ObjectDescription):
+class JSCallable(ObjectDescription):
"""
Description of a JavaScript function.
"""
@@ -27,7 +31,7 @@ class JSFunction(ObjectDescription):
match = js_sig_re.match(sig)
if match is None:
raise ValueError()
- name, arglist = match.groups()
+ obj, name, arglist = match.groups()
signode += addnodes.desc_name(name, name)
if not arglist:
@@ -68,7 +72,7 @@ class JavaScriptDomain(Domain):
"data": ObjType(l_("js data"), "data"),
}
directives = {
- "function": JSFunction,
+ "function": JSCallable,
"data": JSData,
}
roles = {