feat: override output/tag delimiter, fixes #54

This commit is contained in:
harttle
2019-02-21 01:07:32 +08:00
parent 3dbab238ae
commit d20a043fbb
8 changed files with 84 additions and 23 deletions
+9 -4
View File
@@ -3,10 +3,15 @@ import Token from './token'
export default class DelimitedToken extends Token {
trimLeft: boolean
trimRight: boolean
constructor (raw, pos, input, file, line) {
constructor (raw, value, pos, input, file, line) {
super(raw, pos, input, file, line)
this.trimLeft = raw[2] === '-'
this.trimRight = raw[raw.length - 3] === '-'
this.value = raw.slice(this.trimLeft ? 3 : 2, this.trimRight ? -3 : -2).trim()
this.trimLeft = value[0] === '-'
this.trimRight = value[value.length - 1] === '-'
this.value = value
.slice(
this.trimLeft ? 1 : 0,
this.trimRight ? -1 : value.length
)
.trim()
}
}