Commit 105be2516735cdbcea9dc9fe4251c4bf3e807311

Golmote 2016-06-16T08:11:46

Merge pull request #978 from nfagerlund/june2016_puppet_regexes Puppet highlighter: Fix over-greedy regexp detection

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/components/prism-puppet.js b/components/prism-puppet.js
index 620a60b..7035ad6 100644
--- a/components/prism-puppet.js
+++ b/components/prism-puppet.js
@@ -41,7 +41,7 @@
 		},
 		'regex': {
 			// Must be prefixed with the keyword "node" or a non-word char
-			pattern: /((?:\bnode\s+|[^\s\w\\]\s*))\/(?:[^\/\\]|\\[\s\S])+\/(?:[imx]+\b|\B)/,
+			pattern: /((?:\bnode\s+|[~=\(\[\{,]\s*|[=+]>\s*|^\s*))\/(?:[^\/\\]|\\[\s\S])+\/(?:[imx]+\b|\B)/,
 			lookbehind: true,
 			inside: {
 				// Extended regexes must have the x flag. They can contain single-line comments.