feat: inline comment tag (#514)

* style: remove unnecessary intermediate constant

* feat: add inline comment tag

* refactor: use readIdentifier when reading tag names

* docs: add inline comment tag
This commit is contained in:
jg-rp
2022-07-08 01:46:15 +08:00
committed by GitHub
parent 4a0186d62a
commit 2f87708989
9 changed files with 198 additions and 5 deletions
+8 -2
View File
@@ -207,8 +207,7 @@ export class Tokenizer {
const begin = this.p
let end = this.N
if (this.readToDelimiter('\n') !== -1) end = this.p
const token = new LiquidTagToken(input, begin, end, options, file)
return token
return new LiquidTagToken(input, begin, end, options, file)
}
mkError (msg: string, begin: number) {
@@ -234,6 +233,13 @@ export class Tokenizer {
return new IdentifierToken(this.input, begin, this.p, this.file)
}
readTagName (): string {
this.skipBlank()
// Handle inline comment tags
if (this.input[this.p] === '#') return this.input.slice(this.p, ++this.p)
return this.readIdentifier().getText()
}
readHashes (jekyllStyle?: boolean) {
const hashes = []
while (true) {