Update 'variable' definition for on Liquid for Designers wiki page
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 11.9k
- Forks
- 1.5k
- Avg merge
- 17h 55m
- Merged PRs (30d)
- 3
Description
I'm implementing a parser for Liquid and it seems like the 'Liquid for Designers' page has the closest thing to a robust spec of the language: https://github.com/Shopify/liquid/wiki/Liquid-for-Designers#expressions-and-variables
(I thought the website would be, but it doesn't define the format of variables: https://shopify.github.io/liquid/tags/variable)
It says that the only special character that can be in variables is an underscore _:
Variables. The most basic kind of expression is just the name of a variable. Liquid variables are named like Ruby variables: they should consist of alphanumeric characters and underscores, should always start with a letter, and do not have any kind of leading sigil (that is, they look like
var_name, not$var_name).
However, the implementation also supports hyphens - in variable names:
> Liquid::Template.parse(" {{ hello-world }} ").render('hello-world' => "HELLO, WORLD!!!")
=> " HELLO, WORLD!!! "
AND
It also supports a question mark ? at the end of variable name
It looks like dashes have been supported in variables names since 2014: #478
> Liquid::Template.parse(" {{ hello-world? }} ").render('hello-world?' => "HELLO.... world?!?")
=> " HELLO.... world?!? "
(Both with Liquid::Template.error_mode = :strict declared beforehand)
The wiki is closed to outside contributors, or I'd edit it myself. I propose something like:
Variables. The most basic kind of expression is just the name of a variable. Liquid variables:
- consist of alphanumeric characters, underscores, and/or hypens AND
- always start with a letter, AND
- never start with any kind of leading sigil (that is, they look like
var_name, not$var_name)- may end with a single question mark
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read the Liquid for Designers wiki page at the linked Expressions and Variables section, and compare its variable rules with the examples in this issue and issue #478. Update the definition to include hyphens and a trailing question mark while retaining the starting-letter and no-leading-sigil rules; done when the page matches supported syntax.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 58/100