Liquid: Removed unmatchable object variants (#3135)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
diff --git a/components/prism-liquid.js b/components/prism-liquid.js
index b8f27fe..8b9981a 100644
--- a/components/prism-liquid.js
+++ b/components/prism-liquid.js
@@ -12,7 +12,7 @@ Prism.languages.liquid = {
greedy: true
},
'keyword': /\b(?:as|assign|break|(?:end)?(?:capture|case|comment|for|form|if|paginate|raw|style|tablerow|unless)|continue|cycle|decrement|echo|else|elsif|in|include|increment|limit|liquid|offset|range|render|reversed|section|when|with)\b/,
- 'object': /\b(?:address|all_country_option_tags|article|block|blog|cart|checkout|collection|color|comment|country|country_option_tags|currency|current_page|current_tags|customer|customer_address|date|discount_allocation|discount_application|external_video|filter|filter_value|font|forloop|form|fulfillment|generic_file|gift_card|group|handle|image|line_item|link|linklist|localization|location|measurement|media|metafield|model|model_source|order|page|page_description|page_image|page_title|paginate|part|policy|product|product_option|recommendations|request|robots|routes|rule|script|search|section|selling_plan|selling_plan_allocation|selling_plan_group|shipping_method|shop|shop_locale|sitemap|store_availability|tablerow|tax_line|template|theme|transaction|unit_price_measurement|user_agent|variant|video|video_source)\b/,
+ 'object': /\b(?:address|all_country_option_tags|article|block|blog|cart|checkout|collection|color|country|country_option_tags|currency|current_page|current_tags|customer|customer_address|date|discount_allocation|discount_application|external_video|filter|filter_value|font|forloop|fulfillment|generic_file|gift_card|group|handle|image|line_item|link|linklist|localization|location|measurement|media|metafield|model|model_source|order|page|page_description|page_image|page_title|part|policy|product|product_option|recommendations|request|robots|routes|rule|script|search|selling_plan|selling_plan_allocation|selling_plan_group|shipping_method|shop|shop_locale|sitemap|store_availability|tax_line|template|theme|transaction|unit_price_measurement|user_agent|variant|video|video_source)\b/,
'function': [
{
pattern: /(\|\s*)\w+/,
diff --git a/components/prism-liquid.min.js b/components/prism-liquid.min.js
index 98b04ae..a405414 100644
--- a/components/prism-liquid.min.js
+++ b/components/prism-liquid.min.js
@@ -1 +1 @@
-Prism.languages.liquid={comment:{pattern:/(^\{%\s*comment\s*%\})[\s\S]+(?=\{%\s*endcomment\s*%\}$)/,lookbehind:!0},delimiter:{pattern:/^\{(?:\{\{|[%\{])-?|-?(?:\}\}|[%\}])\}$/,alias:"punctuation"},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},keyword:/\b(?:as|assign|break|(?:end)?(?:capture|case|comment|for|form|if|paginate|raw|style|tablerow|unless)|continue|cycle|decrement|echo|else|elsif|in|include|increment|limit|liquid|offset|range|render|reversed|section|when|with)\b/,object:/\b(?:address|all_country_option_tags|article|block|blog|cart|checkout|collection|color|comment|country|country_option_tags|currency|current_page|current_tags|customer|customer_address|date|discount_allocation|discount_application|external_video|filter|filter_value|font|forloop|form|fulfillment|generic_file|gift_card|group|handle|image|line_item|link|linklist|localization|location|measurement|media|metafield|model|model_source|order|page|page_description|page_image|page_title|paginate|part|policy|product|product_option|recommendations|request|robots|routes|rule|script|search|section|selling_plan|selling_plan_allocation|selling_plan_group|shipping_method|shop|shop_locale|sitemap|store_availability|tablerow|tax_line|template|theme|transaction|unit_price_measurement|user_agent|variant|video|video_source)\b/,function:[{pattern:/(\|\s*)\w+/,lookbehind:!0,alias:"filter"},{pattern:/(\.\s*)(?:first|last|size)/,lookbehind:!0}],boolean:/\b(?:false|nil|true)\b/,range:{pattern:/\.\./,alias:"operator"},number:/\b\d+(?:\.\d+)?\b/,operator:/[!=]=|<>|[<>]=?|[|?:=-]|\b(?:and|contains(?=\s)|or)\b/,punctuation:/[.,\[\]()]/,empty:{pattern:/\bempty\b/,alias:"keyword"}},Prism.hooks.add("before-tokenize",function(e){var a=!1;Prism.languages["markup-templating"].buildPlaceholders(e,"liquid",/\{%\s*comment\s*%\}[\s\S]*?\{%\s*endcomment\s*%\}|\{(?:%[\s\S]*?%|\{\{[\s\S]*?\}\}|\{[\s\S]*?\})\}/g,function(e){var t=/^\{%-?\s*(\w+)/.exec(e);if(t){var n=t[1];if("raw"===n&&!a)return a=!0;if("endraw"===n)return!(a=!1)}return!a})}),Prism.hooks.add("after-tokenize",function(e){Prism.languages["markup-templating"].tokenizePlaceholders(e,"liquid")});
\ No newline at end of file
+Prism.languages.liquid={comment:{pattern:/(^\{%\s*comment\s*%\})[\s\S]+(?=\{%\s*endcomment\s*%\}$)/,lookbehind:!0},delimiter:{pattern:/^\{(?:\{\{|[%\{])-?|-?(?:\}\}|[%\}])\}$/,alias:"punctuation"},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},keyword:/\b(?:as|assign|break|(?:end)?(?:capture|case|comment|for|form|if|paginate|raw|style|tablerow|unless)|continue|cycle|decrement|echo|else|elsif|in|include|increment|limit|liquid|offset|range|render|reversed|section|when|with)\b/,object:/\b(?:address|all_country_option_tags|article|block|blog|cart|checkout|collection|color|country|country_option_tags|currency|current_page|current_tags|customer|customer_address|date|discount_allocation|discount_application|external_video|filter|filter_value|font|forloop|fulfillment|generic_file|gift_card|group|handle|image|line_item|link|linklist|localization|location|measurement|media|metafield|model|model_source|order|page|page_description|page_image|page_title|part|policy|product|product_option|recommendations|request|robots|routes|rule|script|search|selling_plan|selling_plan_allocation|selling_plan_group|shipping_method|shop|shop_locale|sitemap|store_availability|tax_line|template|theme|transaction|unit_price_measurement|user_agent|variant|video|video_source)\b/,function:[{pattern:/(\|\s*)\w+/,lookbehind:!0,alias:"filter"},{pattern:/(\.\s*)(?:first|last|size)/,lookbehind:!0}],boolean:/\b(?:false|nil|true)\b/,range:{pattern:/\.\./,alias:"operator"},number:/\b\d+(?:\.\d+)?\b/,operator:/[!=]=|<>|[<>]=?|[|?:=-]|\b(?:and|contains(?=\s)|or)\b/,punctuation:/[.,\[\]()]/,empty:{pattern:/\bempty\b/,alias:"keyword"}},Prism.hooks.add("before-tokenize",function(e){var i=!1;Prism.languages["markup-templating"].buildPlaceholders(e,"liquid",/\{%\s*comment\s*%\}[\s\S]*?\{%\s*endcomment\s*%\}|\{(?:%[\s\S]*?%|\{\{[\s\S]*?\}\}|\{[\s\S]*?\})\}/g,function(e){var t=/^\{%-?\s*(\w+)/.exec(e);if(t){var n=t[1];if("raw"===n&&!i)return i=!0;if("endraw"===n)return!(i=!1)}return!i})}),Prism.hooks.add("after-tokenize",function(e){Prism.languages["markup-templating"].tokenizePlaceholders(e,"liquid")});
\ No newline at end of file
diff --git a/tests/languages/liquid/object_feature.test b/tests/languages/liquid/object_feature.test
index 441e8ed..b2af4d4 100644
--- a/tests/languages/liquid/object_feature.test
+++ b/tests/languages/liquid/object_feature.test
@@ -7,7 +7,6 @@
{{ checkout }}
{{ collection }}
{{ color }}
-{{ comment }}
{{ country }}
{{ country_option_tags }}
{{ currency }}
@@ -23,7 +22,6 @@
{{ filter_value }}
{{ font }}
{{ forloop }}
-{{ form }}
{{ fulfillment }}
{{ generic_file }}
{{ gift_card }}
@@ -45,7 +43,6 @@
{{ page_description }}
{{ page_image }}
{{ page_title }}
-{{ paginate }}
{{ part }}
{{ policy }}
{{ product }}
@@ -57,7 +54,6 @@
{{ rule }}
{{ script }}
{{ search }}
-{{ section }}
{{ selling_plan }}
{{ selling_plan_allocation }}
{{ selling_plan_group }}
@@ -66,7 +62,6 @@
{{ shop_locale }}
{{ sitemap }}
{{ store_availability }}
-{{ tablerow }}
{{ tax_line }}
{{ template }}
{{ theme }}
@@ -127,11 +122,6 @@
]],
["liquid", [
["delimiter", "{{"],
- ["keyword", "comment"],
- ["delimiter", "}}"]
- ]],
- ["liquid", [
- ["delimiter", "{{"],
["object", "country"],
["delimiter", "}}"]
]],
@@ -207,11 +197,6 @@
]],
["liquid", [
["delimiter", "{{"],
- ["keyword", "form"],
- ["delimiter", "}}"]
- ]],
- ["liquid", [
- ["delimiter", "{{"],
["object", "fulfillment"],
["delimiter", "}}"]
]],
@@ -317,11 +302,6 @@
]],
["liquid", [
["delimiter", "{{"],
- ["keyword", "paginate"],
- ["delimiter", "}}"]
- ]],
- ["liquid", [
- ["delimiter", "{{"],
["object", "part"],
["delimiter", "}}"]
]],
@@ -377,11 +357,6 @@
]],
["liquid", [
["delimiter", "{{"],
- ["keyword", "section"],
- ["delimiter", "}}"]
- ]],
- ["liquid", [
- ["delimiter", "{{"],
["object", "selling_plan"],
["delimiter", "}}"]
]],
@@ -422,11 +397,6 @@
]],
["liquid", [
["delimiter", "{{"],
- ["keyword", "tablerow"],
- ["delimiter", "}}"]
- ]],
- ["liquid", [
- ["delimiter", "{{"],
["object", "tax_line"],
["delimiter", "}}"]
]],