Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add global jekyll style variable parsing #752

Open
mohas opened this issue Sep 18, 2024 · 1 comment
Open

Add global jekyll style variable parsing #752

mohas opened this issue Sep 18, 2024 · 1 comment

Comments

@mohas
Copy link

mohas commented Sep 18, 2024

Hi, currently when we use new Hash(tagToken.args, true) we can support jekyll style variables in our custom tags, however when using built-in tags, such options is not possible for example, {% render "tmp", cur=var1 %}, as some teams have strong react background, and liquidjs Hash already support jekyll style variables, please make hash to default to a value defined in the options instead of hardcoding one:

// tokenizer.ts
readHash (jekyllStyle?: boolean): HashToken | undefined {
    this.skipBlank()
    if (this.peek() === ',') ++this.p
    const begin = this.p
    const name = this.readNonEmptyIdentifier()
    if (!name) return
    let value

    this.skipBlank()

    const sep = jekyllStyle ? '=' : ':' /* Make this read from options passed to the engine */
// ex: 
//  const sep = jekyllStyle ? '=' : seperatorFromEngineOptions

    if (this.peek() === sep) {
      ++this.p
      value = this.readValue()
    }
    return new HashToken(this.input, begin, this.p, name, value, this.file)
  }

by making this new seperatorFromEngineOptions default to ':' I think backward compatibility will be preserved.

github-actions bot pushed a commit that referenced this issue Sep 22, 2024
# [10.17.0](v10.16.7...v10.17.0) (2024-09-22)

### Features

* support custom key-value separator, [#752](#752) ([6aeed25](6aeed25))
@harttle
Copy link
Owner

harttle commented Sep 22, 2024

Please try setting keyValueSeparator option to =.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants