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

Liquid: add simple empty keyword #2997

Merged
merged 1 commit into from
Jul 15, 2021

Conversation

JaKXz
Copy link
Collaborator

@JaKXz JaKXz commented Jul 14, 2021

Hey @RunDevelopment here's an easy one :)

I have one quick question though: I want to add an object token that is any one of the following keywords, sourced from the liquid reference

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

I was going to go with the naive new RegExp([words].join('|')) but I was wondering if you have any better suggestions?

@github-actions
Copy link

github-actions bot commented Jul 14, 2021

JS File Size Changes (gzipped)

A total of 1 files have changed, with a combined diff of +16 B (+2.4%).

file master pull size diff % diff
components/prism-liquid.min.js 672 B 688 B +16 B +2.4%

Generated by 🚫 dangerJS against 2cba059

@RunDevelopment
Copy link
Member

Thanks for the PR @JaKXz!

Use a regex literal, so /\b(?:address|all_country_option_tags|...)\b/. It's the easiest option IMO. (Using regex literals also means that our static analysis tools can deal with them, which is nice.)

@JaKXz JaKXz changed the title add simple empty keyword Liquid: add simple empty keyword Jul 14, 2021
@RunDevelopment RunDevelopment merged commit fe3bc52 into PrismJS:master Jul 15, 2021
@RunDevelopment
Copy link
Member

Thank you for contributing @JaKXz!

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

Successfully merging this pull request may close these issues.

2 participants