File tree 2 files changed +8
-4
lines changed
2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,10 @@ export class Renderer {
36
36
return "\t" . repeat ( level + n ) ;
37
37
} ;
38
38
39
- let i = 0 , text_level = level , code = "" , lines = [ ] ;
39
+ const text_level = level ;
40
+ const lines = [ ] ;
41
+ let i = 0 ;
42
+ let code = "" ;
40
43
41
44
if ( debug && options . filename ) {
42
45
code += `${ indent ( 0 ) } // ${ options . filename } \n` ;
@@ -45,7 +48,7 @@ export class Renderer {
45
48
code += `${ indent ( 0 ) } let __output = "";\n` ;
46
49
code += `${ indent ( 0 ) } try { with (this) {\n` ;
47
50
48
- while ( true ) {
51
+ while ( i < data . length ) {
49
52
let j = data . indexOf ( START_BLOCK , i ) ;
50
53
51
54
if ( j == - 1 ) {
@@ -111,7 +114,7 @@ export class Renderer {
111
114
const command = match . groups . command ;
112
115
113
116
switch ( command ) {
114
- case "include" :
117
+ case "include" : {
115
118
const view = await this . compilePath ( match . groups . method , options . filename ? dirname ( options . filename ) : null , debug ? text_level + 2 : text_level ) ;
116
119
117
120
if ( view !== null ) {
@@ -126,6 +129,7 @@ export class Renderer {
126
129
code += `${ indent ( ) } __output += "${ escape ( new RenderingError ( `Include not found: ${ match . groups . method } ` ) ) } ";\n` ;
127
130
}
128
131
break ;
132
+ }
129
133
default :
130
134
code += `${ indent ( ) } __output += "${ escape ( new RenderingError ( `Unknown command: ${ command } ` ) ) } ";\n` ;
131
135
}
Original file line number Diff line number Diff line change 1
- import { dirname , resolve } from "path" ;
1
+ import { resolve } from "path" ;
2
2
3
3
export function Resolver ( path , base = null ) {
4
4
if ( ! path . endsWith ( ".html" ) ) {
You can’t perform that action at this time.
0 commit comments