Firstly, is this the correct method of supplying arguments to a custom block? I see that pipe delimited arguments are for filters, the = symbol for assignments.
I'm using Liquid::TagAttributes, to parse each argument. I’m then having to remove (with gsub) the first and last ' or " else these get output in the HTML. But the generated content is malformed if strings contain quotes. I’ve documented some examples here:
TL;DR: How should I provide/parse arguments that may contain a single or double quote(s) in a custom tag?
Not sure if this is the correct place to ask a question, but couldn't find documentation elsewhere…
I’ve created a custom liquid tag block, to render a figure with optional caption. Here’s an example:
Firstly, is this the correct method of supplying arguments to a custom block? I see that pipe delimited arguments are for filters, the = symbol for assignments.
I'm using
Liquid::TagAttributes
, to parse each argument. I’m then having to remove (withgsub
) the first and last'
or"
else these get output in the HTML. But the generated content is malformed if strings contain quotes. I’ve documented some examples here:https://gist.github.com/paulrobertlloyd/dff85e8af0f039255760
This is the code for my custom tag:
Hope this makes sense!