mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-18 14:00:39 -07:00
BREAKING CHANGE: trim_value_* -> trim_output_*
This commit is contained in:
@@ -4,14 +4,14 @@ import TagToken from './tag-token'
|
||||
import Token from './token'
|
||||
import OutputToken from './output-token'
|
||||
import { TokenizationError } from 'src/util/error'
|
||||
import { LiquidOptions, defaultOptions } from 'src/liquid-options'
|
||||
import { NormalizedFullOptions, applyDefault } from '../liquid-options'
|
||||
|
||||
enum ParseState { HTML, OUTPUT, TAG }
|
||||
|
||||
export default class Tokenizer {
|
||||
options: LiquidOptions
|
||||
constructor (options: LiquidOptions = defaultOptions) {
|
||||
this.options = options
|
||||
options: NormalizedFullOptions
|
||||
constructor (options?: NormalizedFullOptions) {
|
||||
this.options = applyDefault(options)
|
||||
}
|
||||
tokenize (input: string, file?: string) {
|
||||
const tokens = []
|
||||
|
||||
@@ -24,13 +24,13 @@ export default function whiteSpaceCtrl (tokens: Token[], options: LiquidOptions)
|
||||
function shouldTrimLeft (token: DelimitedToken, inRaw: boolean, options) {
|
||||
if (inRaw) return false
|
||||
if (token.type === 'tag') return token.trimLeft || options.trim_tag_left
|
||||
if (token.type === 'output') return token.trimLeft || options.trim_value_left
|
||||
if (token.type === 'output') return token.trimLeft || options.trim_output_left
|
||||
}
|
||||
|
||||
function shouldTrimRight (token: DelimitedToken, inRaw: boolean, options) {
|
||||
if (inRaw) return false
|
||||
if (token.type === 'tag') return token.trimRight || options.trim_tag_right
|
||||
if (token.type === 'output') return token.trimRight || options.trim_value_right
|
||||
if (token.type === 'output') return token.trimRight || options.trim_output_right
|
||||
}
|
||||
|
||||
function trimLeft (token: Token, greedy: boolean) {
|
||||
|
||||
Reference in New Issue
Block a user