File tree 1 file changed +11
-2
lines changed
1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,11 @@ function Compiler(node, options) {
57
57
if ( this . pp && typeof this . pp !== 'string' ) {
58
58
this . pp = ' ' ;
59
59
}
60
+ if ( this . pp && ! / ^ \s + $ / . test ( this . pp ) ) {
61
+ throw new Error (
62
+ 'The pretty parameter should either be a boolean or whitespace only string'
63
+ ) ;
64
+ }
60
65
this . debug = false !== options . compileDebug ;
61
66
this . indents = 0 ;
62
67
this . parentIndents = 0 ;
@@ -452,7 +457,9 @@ Compiler.prototype = {
452
457
visitMixinBlock : function ( block ) {
453
458
if ( this . pp )
454
459
this . buf . push (
455
- "pug_indent.push('" + Array ( this . indents + 1 ) . join ( this . pp ) + "');"
460
+ 'pug_indent.push(' +
461
+ stringify ( Array ( this . indents + 1 ) . join ( this . pp ) ) +
462
+ ');'
456
463
) ;
457
464
this . buf . push ( 'block && block();' ) ;
458
465
if ( this . pp ) this . buf . push ( 'pug_indent.pop();' ) ;
@@ -504,7 +511,9 @@ Compiler.prototype = {
504
511
this . mixins [ key ] . used = true ;
505
512
if ( pp )
506
513
this . buf . push (
507
- "pug_indent.push('" + Array ( this . indents + 1 ) . join ( pp ) + "');"
514
+ 'pug_indent.push(' +
515
+ stringify ( Array ( this . indents + 1 ) . join ( pp ) ) +
516
+ ');'
508
517
) ;
509
518
if ( block || attrs . length || attrsBlocks . length ) {
510
519
this . buf . push ( name + '.call({' ) ;
You can’t perform that action at this time.
0 commit comments