问题描述
我试图将包含各种尺寸的标签列表放在一起(在使用Liquid的Shopify中).尺寸使用单引号和双引号表示英寸和英尺.由于同时使用这两种方法,因此会导致字符串正确关闭的问题.我尝试使用标准的转义字符'\',但这似乎不起作用.是否可以在Liquid中转义字符,或者有人可以推荐另一种方法?
I am trying to put together a tag list that contains various sizes (in Shopify using Liquid). The sizes use single and double quotes for inches and feet. Because it uses both, it is causing issues with the string closing properly. I have tried using a standard escape character '\', but that doesn't seem to work. Is it possible to escape characters in Liquid or is there another method someone can recommend?
{% assign tags = "4'x6', 5'x8', 8'x10', 9'x12', 10'x14', 5'x7', 3'x5', 2'x3', 6'x9', 16\"x16\"x16\", 24\"x36\", 20\"x32\", 20\"x48\", 20\"x72\", 42\"x48\" rectangular, 55\"x57\" with lip" | split: ',' %}
推荐答案
从印刷上来说,引号是用来表示英尺和英寸的错误字形.而是应分别使用质数(′
)和双质数(″
),并使用乘号(×
)代替"x":
Typographically speaking, quotation marks are the wrong glyph to use to indicate feet and inches. Instead, you should use the prime (′
) and double prime (″
) symbols, respectively, and the multiplication sign (×
) instead of "x":
{% assign tags = "4′ × 6′, 5′ × 8′, ..., 16″ × 16″ × 16″, 24″ × 36″, ..., rectangular, 55″ × 57″ with lip" | split: ',' %}
如果您设置使用引号,则也许可以使用HTML实体(我不确定这是否可行):
If you're set on using quotation marks, perhaps you can use HTML entities (I'm not sure if this works or not):
{% assign tags = "4'x6', ..., 16"x16"x16", 24"x36", 20"x32", ..." | split: ',' %}
这篇关于液体字符串中的转义字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!