Commits

DasIch  committed b81846e

Changed js_sig_re to handle JavaScript identifiers such as `$`.

  • Participants
  • Parent commits b0fe1c1

Comments (0)

Files changed (1)

File sphinx/domains/javascript.py

 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.
     """
         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:
         "data": ObjType(l_("js data"), "data"),
     }
     directives = {
-        "function": JSFunction,
+        "function": JSCallable,
         "data": JSData,
     }
     roles = {