File tree 3 files changed +13
-1
lines changed
3 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,8 @@ import {
51
51
getScriptParser ,
52
52
getParserLangFromSFC ,
53
53
} from "../common/parser-options"
54
+ // import type { Token } from "pug-lexer";
55
+ import lex from "pug-lexer" ;
54
56
55
57
const DIRECTIVE_NAME = / ^ (?: v - | [ . : @ # ] ) .* [ ^ . : @ # ] $ / u
56
58
const DT_DD = / ^ d [ d t ] $ / u
@@ -300,6 +302,14 @@ export class Parser {
300
302
}
301
303
this . postProcessesForScript = [ ]
302
304
305
+ // Process pug
306
+ const match = / < t e m p l a t e \s + l a n g = " p u g " > (?< content > .* ) < \/ t e m p l a t e > / isu. exec ( this . text )
307
+ if ( match && match . groups && match . groups . content ) {
308
+ const pugTokens = lex ( match . groups . content )
309
+ console . log ( pugTokens ) ;
310
+
311
+ }
312
+
303
313
return doc
304
314
}
305
315
Original file line number Diff line number Diff line change @@ -106,6 +106,8 @@ export function parseForESLint(
106
106
template != null && ( templateLang === "html" || templateLang === "pug" )
107
107
? Object . assign ( template , concreteInfo )
108
108
: undefined
109
+ // if (templateLang === "pug")
110
+ // console.log(templateBody)
109
111
110
112
const scriptParser = getScriptParser ( options . parser , ( ) =>
111
113
getParserLangFromSFC ( rootAST ) ,
Original file line number Diff line number Diff line change 1
1
<template lang="pug">
2
- Hello !
2
+ p {{ greeting }} World !
3
3
</template >
You can’t perform that action at this time.
0 commit comments