summaryrefslogtreecommitdiff
path: root/sphinx/util/jsdump.py
diff options
context:
space:
mode:
authorSilvio Tomatis <silviot@gmail.com>2016-07-07 12:06:55 +0200
committerSilvio Tomatis <silviot@gmail.com>2016-07-08 15:27:48 +0200
commit45473b333445d590b35db95982f750c5e30ce671 (patch)
treebb72d88cb766b89ad345cc20b436ee0f90ee45a1 /sphinx/util/jsdump.py
parent7db8141238c5d9ce6c93d6f85c8820ed218fd158 (diff)
downloadsphinx-git-45473b333445d590b35db95982f750c5e30ce671.tar.gz
Make javascript search work in more contexts
The meaning of `\w` changed from python 2 to python 3. > $ python3.5 -c "import re; print(re.compile(r'[a-zA-Z]\w*$').match(u'a\xe8'));" > <_sre.SRE_Match object; span=(0, 2), match='aè'> > python -c "import re; print(re.compile(r'[a-zA-Z]\w*$').match(u'a\xe8'));" > None but the definition of what's an acceptable javascript identifier should not vary from case to case.
Diffstat (limited to 'sphinx/util/jsdump.py')
-rw-r--r--sphinx/util/jsdump.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/sphinx/util/jsdump.py b/sphinx/util/jsdump.py
index fd553bd40..43c2962f1 100644
--- a/sphinx/util/jsdump.py
+++ b/sphinx/util/jsdump.py
@@ -19,7 +19,7 @@ from sphinx.util.pycompat import u
_str_re = re.compile(r'"(\\\\|\\"|[^"])*"')
_int_re = re.compile(r'\d+')
_name_re = re.compile(r'[a-zA-Z]\w*')
-_nameonly_re = re.compile(r'[a-zA-Z]\w*$')
+_nameonly_re = re.compile(r'[a-zA-Z_][a-zA-Z0-9_]*$')
# escape \, ", control characters and everything outside ASCII
ESCAPE_ASCII = re.compile(r'([\\"]|[^\ -~])')