feat: support Jekyll-like include syntax, see #441

This commit is contained in:
Harttle
2022-01-19 23:07:25 +08:00
committed by Harttle
parent d71d0a0c20
commit 388d0fbbc4
7 changed files with 141 additions and 11 deletions
+5 -4
View File
@@ -233,16 +233,16 @@ export class Tokenizer {
return new IdentifierToken(this.input, begin, this.p, this.file)
}
readHashes () {
readHashes (jekyllStyle?: boolean) {
const hashes = []
while (true) {
const hash = this.readHash()
const hash = this.readHash(jekyllStyle)
if (!hash) return hashes
hashes.push(hash)
}
}
readHash (): HashToken | undefined {
readHash (jekyllStyle?: boolean): HashToken | undefined {
this.skipBlank()
if (this.peek() === ',') ++this.p
const begin = this.p
@@ -251,7 +251,8 @@ export class Tokenizer {
let value
this.skipBlank()
if (this.peek() === ':') {
const sep = jekyllStyle ? '=' : ':'
if (this.peek() === sep) {
++this.p
value = this.readValue()
}