File tree 1 file changed +15
-10
lines changed
1 file changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,20 @@ function postHTMLParser(html, options) {
25
25
return this [ this . length - 1 ] ;
26
26
} ;
27
27
28
+ function isDirective ( directive , tag ) {
29
+ if ( directive . name instanceof RegExp ) {
30
+ var regex = RegExp ( directive . name , 'i' ) ;
31
+
32
+ return regex . test ( tag ) ;
33
+ }
34
+
35
+ if ( tag !== directive . name ) {
36
+ return false ;
37
+ }
38
+
39
+ return true ;
40
+ }
41
+
28
42
function parserDirective ( name , data ) {
29
43
var directives = objectAssign ( defaultDirectives , options . directives ) ;
30
44
var last = bufArray . last ( ) ;
@@ -33,18 +47,9 @@ function postHTMLParser(html, options) {
33
47
for ( var i = 0 ; i < directives . length ; i ++ ) {
34
48
var directive = directives [ i ] ;
35
49
var directiveText = directive . start + data + directive . end ;
36
- var isDirective = false ;
37
50
38
51
tagName = name . toLowerCase ( ) ;
39
- if ( ( directive . name instanceof RegExp ) && directive . name . test ( tagName ) ) {
40
- isDirective = true ;
41
- }
42
-
43
- if ( tagName === directive . name ) {
44
- isDirective = true ;
45
- }
46
-
47
- if ( isDirective ) {
52
+ if ( isDirective ( directive , tagName ) ) {
48
53
if ( ! last ) {
49
54
results . push ( directiveText ) ;
50
55
return ;
You can’t perform that action at this time.
0 commit comments