├── .github └── workflows │ └── build-test.yml ├── .gitignore ├── .prettierignore ├── .prettierrc.js ├── .travis.yml ├── CODEOWNERS ├── LICENSE ├── README.md ├── __benchmarks__ ├── benchmark.engine.ts ├── benchmark.parser.ts ├── index.ts ├── typings.d.ts └── util.ts ├── __tests__ ├── api.test.ts ├── assembler.test.ts ├── cldr.ts ├── compiler.test.ts ├── context.test.ts ├── engine.test.ts ├── enum.test.ts ├── errors.test.ts ├── eval.test.ts ├── executor.test.ts ├── helpers.ts ├── include.test.ts ├── loader.ts ├── matcher.test.ts ├── math.test.ts ├── mathext.test.ts ├── node.test.ts ├── parser.test.ts ├── patterns.test.ts ├── plugins │ ├── enums.test.ts │ ├── formatters.commerce.test.ts │ ├── formatters.content.test.ts │ ├── formatters.core.test.ts │ ├── formatters.date.test.ts │ ├── formatters.i18n.test.ts │ ├── formatters.missing.test.ts │ ├── formatters.social.test.ts │ ├── messages.test.ts │ ├── options.test.ts │ ├── predicates.commerce.test.ts │ ├── predicates.content.test.ts │ ├── predicates.core.test.ts │ ├── predicates.missing.test.ts │ ├── predicates.slide.test.ts │ ├── predicates.social.test.ts │ ├── resources │ │ ├── f-absurl-1.html │ │ ├── f-activate-twitter-links-1.html │ │ ├── f-add-to-cart-btn-1.html │ │ ├── f-add-to-cart-btn-10.html │ │ ├── f-add-to-cart-btn-2.html │ │ ├── f-add-to-cart-btn-3.html │ │ ├── f-add-to-cart-btn-4.html │ │ ├── f-add-to-cart-btn-5.html │ │ ├── f-add-to-cart-btn-6.html │ │ ├── f-add-to-cart-btn-7.html │ │ ├── f-add-to-cart-btn-8.html │ │ ├── f-add-to-cart-btn-9.html │ │ ├── f-add-to-cart-btn-subscribable-attribute-false.html │ │ ├── f-add-to-cart-btn-subscribable-attribute-true.html │ │ ├── f-apply-1.html │ │ ├── f-audio-player-1.html │ │ ├── f-bookkeeper-money-format-1.html │ │ ├── f-bookkeeper-money-format-2.html │ │ ├── f-bookkeeper-money-format-3.html │ │ ├── f-capitalize-1.html │ │ ├── f-cart-quantity-1.html │ │ ├── f-cart-quantity-2.html │ │ ├── f-cart-subtotal-1.html │ │ ├── f-cart-url-1.html │ │ ├── f-child-image-meta-1.html │ │ ├── f-child-image-meta-2.html │ │ ├── f-child-image-meta-3.html │ │ ├── f-child-image-meta-4.html │ │ ├── f-child-image-meta-5.html │ │ ├── f-child-image-meta-6.html │ │ ├── f-color-weight-1.html │ │ ├── f-comment-count-1.html │ │ ├── f-comment-count-2.html │ │ ├── f-comment-count-3.html │ │ ├── f-comment-link-1.html │ │ ├── f-comment-link-2.html │ │ ├── f-comment-link-3.html │ │ ├── f-comments-1.html │ │ ├── f-comments-2.html │ │ ├── f-comments-3.html │ │ ├── f-count-1.html │ │ ├── f-cover-image-meta-1.html │ │ ├── f-cycle-1.html │ │ ├── f-date-1.html │ │ ├── f-date-2.html │ │ ├── f-date-3.html │ │ ├── f-datetime-1.html │ │ ├── f-datetime-2.html │ │ ├── f-datetime-interval-1.html │ │ ├── f-decimal-1.html │ │ ├── f-encode-space-1.html │ │ ├── f-encode-uri-1.html │ │ ├── f-encode-uri-component-1.html │ │ ├── f-format-1.html │ │ ├── f-format-2.html │ │ ├── f-format-3.html │ │ ├── f-from-price-1.html │ │ ├── f-from-price-2.html │ │ ├── f-from-price-3.html │ │ ├── f-from-price-4.html │ │ ├── f-from-price-5.html │ │ ├── f-from-price-6.html │ │ ├── f-from-price-7.html │ │ ├── f-get-1.html │ │ ├── f-get-2.html │ │ ├── f-get-3.html │ │ ├── f-get-4.html │ │ ├── f-get-5.html │ │ ├── f-get-6.html │ │ ├── f-get-7.html │ │ ├── f-google-calendar-url-1.html │ │ ├── f-google-calendar-url-2.html │ │ ├── f-google-calendar-url-3.html │ │ ├── f-height-1.html │ │ ├── f-html-1.html │ │ ├── f-htmlattr-1.html │ │ ├── f-htmltag-1.html │ │ ├── f-humanize-duration-1.html │ │ ├── f-image-1.html │ │ ├── f-image-2.html │ │ ├── f-image-3.html │ │ ├── f-image-4.html │ │ ├── f-image-5.html │ │ ├── f-image-6.html │ │ ├── f-image-7.html │ │ ├── f-image-color-1.html │ │ ├── f-image-color-2.html │ │ ├── f-image-color-3.html │ │ ├── f-image-color-4.html │ │ ├── f-image-color-5.html │ │ ├── f-image-meta-1.html │ │ ├── f-image-meta-2.html │ │ ├── f-image-srcset-1.html │ │ ├── f-image-srcset-2.html │ │ ├── f-image-srcset-3.html │ │ ├── f-image-srcset-4.html │ │ ├── f-image-srcset-5.html │ │ ├── f-item-classes-1.html │ │ ├── f-item-classes-2.html │ │ ├── f-item-classes-3.html │ │ ├── f-iter-1.html │ │ ├── f-json-1.html │ │ ├── f-json-2.html │ │ ├── f-json-3.html │ │ ├── f-json-4.html │ │ ├── f-json-5.html │ │ ├── f-json-pretty-1.html │ │ ├── f-json-pretty-2.html │ │ ├── f-key-by-1.html │ │ ├── f-like-button-1.html │ │ ├── f-like-button-2.html │ │ ├── f-lookup-1.html │ │ ├── f-macro-1.html │ │ ├── f-macro-10.html │ │ ├── f-macro-11.html │ │ ├── f-macro-12.html │ │ ├── f-macro-2.html │ │ ├── f-macro-3.html │ │ ├── f-macro-4.html │ │ ├── f-macro-5.html │ │ ├── f-macro-6.html │ │ ├── f-macro-7.html │ │ ├── f-macro-8.html │ │ ├── f-macro-9.html │ │ ├── f-macro-ctx-1.html │ │ ├── f-message-1.html │ │ ├── f-message-2.html │ │ ├── f-message-3.html │ │ ├── f-message-4.html │ │ ├── f-message-5.html │ │ ├── f-message-6.html │ │ ├── f-message-7.html │ │ ├── f-message-plural-1.html │ │ ├── f-message-plural-2.html │ │ ├── f-missing-1.html │ │ ├── f-mod-1.html │ │ ├── f-money-1.html │ │ ├── f-money-format-1.html │ │ ├── f-money-format-2.html │ │ ├── f-money-format-camel-1.html │ │ ├── f-money-string-1.html │ │ ├── f-normal-price-1.html │ │ ├── f-normal-price-2.html │ │ ├── f-normal-price-3.html │ │ ├── f-normal-price-4.html │ │ ├── f-normal-price-5.html │ │ ├── f-normal-price-6.html │ │ ├── f-normal-price-7.html │ │ ├── f-output-1.html │ │ ├── f-percentage-format-1.html │ │ ├── f-percentage-format-2.html │ │ ├── f-percentage-format-3.html │ │ ├── f-plural-1.html │ │ ├── f-pluralize-1.html │ │ ├── f-product-checkout-1.html │ │ ├── f-product-price-1.html │ │ ├── f-product-price-10.html │ │ ├── f-product-price-2.html │ │ ├── f-product-price-3.html │ │ ├── f-product-price-4.html │ │ ├── f-product-price-5.html │ │ ├── f-product-price-6.html │ │ ├── f-product-price-7.html │ │ ├── f-product-price-8.html │ │ ├── f-product-price-9.html │ │ ├── f-product-price-finite-subscription-bi-monthly.html │ │ ├── f-product-price-finite-subscription-bi-weekly-for-a-year.html │ │ ├── f-product-price-finite-subscription-bi-weekly.html │ │ ├── f-product-price-finite-subscription-from-bi-monthly.html │ │ ├── f-product-price-finite-subscription-from-bi-weekly.html │ │ ├── f-product-price-finite-subscription-from-monthly.html │ │ ├── f-product-price-finite-subscription-from-weekly-on-sale.html │ │ ├── f-product-price-finite-subscription-from-weekly.html │ │ ├── f-product-price-finite-subscription-monthly-for-a-year.html │ │ ├── f-product-price-finite-subscription-monthly.html │ │ ├── f-product-price-finite-subscription-on-sale-bi-monthly.html │ │ ├── f-product-price-finite-subscription-on-sale-bi-weekly.html │ │ ├── f-product-price-finite-subscription-on-sale-monthly.html │ │ ├── f-product-price-finite-subscription-on-sale-weekly.html │ │ ├── f-product-price-finite-subscription-weekly-localized-multiple.html │ │ ├── f-product-price-finite-subscription-weekly-localized.html │ │ ├── f-product-price-finite-subscription-weekly.html │ │ ├── f-product-price-subscription-bi-monthly.html │ │ ├── f-product-price-subscription-bi-weekly.html │ │ ├── f-product-price-subscription-from-bi-monthly.html │ │ ├── f-product-price-subscription-from-bi-weekly.html │ │ ├── f-product-price-subscription-from-monthly.html │ │ ├── f-product-price-subscription-from-weekly-on-sale.html │ │ ├── f-product-price-subscription-from-weekly.html │ │ ├── f-product-price-subscription-monthly.html │ │ ├── f-product-price-subscription-on-sale-bi-monthly.html │ │ ├── f-product-price-subscription-on-sale-bi-weekly.html │ │ ├── f-product-price-subscription-on-sale-monthly.html │ │ ├── f-product-price-subscription-on-sale-weekly.html │ │ ├── f-product-price-subscription-weekly-localized-multiple.html │ │ ├── f-product-price-subscription-weekly-localized.html │ │ ├── f-product-price-subscription-weekly-plan-unavailable.html │ │ ├── f-product-price-subscription-weekly.html │ │ ├── f-product-quick-view-1.html │ │ ├── f-product-quick-view-2.html │ │ ├── f-product-quick-view-3.html │ │ ├── f-product-quick-view-4.html │ │ ├── f-product-quick-view-5.html │ │ ├── f-product-restock-notification-1.html │ │ ├── f-product-restock-notification-2.html │ │ ├── f-product-restock-notification-3.html │ │ ├── f-product-restock-notification-4.html │ │ ├── f-product-restock-notification-5.html │ │ ├── f-product-restock-notification-6.html │ │ ├── f-product-scarcity-1.html │ │ ├── f-product-scarcity-2.html │ │ ├── f-product-scarcity-3.html │ │ ├── f-product-scarcity-4.html │ │ ├── f-product-scarcity-5.html │ │ ├── f-product-scarcity-6.html │ │ ├── f-product-status-1.html │ │ ├── f-product-status-2.html │ │ ├── f-product-status-3.html │ │ ├── f-product-status-4.html │ │ ├── f-product-status-5.html │ │ ├── f-product-status-6.html │ │ ├── f-product-status-7.html │ │ ├── f-product-status-8.html │ │ ├── f-product-status-9.html │ │ ├── f-prop-1.html │ │ ├── f-prop-2.html │ │ ├── f-prop-3.html │ │ ├── f-quantity-input-1.html │ │ ├── f-quantity-input-2.html │ │ ├── f-quantity-input-3.html │ │ ├── f-quantity-input-4.html │ │ ├── f-quantity-input-5.html │ │ ├── f-raw-1.html │ │ ├── f-relative-time-1.html │ │ ├── f-resized-1.html │ │ ├── f-round-1.html │ │ ├── f-safe-1.html │ │ ├── f-sale-price-1.html │ │ ├── f-sale-price-2.html │ │ ├── f-sale-price-3.html │ │ ├── f-sale-price-4.html │ │ ├── f-sale-price-5.html │ │ ├── f-sale-price-6.html │ │ ├── f-sale-price-7.html │ │ ├── f-slugify-1.html │ │ ├── f-smartypants-1.html │ │ ├── f-social-button-1.html │ │ ├── f-social-button-inline-1.html │ │ ├── f-str-1.html │ │ ├── f-subscription-price-multiple-variants-and-multiple-pricing-options.html │ │ ├── f-subscription-price-multiple-variants-from-price.html │ │ ├── f-subscription-price-no-pricing-options.html │ │ ├── f-subscription-price-on-sale-variants-pricing-options.html │ │ ├── f-subscription-price-one-on-sale-pricing-option.html │ │ ├── f-subscription-price-one-pricing-option.html │ │ ├── f-subscription-price-variants-with-same-pricing.html │ │ ├── f-summary-form-field-address-1.html │ │ ├── f-summary-form-field-address-2.html │ │ ├── f-summary-form-field-checkbox-1.html │ │ ├── f-summary-form-field-checkbox-2.html │ │ ├── f-summary-form-field-checkbox-3.html │ │ ├── f-summary-form-field-date-1.html │ │ ├── f-summary-form-field-default-1.html │ │ ├── f-summary-form-field-likert-1.html │ │ ├── f-summary-form-field-name-1.html │ │ ├── f-summary-form-field-phone-1.html │ │ ├── f-summary-form-field-phone-2.html │ │ ├── f-summary-form-field-time-1.html │ │ ├── f-summary-form-field-time-2.html │ │ ├── f-summary-form-field-time-3.html │ │ ├── f-summary-form-field-unk-1.html │ │ ├── f-timesince-1.html │ │ ├── f-truncate-1.html │ │ ├── f-twitter-follow-button-1.html │ │ ├── f-twitter-follow-button-2.html │ │ ├── f-url-encode-1.html │ │ ├── f-variant-descriptor-1.html │ │ ├── f-variant-descriptor-2.html │ │ ├── f-variants-select-1.html │ │ ├── f-variants-select-2.html │ │ ├── f-variants-select-3.html │ │ ├── f-variants-select-4.html │ │ ├── f-variants-select-5.html │ │ ├── f-variants-select-6.html │ │ ├── f-variants-select-7.html │ │ ├── f-variants-select-subscription.html │ │ ├── f-video-1.html │ │ ├── f-video-2.html │ │ ├── f-video-3.html │ │ ├── f-website-color-1.html │ │ ├── f-website-color-2.html │ │ ├── f-website-color-3.html │ │ ├── f-website-color-4.html │ │ ├── f-website-color-5.html │ │ ├── f-width-1.html │ │ ├── get-item-variant-options.json │ │ ├── get-total-stock-remaining.json │ │ ├── has-variants.json │ │ ├── has-varied-prices.json │ │ ├── i18n │ │ │ ├── f-datetime-interval-1.html │ │ │ ├── f-decimal-1.html │ │ │ ├── f-decimal-2.html │ │ │ ├── f-foo.html │ │ │ ├── f-message-datetime-interval-en-US.html │ │ │ ├── f-message-datetime-interval-fr-FR.html │ │ │ ├── f-message-named-args.html │ │ │ ├── f-message-plural-en-US.html │ │ │ ├── f-message-plural-fr-FR.html │ │ │ ├── f-message-plural-pl-PL.html │ │ │ ├── f-message-units-en-US.html │ │ │ ├── f-message-units-fr-FR.html │ │ │ ├── f-unit-angle-en-US.html │ │ │ ├── f-unit-area-en-US.html │ │ │ ├── f-unit-digital-en-US.html │ │ │ ├── f-unit-duration-en-US.html │ │ │ ├── f-unit-frequency-en-US.html │ │ │ ├── f-unit-length-en-US.html │ │ │ ├── f-unit-temperature-en-US.html │ │ │ ├── i18n-money-format-AUD-de_DE.html │ │ │ ├── i18n-money-format-AUD-en_UK.html │ │ │ ├── i18n-money-format-AUD-en_US.html │ │ │ ├── i18n-money-format-AUD-es_US.html │ │ │ ├── i18n-money-format-AUD-fr_FR.html │ │ │ ├── i18n-money-format-AUD-sv_SE.html │ │ │ ├── i18n-money-format-CAD-de_DE.html │ │ │ ├── i18n-money-format-CAD-en_UK.html │ │ │ ├── i18n-money-format-CAD-en_US.html │ │ │ ├── i18n-money-format-CAD-es_US.html │ │ │ ├── i18n-money-format-CAD-fr_FR.html │ │ │ ├── i18n-money-format-CAD-sv_SE.html │ │ │ ├── i18n-money-format-EUR-de_DE.html │ │ │ ├── i18n-money-format-EUR-en_UK.html │ │ │ ├── i18n-money-format-EUR-en_US.html │ │ │ ├── i18n-money-format-EUR-es_US.html │ │ │ ├── i18n-money-format-EUR-fr_FR.html │ │ │ ├── i18n-money-format-EUR-sv_SE.html │ │ │ ├── i18n-money-format-GBP-de_DE.html │ │ │ ├── i18n-money-format-GBP-en_UK.html │ │ │ ├── i18n-money-format-GBP-en_US.html │ │ │ ├── i18n-money-format-GBP-es_US.html │ │ │ ├── i18n-money-format-GBP-fr_FR.html │ │ │ ├── i18n-money-format-GBP-sv_SE.html │ │ │ ├── i18n-money-format-JPY-de_DE.html │ │ │ ├── i18n-money-format-JPY-en_UK.html │ │ │ ├── i18n-money-format-JPY-en_US.html │ │ │ ├── i18n-money-format-JPY-es_US.html │ │ │ ├── i18n-money-format-JPY-fr_FR.html │ │ │ ├── i18n-money-format-JPY-sv_SE.html │ │ │ ├── i18n-money-format-SEK-de_DE.html │ │ │ ├── i18n-money-format-SEK-en_UK.html │ │ │ ├── i18n-money-format-SEK-en_US.html │ │ │ ├── i18n-money-format-SEK-es_US.html │ │ │ ├── i18n-money-format-SEK-fr_FR.html │ │ │ ├── i18n-money-format-SEK-sv_SE.html │ │ │ ├── i18n-money-format-USD-de_DE.html │ │ │ ├── i18n-money-format-USD-en_UK.html │ │ │ ├── i18n-money-format-USD-en_US.html │ │ │ ├── i18n-money-format-USD-es_US.html │ │ │ ├── i18n-money-format-USD-fr_FR.html │ │ │ ├── i18n-money-format-USD-sv_SE.html │ │ │ └── units │ │ │ │ ├── _numbers.json │ │ │ │ ├── acceleration-in.html │ │ │ │ ├── acceleration-out-en-US.html │ │ │ │ ├── acceleration-out-fr-FR.html │ │ │ │ ├── angle-in.html │ │ │ │ ├── angle-out-en-US.html │ │ │ │ ├── angle-out-fr-FR.html │ │ │ │ ├── area-in.html │ │ │ │ ├── area-out-en-US.html │ │ │ │ ├── area-out-fr-FR.html │ │ │ │ ├── consumption-in.html │ │ │ │ ├── consumption-out-en-US.html │ │ │ │ ├── consumption-out-fr-FR.html │ │ │ │ ├── digital-in.html │ │ │ │ ├── digital-out-en-US.html │ │ │ │ ├── digital-out-fr-FR.html │ │ │ │ ├── duration-in.html │ │ │ │ ├── duration-out-en-US.html │ │ │ │ ├── duration-out-fr-FR.html │ │ │ │ ├── electric-in.html │ │ │ │ ├── electric-out-en-US.html │ │ │ │ ├── electric-out-fr-FR.html │ │ │ │ ├── energy-in.html │ │ │ │ ├── energy-out-en-US.html │ │ │ │ ├── energy-out-fr-FR.html │ │ │ │ ├── frequency-in.html │ │ │ │ ├── frequency-out-en-US.html │ │ │ │ ├── frequency-out-fr-FR.html │ │ │ │ ├── length-in.html │ │ │ │ ├── length-out-en-US.html │ │ │ │ ├── length-out-fr-FR.html │ │ │ │ ├── mass-in.html │ │ │ │ ├── mass-out-en-US.html │ │ │ │ ├── mass-out-fr-FR.html │ │ │ │ ├── power-in.html │ │ │ │ ├── power-out-en-US.html │ │ │ │ ├── power-out-fr-FR.html │ │ │ │ ├── speed-in.html │ │ │ │ ├── speed-out-en-US.html │ │ │ │ ├── speed-out-fr-FR.html │ │ │ │ ├── temperature-in.html │ │ │ │ ├── temperature-out-en-US.html │ │ │ │ ├── temperature-out-fr-FR.html │ │ │ │ ├── volume-in.html │ │ │ │ ├── volume-out-en-US.html │ │ │ │ └── volume-out-fr-FR.html │ │ ├── is-multi-quantity-allowed-for-services.json │ │ ├── p-active-time-1.html │ │ ├── p-attachment-1.html │ │ ├── p-audio-1.html │ │ ├── p-background-source-1.html │ │ ├── p-binary-1.html │ │ ├── p-calendar-view-1.html │ │ ├── p-checkin-1.html │ │ ├── p-child-images-1.html │ │ ├── p-child-images-2.html │ │ ├── p-child-images-3.html │ │ ├── p-child-images-4.html │ │ ├── p-clickable-1.html │ │ ├── p-collection-1.html │ │ ├── p-collection-page-1.html │ │ ├── p-collection-template-page-1.html │ │ ├── p-collection-type-name-equals-1.html │ │ ├── p-comments-1.html │ │ ├── p-comparisons-1.html │ │ ├── p-current-type.html │ │ ├── p-debug-1.html │ │ ├── p-debug-2.html │ │ ├── p-disqus-1.html │ │ ├── p-even-odd-1.html │ │ ├── p-excerpt-1.html │ │ ├── p-external-link-1.html │ │ ├── p-external-video-1.html │ │ ├── p-folder-1.html │ │ ├── p-gallery-active-alignment-1.html │ │ ├── p-gallery-boolean-1.html │ │ ├── p-gallery-design-1.html │ │ ├── p-gallery-meta-1.html │ │ ├── p-gallery-meta-position-1.html │ │ ├── p-has-multiple-1.html │ │ ├── p-has-variants-1.html │ │ ├── p-index-1.html │ │ ├── p-location-1.html │ │ ├── p-main-image-1.html │ │ ├── p-nth-1.html │ │ ├── p-on-sale.html │ │ ├── p-passthrough-1.html │ │ ├── p-plural-1.html │ │ ├── p-promoted-1.html │ │ ├── p-record-type-1.html │ │ ├── p-redirect-1.html │ │ ├── p-same-day-1.html │ │ ├── p-service-name-email-1.html │ │ ├── p-show-past-events-1.html │ │ ├── p-singular-1.html │ │ ├── p-sold-out.html │ │ └── p-varied-prices.html │ ├── util.color.test.ts │ ├── util.commerce.test.ts │ ├── util.content.test.ts │ ├── util.format.test.ts │ ├── util.social.test.ts │ └── util.string.test.ts ├── pretty.test.ts ├── resources │ ├── ast-1.html │ ├── ast-10.html │ ├── ast-11.html │ ├── ast-12.html │ ├── ast-13.html │ ├── ast-14.html │ ├── ast-15.html │ ├── ast-16.html │ ├── ast-17.html │ ├── ast-18.html │ ├── ast-19.html │ ├── ast-2.html │ ├── ast-20.html │ ├── ast-3.html │ ├── ast-4.html │ ├── ast-5.html │ ├── ast-6.html │ ├── ast-7.html │ ├── ast-8.html │ ├── ast-9.html │ ├── bindvar-1.html │ ├── bindvar-2.html │ ├── ctxvar-1.html │ ├── eval-1.html │ ├── eval-10.html │ ├── eval-11.html │ ├── eval-12.html │ ├── eval-2.html │ ├── eval-3.html │ ├── eval-4.html │ ├── eval-5.html │ ├── eval-6.html │ ├── eval-7.html │ ├── eval-8.html │ ├── eval-9.html │ ├── include-1.html │ ├── include-2.html │ ├── inject-1.html │ ├── inject-2.html │ ├── pretty-1.txt │ ├── pretty-2.txt │ └── variables-1.html ├── rng.ts ├── scan.test.ts ├── types.test.ts └── util.test.ts ├── bin └── templatec.js ├── deprecate ├── examples └── basic-usage │ ├── README.md │ ├── package.json │ ├── src │ └── index.ts │ └── tsconfig.json ├── package.json ├── prerelease ├── release ├── rollup-test.html ├── rollup.config.js ├── scripts ├── dump-plugins.ts └── generate.ts ├── src ├── assembler.ts ├── builder.ts ├── calendars │ ├── calendar.ts │ ├── constants.ts │ ├── fields.ts │ ├── gregorian.ts │ ├── index.ts │ └── timezone.ts ├── compiler.ts ├── context.ts ├── engine.ts ├── enum.ts ├── errors.ts ├── exec.ts ├── frame.ts ├── index.ts ├── instructions.ts ├── matcher.ts ├── matchers.ts ├── math.ts ├── node.ts ├── opcodes.ts ├── parser.ts ├── patterns.ts ├── plugin.ts ├── plugins │ ├── enums.ts │ ├── formatters.commerce.ts │ ├── formatters.content.ts │ ├── formatters.core.ts │ ├── formatters.date.ts │ ├── formatters.datecldr.ts.txt │ ├── formatters.i18n.ts │ ├── formatters.missing.ts │ ├── formatters.social.ts │ ├── index.ts │ ├── messages.ts │ ├── options.ts │ ├── predicates.commerce.ts │ ├── predicates.content.ts │ ├── predicates.core.ts │ ├── predicates.i18n.ts │ ├── predicates.missing.ts │ ├── predicates.slide.ts │ ├── predicates.social.ts │ ├── templates │ │ ├── add-to-cart-btn.html │ │ ├── add-to-cart-btn.json │ │ ├── audio-player.html │ │ ├── audio-player.json │ │ ├── comment-link.html │ │ ├── comment-link.json │ │ ├── comments.html │ │ ├── comments.json │ │ ├── like-button.html │ │ ├── like-button.json │ │ ├── product-checkout.html │ │ ├── product-checkout.json │ │ ├── product-price.html │ │ ├── product-price.json │ │ ├── product-restock-notification.html │ │ ├── product-restock-notification.json │ │ ├── product-scarcity.html │ │ ├── product-scarcity.json │ │ ├── quantity-input.html │ │ ├── quantity-input.json │ │ ├── subscription-price.html │ │ ├── subscription-price.json │ │ ├── summary-form-field-address.html │ │ ├── summary-form-field-address.json │ │ ├── summary-form-field-checkbox.html │ │ ├── summary-form-field-checkbox.json │ │ ├── summary-form-field-date.html │ │ ├── summary-form-field-date.json │ │ ├── summary-form-field-likert.html │ │ ├── summary-form-field-likert.json │ │ ├── summary-form-field-name.html │ │ ├── summary-form-field-name.json │ │ ├── summary-form-field-phone.html │ │ ├── summary-form-field-phone.json │ │ ├── summary-form-field-time.html │ │ ├── summary-form-field-time.json │ │ ├── variants-select.html │ │ └── variants-select.json │ ├── util.color.ts │ ├── util.commerce.ts │ ├── util.content.ts │ ├── util.date.ts │ ├── util.datecldr.ts.txt │ ├── util.format.ts │ ├── util.i18n.ts │ ├── util.social.ts │ ├── util.string.ts │ └── util.timezone.ts ├── pretty.ts ├── scan.ts ├── sink.ts ├── types.ts ├── util.ts └── variable.ts ├── tsconfig.json ├── tsconfig.lint.json └── tslint.json /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | .vscode/ 3 | coverage/ 4 | dist/ 5 | node_modules/ 6 | scratch/ 7 | lib/ 8 | lib-es/ 9 | 10 | .DS_Store 11 | package-lock.json 12 | yarn.lock 13 | 14 | *.swp 15 | 16 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | *.html 2 | *.json 3 | 4 | -------------------------------------------------------------------------------- /.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | semi: true, 3 | singleQuote: true, 4 | tabWidth: 2, 5 | printWidth: 130, 6 | }; 7 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "10" 4 | - "12" 5 | script: 6 | - npm run test:coveralls 7 | 8 | -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @phensley 2 | 3 | -------------------------------------------------------------------------------- /__benchmarks__/index.ts: -------------------------------------------------------------------------------- 1 | import { assembleSuite, parseSuite } from './benchmark.parser'; 2 | import { executeSuite } from './benchmark.engine'; 3 | 4 | const options = { async: false, delay: 1 }; 5 | 6 | parseSuite.run(options); 7 | assembleSuite.run(options); 8 | executeSuite.run(options); 9 | -------------------------------------------------------------------------------- /__tests__/errors.test.ts: -------------------------------------------------------------------------------- 1 | import { notAllowedAtRoot } from '../src/errors'; 2 | import { Opcode } from '../src/opcodes'; 3 | 4 | test('error messages', () => { 5 | const err = notAllowedAtRoot(Opcode.END); 6 | expect(err.type).toEqual('assembler'); 7 | expect(err.message).toContain('END not allowed at root'); 8 | }); 9 | -------------------------------------------------------------------------------- /__tests__/eval.test.ts: -------------------------------------------------------------------------------- 1 | import { join } from 'path'; 2 | import { TemplateTestLoader } from './loader'; 3 | 4 | const loader = new TemplateTestLoader(join(__dirname, 'resources')); 5 | 6 | loader.paths('eval-%N.html').forEach((path) => { 7 | test(path, () => loader.execute(path)); 8 | }); 9 | -------------------------------------------------------------------------------- /__tests__/include.test.ts: -------------------------------------------------------------------------------- 1 | import { join } from 'path'; 2 | import { TemplateTestLoader } from './loader'; 3 | 4 | const loader = new TemplateTestLoader(join(__dirname, 'resources')); 5 | 6 | loader.paths('include-%N.html').forEach((path) => { 7 | test(path, () => loader.execute(path)); 8 | }); 9 | -------------------------------------------------------------------------------- /__tests__/plugins/enums.test.ts: -------------------------------------------------------------------------------- 1 | import { CollectionType, ProductType } from '../../src/plugins/enums'; 2 | 3 | test('enums', () => { 4 | expect(CollectionType.fromName('gallery-block')).toBe(CollectionType.GALLERY_BLOCK); 5 | expect(ProductType.fromCode(2)).toBe(ProductType.DIGITAL); 6 | }); 7 | -------------------------------------------------------------------------------- /__tests__/plugins/formatters.missing.test.ts: -------------------------------------------------------------------------------- 1 | import { join } from 'path'; 2 | import { TemplateTestLoader } from '../loader'; 3 | 4 | const loader = new TemplateTestLoader(join(__dirname, 'resources')); 5 | 6 | loader.paths('f-missing-%N.html').forEach((path) => { 7 | test(`missing - ${path}`, () => loader.execute(path)); 8 | }); 9 | -------------------------------------------------------------------------------- /__tests__/plugins/predicates.commerce.test.ts: -------------------------------------------------------------------------------- 1 | import { join } from 'path'; 2 | import { TemplateTestLoader } from '../loader'; 3 | 4 | const loader = new TemplateTestLoader(join(__dirname, 'resources')); 5 | 6 | loader.paths('p-has-variants-%N.html').forEach((path) => { 7 | test(`has-variants - ${path}`, () => loader.execute(path)); 8 | }); 9 | 10 | test('on sale', () => { 11 | loader.execute('p-on-sale.html'); 12 | }); 13 | 14 | test('sold out', () => { 15 | loader.execute('p-sold-out.html'); 16 | }); 17 | 18 | test('varied prices', () => { 19 | loader.execute('p-varied-prices.html'); 20 | }); 21 | -------------------------------------------------------------------------------- /__tests__/plugins/predicates.missing.test.ts: -------------------------------------------------------------------------------- 1 | import { Context } from '../../src/context'; 2 | import { MISSING_PREDICATES as Missing } from '../../src/plugins/predicates.missing'; 3 | 4 | test('missing predicate units-metric?', () => { 5 | const impl = Missing['units-metric?']; 6 | 7 | let ctx = new Context({}); 8 | expect(impl.apply([], ctx)).toEqual(false); 9 | 10 | expect(ctx.errors.length).toBeGreaterThan(0); 11 | }); 12 | -------------------------------------------------------------------------------- /__tests__/plugins/predicates.slide.test.ts: -------------------------------------------------------------------------------- 1 | import { join } from 'path'; 2 | import { TemplateTestLoader } from '../loader'; 3 | 4 | const loader = new TemplateTestLoader(join(__dirname, 'resources')); 5 | 6 | test('current-type?', () => { 7 | loader.execute('p-current-type.html'); 8 | }); 9 | -------------------------------------------------------------------------------- /__tests__/plugins/predicates.social.test.ts: -------------------------------------------------------------------------------- 1 | import { join } from 'path'; 2 | import { TemplateTestLoader } from '../loader'; 3 | 4 | const loader = new TemplateTestLoader(join(__dirname, 'resources')); 5 | 6 | loader.paths('p-comments-%N.html').forEach((path) => { 7 | test(`comments - ${path}`, () => loader.execute(path)); 8 | }); 9 | 10 | loader.paths('p-disqus-%N.html').forEach((path) => { 11 | test(`disqus - ${path}`, () => loader.execute(path)); 12 | }); 13 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-absurl-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "base-url": "https://example.com/prefix", 4 | "urls": [ 5 | "index", 6 | "blog/new-article" 7 | ] 8 | } 9 | 10 | :TEMPLATE 11 | {.repeated section urls} 12 | {@|AbsUrl} 13 | {.end} 14 | 15 | :OUTPUT 16 | https://example.com/prefix/index 17 | 18 | https://example.com/prefix/blog/new-article 19 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-activate-twitter-links-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "text": "link @FooBar the #Foo to the #Bar" 4 | } 5 | 6 | :TEMPLATE 7 | {text|activate-twitter-links} 8 | 9 | :OUTPUT 10 | link @FooBar the #Foo to the #Bar 11 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-apply-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "root-1": "root-1", 4 | "root-2": "root-2", 5 | "object": { 6 | "sub": { 7 | "id": "123" 8 | }, 9 | "peer-1": "peer-1", 10 | "peer-2": "peer-2" 11 | } 12 | } 13 | 14 | :PARTIALS 15 | { 16 | "foo": "{.section sub}{id}:{root-1}:{peer-1}{.end}:{root-2}:{peer-2}" 17 | } 18 | 19 | :TEMPLATE 20 | {object|apply foo private} 21 | 22 | :OUTPUT 23 | 123::peer-1::peer-2 24 | 25 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-audio-player-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "item": { 4 | "id": "560c37c1a7c8465c4a71d99a", 5 | "structuredContent": { 6 | "audioAssetUrl": "http://example.com/foo.mp3" 7 | } 8 | } 9 | } 10 | 11 | :TEMPLATE 12 | {item|audio-player} 13 | 14 | :OUTPUT 15 | 16 |
17 | 18 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-bookkeeper-money-format-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | 12345 3 | 4 | :TEMPLATE 5 | {@|bookkeeper-money-format} 6 | 7 | :OUTPUT 8 | $123.45 9 | 10 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-bookkeeper-money-format-2.html: -------------------------------------------------------------------------------- 1 | :PARAMS 2 | { 3 | "locale": "none" 4 | } 5 | 6 | :JSON 7 | 12345 8 | 9 | :TEMPLATE 10 | {@|bookkeeper-money-format} 11 | 12 | :OUTPUT 13 | 14 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-bookkeeper-money-format-3.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | "A" 3 | 4 | :TEMPLATE 5 | {@|bookkeeper-money-format} 6 | 7 | :OUTPUT 8 | $0.00 -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-capitalize-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "strings": [ 4 | "Coffee", 5 | "Tea", 6 | "Milk" 7 | ] 8 | } 9 | 10 | :TEMPLATE 11 | {.repeated section strings} 12 | {@} {@|capitalize} 13 | {.end} 14 | 15 | :OUTPUT 16 | Coffee COFFEE 17 | 18 | Tea TEA 19 | 20 | Milk MILK 21 | 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-cart-quantity-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "entries": [ 4 | {"quantity": 2}, 5 | {"quantity": 3} 6 | ] 7 | } 8 | 9 | :TEMPLATE 10 | {@|cart-quantity} 11 | 12 | :OUTPUT 13 | 5 14 | 15 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-cart-quantity-2.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "entries": [] 4 | } 5 | 6 | :TEMPLATE 7 | {@|cart-quantity} 8 | 9 | :OUTPUT 10 | 0 11 | 12 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-cart-subtotal-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "subtotalCents": 12345 4 | } 5 | 6 | :TEMPLATE 7 | {@|cart-subtotal} 8 | 9 | :OUTPUT 10 | deprecated, do not use -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-cart-url-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | {} 3 | 4 | :TEMPLATE 5 | {@|cart-url} 6 | 7 | :OUTPUT 8 | /cart 9 | 10 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-child-image-meta-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "items": [ 4 | {}, 5 | { 6 | "title": "child image", 7 | "originalSize": 1000, 8 | "assetUrl": "/foo/bar.jpg", 9 | "licensedAssetPreview": {}, 10 | "mediaFocalPoint": {"x": 0.3, "y": 0.7} 11 | } 12 | ] 13 | } 14 | 15 | :TEMPLATE 16 | {@|child-image-meta 1} 17 | 18 | :OUTPUT 19 | data-licensed-asset-preview="true" data-src="/foo/bar.jpg" data-image="/foo/bar.jpg" data-image-dimensions="1000" data-image-focal-point="0.3,0.7" alt="child image" 20 | 21 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-child-image-meta-2.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "items": [ 4 | {}, 5 | {}, 6 | {}, 7 | { 8 | "body": "child image", 9 | "originalSize": 1000, 10 | "assetUrl": "/foo/bar.jpg" 11 | } 12 | ] 13 | } 14 | 15 | :TEMPLATE 16 | {@|child-image-meta 3} 17 | 18 | :OUTPUT 19 | data-src="/foo/bar.jpg" data-image="/foo/bar.jpg" data-image-dimensions="1000" data-image-focal-point="0.5,0.5" alt="child image" 20 | 21 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-child-image-meta-3.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "items": [ 4 | {}, 5 | {}, 6 | { 7 | "filename": "child image", 8 | "originalSize": 1000, 9 | "assetUrl": "/foo/bar.jpg" 10 | } 11 | ] 12 | } 13 | 14 | :TEMPLATE 15 | {@|child-image-meta 2} 16 | 17 | :OUTPUT 18 | data-src="/foo/bar.jpg" data-image="/foo/bar.jpg" data-image-dimensions="1000" data-image-focal-point="0.5,0.5" alt="child image" 19 | 20 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-child-image-meta-4.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "items": [ 4 | { 5 | "body": "bold
italics
", 6 | "originalSize": 1000, 7 | "assetUrl": "/foo/bar.jpg" 8 | } 9 | ] 10 | } 11 | 12 | :TEMPLATE 13 | {@|child-image-meta} 14 | 15 | :OUTPUT 16 | data-src="/foo/bar.jpg" data-image="/foo/bar.jpg" data-image-dimensions="1000" data-image-focal-point="0.5,0.5" alt=" bold italics " 17 | 18 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-child-image-meta-5.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "items": [ 4 | ] 5 | } 6 | 7 | :TEMPLATE 8 | {@|child-image-meta 2} 9 | 10 | :OUTPUT 11 | 12 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-child-image-meta-6.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "items": [ 4 | {}, 5 | {}, 6 | { 7 | "title": "", 8 | "body": "", 9 | "filename": "", 10 | "originalSize": 1000, 11 | "assetUrl": "/foo/bar.jpg" 12 | } 13 | ] 14 | } 15 | 16 | :TEMPLATE 17 | {@|child-image-meta 2} 18 | 19 | :OUTPUT 20 | data-src="/foo/bar.jpg" data-image="/foo/bar.jpg" data-image-dimensions="1000" data-image-focal-point="0.5,0.5" alt="" 21 | 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-color-weight-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "colors": [ 4 | "#fff", 5 | "#aaa", 6 | "#888", 7 | "#444", 8 | "#222", 9 | "#000" 10 | ] 11 | } 12 | 13 | :TEMPLATE 14 | {.repeated section colors} 15 | {@} {@|color-weight} 16 | {.end} 17 | 18 | :OUTPUT 19 | #fff light 20 | 21 | #aaa light 22 | 23 | #888 light 24 | 25 | #444 dark 26 | 27 | #222 dark 28 | 29 | #000 dark 30 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-comment-count-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "publicCommentCount": 10 4 | } 5 | 6 | :TEMPLATE 7 | {@|comment-count} 8 | 9 | :OUTPUT 10 | 10 Comments 11 | 12 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-comment-count-2.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "publicCommentCount": 1 4 | } 5 | 6 | :TEMPLATE 7 | {@|comment-count} 8 | 9 | :OUTPUT 10 | 1 Comment 11 | 12 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-comment-count-3.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "publicCommentCount": 0 4 | } 5 | 6 | :TEMPLATE 7 | {@|comment-count} 8 | 9 | :OUTPUT 10 | No Comments 11 | 12 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-comment-link-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "websiteSettings": { 4 | "disqusShortname": "abc123" 5 | }, 6 | "item": { 7 | "id": "560c37c1a7c8465c4a71d99a", 8 | "fullUrl": "http://example.com/bar" 9 | } 10 | } 11 | 12 | :TEMPLATE 13 | {item|comment-link} 14 | 15 | :OUTPUT 16 | 17 | 18 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-comment-link-2.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "item": { 4 | "id": "560c37c1a7c8465c4a71d99a", 5 | "fullUrl": "http://example.com/bar", 6 | "publicCommentCount": 1 7 | } 8 | } 9 | 10 | :TEMPLATE 11 | {item|comment-link} 12 | 13 | :OUTPUT 14 | 15 | 1 16 | Comment 17 | 18 | 19 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-comment-link-3.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "item": { 4 | "id": "560c37c1a7c8465c4a71d99a", 5 | "fullUrl": "http://example.com/bar", 6 | "publicCommentCount": 20 7 | } 8 | } 9 | 10 | :TEMPLATE 11 | {item|comment-link} 12 | 13 | :OUTPUT 14 | 15 | 20 16 | Comments 17 | 18 | 19 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-comments-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "websiteSettings": { 4 | "disqusShortname": "abc123" 5 | }, 6 | "item": {"id": "560c37c1a7c8465c4a71d99a"} 7 | } 8 | 9 | :TEMPLATE 10 | {item|comments} 11 | 12 | :OUTPUT 13 |
14 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-comments-2.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "item": { 4 | "id": "560c37c1a7c8465c4a71d99a", 5 | "publicCommentCount": 0, 6 | "commentState": 1 7 | } 8 | } 9 | 10 | :TEMPLATE 11 | {item|comments} 12 | 13 | :OUTPUT 14 |
-------------------------------------------------------------------------------- /__tests__/plugins/resources/f-comments-3.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "collection": { 4 | "id": "560c37c1a7c8465c4a71d99a", 5 | "publicCommentCount": 0, 6 | "commentState": 1 7 | } 8 | } 9 | 10 | :TEMPLATE 11 | {collection|comments} 12 | 13 | :OUTPUT 14 |
-------------------------------------------------------------------------------- /__tests__/plugins/resources/f-count-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "array": [ 4 | 0, 1, 2, 3 5 | ], 6 | "object": { 7 | "foo": 1, 8 | "bar": 2, 9 | "baz": 3 10 | }, 11 | "string": "hi", 12 | "number": 123 13 | } 14 | 15 | :TEMPLATE 16 | {array|count} 17 | {object|count} 18 | {string|count} 19 | {number|count} 20 | 21 | :OUTPUT 22 | 4 23 | 3 24 | 0 25 | 0 -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-cover-image-meta-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "coverImage": { 4 | "title": "child image", 5 | "originalSize": 1000, 6 | "assetUrl": "/foo/bar.jpg", 7 | "licensedAssetPreview": {}, 8 | "mediaFocalPoint": {"x": 0.3, "y": 0.7} 9 | } 10 | } 11 | 12 | :TEMPLATE 13 | {@|cover-image-meta} 14 | 15 | :OUTPUT 16 | data-licensed-asset-preview="true" data-src="/foo/bar.jpg" data-image="/foo/bar.jpg" data-image-dimensions="1000" data-image-focal-point="0.3,0.7" alt="child image" 17 | 18 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-cycle-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "indices": [2, 1, 3] 4 | } 5 | 6 | :TEMPLATE 7 | {.repeated section indices} 8 | {@|cycle foo bar baz quux} 9 | {.end} 10 | {.repeated section indices} 11 | {@index|cycle A. B. C. D.} {@} 12 | {.end} 13 | 14 | 15 | :OUTPUT 16 | bar 17 | 18 | foo 19 | 20 | baz 21 | 22 | 23 | A. 2 24 | 25 | B. 1 26 | 27 | C. 3 -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-date-3.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "website": { 4 | "timeZone": "America/New_York" 5 | }, 6 | "ts": [ 7 | 1613597165345 8 | ] 9 | } 10 | 11 | :TEMPLATE 12 | {.repeated section ts} 13 | {@|date %Y %% %d} 14 | {@|date %Y-%m-%d %H:%M:%S %Z} 15 | {.end} 16 | 17 | :OUTPUT 18 | 2021 % 17 19 | 2021-02-17 16:26:05 EST 20 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-datetime-2.html: -------------------------------------------------------------------------------- 1 | :PARAMS 2 | { 3 | "locale": "ja" 4 | } 5 | 6 | :JSON 7 | { 8 | "t": 1520751625000 9 | } 10 | 11 | :TEMPLATE 12 | {t|datetime date:full} 13 | {t|datetime date:full calendar:japanese} 14 | 15 | :OUTPUT 16 | 2018年3月11日日曜日 17 | 平成30年3月11日日曜日 18 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-datetime-interval-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "s": 1582571080000, 4 | "e1": 1582591080000, 5 | "e2": 1592591080000, 6 | "e3": 1692591080000 7 | } 8 | 9 | :TEMPLATE 10 | {s,e1|datetime-interval} 11 | {s,e2|datetime-interval} 12 | {s,e3|datetime-interval} 13 | 14 | {s,e3|datetime-interval yMMM} 15 | 16 | :OUTPUT 17 | 2:04 – 7:38 PM 18 | Feb 24 – Jun 19, 2020 19 | Feb 24, 2020 – Aug 21, 2023 20 | 21 | Feb 2020 – Aug 2023 22 | 23 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-decimal-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "n": "123456.7890" 4 | } 5 | 6 | :TEMPLATE 7 | {n|decimal style:percent} 8 | {n|decimal style:short} 9 | {n|decimal maximumFractionDigits:1} 10 | {n|decimal maximumFractionDigits:1 round:down} 11 | 12 | :OUTPUT 13 | 12,345,679% 14 | 123K 15 | 123,456.8 16 | 123,456.7 17 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-encode-space-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "message": "hello, this message contains spaces" 4 | } 5 | 6 | :TEMPLATE 7 | {message} 8 | {message|encode-space} 9 | 10 | :OUTPUT 11 | hello, this message contains spaces 12 | hello, this message contains spaces 13 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-encode-uri-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "english": "Coffee & Tea" 4 | } 5 | 6 | :TEMPLATE 7 | {english} 8 | {english|encode-uri} 9 | 10 | :OUTPUT 11 | Coffee & Tea 12 | Coffee%20&%20Tea 13 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-encode-uri-component-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "english": "Coffee & Tea", 4 | "korean": "\ucee4\ud53c\uc640\u0020\ucc28" 5 | } 6 | 7 | :TEMPLATE 8 | {english} 9 | /show?en={english|encode-uri-component} 10 | 11 | {korean} 12 | /show?ko={korean|encode-uri-component} 13 | 14 | :OUTPUT 15 | Coffee & Tea 16 | /show?en=Coffee%20%26%20Tea 17 | 18 | 커피와 차 19 | /show?ko=%EC%BB%A4%ED%94%BC%EC%99%80%20%EC%B0%A8 20 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-format-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "message": "{0} and {1}", 4 | "foo": "A", 5 | "bar": "B" 6 | } 7 | 8 | :PARTIALS 9 | {} 10 | 11 | :INJECT 12 | {} 13 | 14 | :TEMPLATE 15 | {message|format foo bar} 16 | 17 | :OUTPUT 18 | A and B 19 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-format-2.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "message": "{1} and {5} optional {3}", 4 | "arg0": "A", 5 | "arg1": "B", 6 | "arg2": "C", 7 | "arg3": "D", 8 | "arg4": "E" 9 | } 10 | 11 | :PARTIALS 12 | {} 13 | 14 | :INJECT 15 | {} 16 | 17 | :TEMPLATE 18 | {message|format arg0 arg1 arg2 arg3} 19 | 20 | :OUTPUT 21 | B and optional D 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-format-3.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "message": "{000001} and {10000} and {000004}", 4 | "arg0": "A", 5 | "arg1": "B", 6 | "arg2": "C", 7 | "arg3": "D", 8 | "arg4": "E" 9 | } 10 | 11 | :PARTIALS 12 | {} 13 | 14 | :INJECT 15 | {} 16 | 17 | :TEMPLATE 18 | {message|format arg0 arg1 arg2 arg3 arg4} 19 | 20 | :OUTPUT 21 | B and and E 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-from-price-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "structuredContent": { 4 | "productType": 1, 5 | "variants": [] 6 | } 7 | } 8 | 9 | :TEMPLATE 10 | {@|from-price} 11 | 12 | :OUTPUT 13 | 0 14 | 15 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-from-price-2.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "structuredContent": { 4 | "productType": 1, 5 | "variants": [ 6 | {"priceMoney": { "value": "1.00" } }, 7 | {"priceMoney": { "value": "2.00" } } 8 | ] 9 | } 10 | } 11 | 12 | :TEMPLATE 13 | {@|from-price} 14 | 15 | :OUTPUT 16 | 100 -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-from-price-3.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "structuredContent": { 4 | "productType": 1, 5 | "variants": [ 6 | {"onSale": true, "salePriceMoney": { "value": ".5" } }, 7 | {"priceMoney": { "value": "1.00" } }, 8 | {"priceMoney": { "value": ".75" } } 9 | ] 10 | } 11 | } 12 | 13 | :TEMPLATE 14 | {@|from-price} 15 | 16 | :OUTPUT 17 | 50 18 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-from-price-4.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "structuredContent": { 4 | "productType": 1, 5 | "variants": [ 6 | {"priceMoney": { "value": "1" } }, 7 | {"onSale": true, "salePriceMoney": { "value": ".1" } }, 8 | {"priceMoney": { "value": ".75" } }, 9 | {"onSale": true, "salePriceMoney": { "value": ".5" } } 10 | ] 11 | } 12 | } 13 | 14 | :TEMPLATE 15 | {@|from-price} 16 | 17 | :OUTPUT 18 | 10 -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-from-price-5.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "structuredContent": { 4 | "productType": 2, 5 | "priceMoney": { "value": "7.50" } 6 | } 7 | } 8 | 9 | :TEMPLATE 10 | {@|from-price} 11 | 12 | :OUTPUT 13 | 750 -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-from-price-6.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "structuredContent": { 4 | "productType": -1 5 | } 6 | } 7 | 8 | :TEMPLATE 9 | {@|from-price} 10 | 11 | :OUTPUT 12 | 0 -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-from-price-7.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "structuredContent": { 4 | "productType": 2 5 | } 6 | } 7 | 8 | :TEMPLATE 9 | {@|from-price} 10 | 11 | :OUTPUT 12 | 0 -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-get-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "items": [ 4 | { "id": "123" }, 5 | { "id": "456" } 6 | ], 7 | "one": { 8 | "two": { 9 | "123": { 10 | "name": "Bob" 11 | }, 12 | "456": { 13 | "name": "Fred" 14 | } 15 | } 16 | } 17 | } 18 | 19 | :TEMPLATE 20 | {.repeated section items} 21 | {.var @obj one.two|get @.id}{@obj.name} 22 | {.end} 23 | 24 | :OUTPUT 25 | Bob 26 | 27 | Fred 28 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-get-2.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "selected": [ 4 | "123", 5 | "456" 6 | ], 7 | "paths": { 8 | "name": ["person", "name"], 9 | "age": ["person", "age"] 10 | }, 11 | "people": { 12 | "123": { 13 | "person": { 14 | "name": "Bob", 15 | "age": 19 16 | } 17 | }, 18 | "456": { 19 | "person": { 20 | "name": "Fred", 21 | "age": 22 22 | } 23 | } 24 | } 25 | } 26 | 27 | :TEMPLATE 28 | {.repeated section selected} 29 | {.var @name people|get @ paths.name}{.var @age people|get @ paths.age} 30 | {@name} is {@age} years{.end} 31 | 32 | :OUTPUT 33 | Bob is 19 years 34 | 35 | Fred is 22 years 36 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-get-3.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "items": [ 4 | { "id": "abc" }, 5 | { "id": "123" }, 6 | { "id": "xyz" } 7 | ], 8 | "one": { 9 | "two": { 10 | "123": { 11 | "name": "Bob" 12 | }, 13 | "456": { 14 | "name": "Fred" 15 | } 16 | } 17 | } 18 | } 19 | 20 | :TEMPLATE 21 | {.repeated section items} 22 | {.var @obj one.two|get @.id}{@obj.name} 23 | {.end} 24 | 25 | :OUTPUT 26 | Bob 27 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-get-4.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "id": "123", 4 | "key": "name", 5 | "objects": { 6 | "123": { 7 | "name": "Bob" 8 | } 9 | } 10 | } 11 | 12 | 13 | :TEMPLATE 14 | {objects|get id key} 15 | 16 | :OUTPUT 17 | Bob 18 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-get-5.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "id": "123", 4 | "valid": { 5 | "123": "Bob" 6 | }, 7 | "invalid": { 8 | "123": null 9 | } 10 | } 11 | 12 | 13 | :TEMPLATE 14 | {valid|get|json} 15 | {valid|get id|json} 16 | -{valid|get missing id|json} 17 | -{valid|get foo bar id|json} 18 | 19 | {invalid|get id|json} 20 | -{invalid|get missing id|json} 21 | -{invalid|get foo bar id|json} 22 | 23 | :OUTPUT 24 | {"123":"Bob"} 25 | "Bob" 26 | - 27 | - 28 | 29 | null 30 | - 31 | - 32 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-get-6.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "references": [ 4 | { "id": "123", "key": "name" }, 5 | { "id": "456", "key": "color" } 6 | ], 7 | "objects": { 8 | "123": { "name": "Guitar", "color": "blue" }, 9 | "456": { "name": "Saxophone", "color": "silver" } 10 | } 11 | } 12 | 13 | 14 | :TEMPLATE 15 | {.var @ref references.1.id} 16 | 17 | {.var @obj objects|get @ref} 18 | Found {@obj.name} 19 | 20 | {.var @obj objects|get @ref @ref @ref @ref} 21 | Nope {@obj.name} 22 | 23 | :OUTPUT 24 | Found Saxophone 25 | 26 | 27 | Nope 28 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-get-7.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "references": [ 4 | { "id": "123", "key": "name" }, 5 | { "id": "456", "key": "color" } 6 | ], 7 | "objects": { 8 | "123": { "name": "Guitar", "color": "blue" }, 9 | "456": { "name": "Saxophone", "color": "silver" } 10 | } 11 | } 12 | 13 | 14 | :TEMPLATE 15 | {.repeated section references} 16 | {.var @id @.id}{.var @key @.key} 17 | {@index}. {objects|get @id @key|json}{.end} 18 | 19 | :OUTPUT 20 | 1. "Guitar" 21 | 22 | 2. "silver" 23 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-google-calendar-url-1.html: -------------------------------------------------------------------------------- 1 | :PARAMS 2 | {} 3 | 4 | :JSON 5 | { 6 | "startDate": 1384518630000, 7 | "endDate": 1384518716400, 8 | "location": { 9 | "addressLine1": "123 Main St.", 10 | "addressLine2": "Apt 5", 11 | "addressCountry": "US" 12 | } 13 | } 14 | 15 | :TEMPLATE 16 | {@|google-calendar-url} 17 | 18 | :OUTPUT 19 | http://www.google.com/calendar/event?action=TEMPLATE&text=&dates=20131115T123030Z/20131115T123156Z&location=123%20Main%20St.%2C%20Apt%205%2C%20US 20 | 21 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-google-calendar-url-2.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "startDate": 1384518630000, 4 | "endDate": 1384518716400 5 | } 6 | 7 | :TEMPLATE 8 | {@|google-calendar-url} 9 | 10 | :OUTPUT 11 | http://www.google.com/calendar/event?action=TEMPLATE&text=&dates=20131115T123030Z/20131115T123156Z 12 | 13 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-google-calendar-url-3.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "startDate": 1384518630000, 4 | "endDate": 1384518716400, 5 | "location": { 6 | "address1": "", 7 | "country": "" 8 | } 9 | } 10 | 11 | :TEMPLATE 12 | {@|google-calendar-url} 13 | 14 | :OUTPUT 15 | http://www.google.com/calendar/event?action=TEMPLATE&text=&dates=20131115T123030Z/20131115T123156Z 16 | 17 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-height-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "hw": "800x400" 4 | } 5 | 6 | :TEMPLATE 7 | {hw|height} 8 | 9 | :OUTPUT 10 | 400 11 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-html-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "string": "\"< foo & bar >\"" 4 | } 5 | 6 | :TEMPLATE 7 | {string} 8 | {string|html} 9 | 10 | :OUTPUT 11 | "< foo & bar >" 12 | "< foo & bar >" 13 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-htmlattr-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "string": "\"< foo & bar >\"" 4 | } 5 | 6 | :TEMPLATE 7 | {string} 8 | {string|htmlattr} 9 | 10 | :OUTPUT 11 | "< foo & bar >" 12 | "< foo & bar >" 13 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-htmltag-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "string": "\"< foo & bar >\"" 4 | } 5 | 6 | :TEMPLATE 7 | {string} 8 | {string|htmltag} 9 | 10 | :OUTPUT 11 | "< foo & bar >" 12 | "< foo & bar >" 13 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-humanize-duration-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "duration": 125000 4 | } 5 | 6 | :TEMPLATE 7 | {duration|humanizeDuration} 8 | 9 | :OUTPUT 10 | 2:05 11 | 12 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-image-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "id": "560c37c1a7c8465c4a71d99a", 4 | "title": "child image", 5 | "originalSize": 1000, 6 | "assetUrl": "/foo/bar.jpg", 7 | "licensedAssetPreview": {}, 8 | "mediaFocalPoint": {"x": 0.3, "y": 0.7} 9 | } 10 | 11 | :TEMPLATE 12 | {@|image} 13 | 14 | :OUTPUT 15 | child image 16 | 17 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-image-2.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "id": "560c37c1a7c8465c4a71d99a", 4 | "title": "", 5 | "originalSize": 1000, 6 | "assetUrl": "/foo/bar.jpg", 7 | "mediaFocalPoint": {"x": 0.3, "y": 0.7} 8 | } 9 | 10 | :TEMPLATE 11 | {@|image foo-bar-image} 12 | 13 | :OUTPUT 14 | 15 | 16 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-image-color-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "colorData": { 4 | "topLeftAverage": "111" 5 | } 6 | } 7 | 8 | :TEMPLATE 9 | {@|image-color topLeft foo} 10 | 11 | :OUTPUT 12 | foo: #111 13 | 14 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-image-color-2.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "colorData": { 4 | "topLeftAverage": "111", 5 | "topRightAverage": "222", 6 | "bottomLeftAverage": "333", 7 | "bottomRightAverage": "444", 8 | "centerAverage": "555" 9 | } 10 | } 11 | 12 | :TEMPLATE 13 | {@|image-color} 14 | 15 | :OUTPUT 16 | data-color-topLeft="#111" data-color-topRight="#222" data-color-bottomLeft="#333" data-color-bottomRight="#444" data-color-center="#555" 17 | 18 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-image-color-3.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "colorzzzz": {} 4 | } 5 | 6 | :TEMPLATE 7 | {@|image-color} 8 | 9 | :OUTPUT 10 | 11 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-image-color-4.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "colorData": { 4 | "topLeftAverage": "111" 5 | } 6 | } 7 | 8 | :TEMPLATE 9 | {@|image-color topLeft} 10 | 11 | :OUTPUT 12 | #111 13 | 14 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-image-color-5.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "colorData": { 4 | "fooBarAverage": "111" 5 | } 6 | } 7 | 8 | :TEMPLATE 9 | {@|image-color topLeft} 10 | 11 | :OUTPUT 12 | "topLeft" not found. 13 | 14 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-image-meta-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "title": "image", 4 | "originalSize": 1000, 5 | "assetUrl": "/foo/bar.jpg", 6 | "licensedAssetPreview": {}, 7 | "mediaFocalPoint": {"x": 0.3, "y": 0.7} 8 | } 9 | 10 | 11 | :TEMPLATE 12 | {@|image-meta 1} 13 | 14 | :OUTPUT 15 | data-licensed-asset-preview="true" data-src="/foo/bar.jpg" data-image="/foo/bar.jpg" data-image-dimensions="1000" data-image-focal-point="0.3,0.7" alt="image" 16 | 17 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-image-meta-2.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | {} 3 | 4 | 5 | :TEMPLATE 6 | {foo|image-meta 1} 7 | 8 | :OUTPUT 9 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-image-srcset-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "assetUrl": "/foo/bar.jpg", 4 | "systemDataVariants": "1500x983,100w,300w,500w,750w,1000w,1500w" 5 | } 6 | 7 | 8 | :TEMPLATE 9 | {@|image-srcset 1} 10 | 11 | :OUTPUT 12 | srcset="/foo/bar.jpg?format=100w 100w,/foo/bar.jpg?format=300w 300w,/foo/bar.jpg?format=500w 500w,/foo/bar.jpg?format=750w 750w,/foo/bar.jpg?format=1000w 1000w,/foo/bar.jpg?format=1500w 1500w,/foo/bar.jpg?format=original 2500w" 13 | 14 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-image-srcset-2.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "assetUrl": "/foo/bar.jpg", 4 | "systemDataVariants": "" 5 | } 6 | 7 | 8 | :TEMPLATE 9 | {@|image-srcset 1} 10 | 11 | :OUTPUT 12 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-image-srcset-3.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "assetUrl": "/foo/bar.jpg", 4 | "systemDataVariants": "1500x983,100w,300w,500w,750w,1000w,1500w,2500w" 5 | } 6 | 7 | 8 | :TEMPLATE 9 | {@|image-srcset 1} 10 | 11 | :OUTPUT 12 | srcset="/foo/bar.jpg?format=100w 100w,/foo/bar.jpg?format=300w 300w,/foo/bar.jpg?format=500w 500w,/foo/bar.jpg?format=750w 750w,/foo/bar.jpg?format=1000w 1000w,/foo/bar.jpg?format=1500w 1500w,/foo/bar.jpg?format=2500w 2500w" 13 | 14 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-image-srcset-4.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "assetUrl": "/foo/bar.jpg", 4 | "systemDataVariants": "150w,350w" 5 | } 6 | 7 | 8 | :TEMPLATE 9 | {@|image-srcset 1} 10 | 11 | :OUTPUT 12 | srcset="/foo/bar.jpg?format=150w 150w,/foo/bar.jpg?format=350w 350w" 13 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-image-srcset-5.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | {} 3 | 4 | 5 | :TEMPLATE 6 | {foo|image-srcset 1} 7 | 8 | :OUTPUT 9 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-item-classes-2.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "structuredContent": { 4 | "productType": 1, 5 | "variants": [ 6 | {"onSale": true, "qtyInStock": 0} 7 | ] 8 | }, 9 | "author": { 10 | "displayName": "" 11 | }, 12 | "recordTypeLabel": "foo", 13 | "recordType": -1 14 | } 15 | 16 | :TEMPLATE 17 | {@|item-classes} 18 | 19 | :OUTPUT 20 | hentry post-type-foo 21 | 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-item-classes-3.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "structuredContent": { 4 | "productType": 1, 5 | "variants": [ 6 | {"onSale": false, "qtyInStock": 2} 7 | ] 8 | }, 9 | "author": { 10 | "displayName": "" 11 | }, 12 | "recordTypeLabel": "foo", 13 | "recordType": 11 14 | } 15 | 16 | :TEMPLATE 17 | {@|item-classes} 18 | 19 | :OUTPUT 20 | hentry post-type-foo 21 | 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-iter-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "keys": ["a", "b", "c"] 4 | } 5 | 6 | :TEMPLATE 7 | {.repeated section keys} 8 | {@|iter} {@} 9 | {.end} 10 | 11 | :OUTPUT 12 | 1 a 13 | 14 | 2 b 15 | 16 | 3 c 17 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-json-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "var": {"title": "This is a "} 4 | } 5 | 6 | :TEMPLATE 7 | {var.title|json} 8 | 9 | :OUTPUT 10 | "This is a "} 4 | } 5 | 6 | :TEMPLATE 7 | {var.title|json} 8 | 9 | :OUTPUT 10 | "This is a "} 4 | } 5 | 6 | :TEMPLATE 7 | {var.title|json} 8 | 9 | :OUTPUT 10 | "Execute the "} 4 | } 5 | 6 | :TEMPLATE 7 | {var.title|json} 8 | 9 | :OUTPUT 10 | ""} 4 | } 5 | 6 | :TEMPLATE 7 | {var|json-pretty} 8 | 9 | :OUTPUT 10 | { 11 | "title": "This is a "} 4 | } 5 | 6 | :TEMPLATE 7 | {var|json-pretty} 8 | 9 | :OUTPUT 10 | { 11 | "title": "This is a " 13 | } 14 | } 15 | } 16 | 17 | :TEMPLATE 18 | {@|product-status} 19 | 20 | :OUTPUT 21 |
<script>Custom sold out text</script>
22 | 23 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-prop-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "id": "123", 4 | "which": "primary", 5 | "objects": { 6 | "123": { 7 | "name": "Bob", 8 | "emails": { 9 | "primary": "bob@example.com", 10 | "secondary": "foo@example.com" 11 | } 12 | } 13 | } 14 | } 15 | 16 | 17 | :TEMPLATE 18 | {objects|get id|prop emails|get which} 19 | 20 | :OUTPUT 21 | bob@example.com 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-prop-2.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "foo": { 4 | "bar": { 5 | "quux": { 6 | "baz": "xyz" 7 | } 8 | } 9 | } 10 | } 11 | 12 | 13 | :TEMPLATE 14 | {foo|prop bar quux baz} 15 | -{foo|prop x y z} 16 | 17 | :OUTPUT 18 | xyz 19 | - 20 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-prop-3.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "items": [ 4 | "foo", 5 | "bar", 6 | "baz" 7 | ], 8 | "object": { 9 | "0": "foo" 10 | } 11 | } 12 | 13 | 14 | :TEMPLATE 15 | {items|prop 2} 16 | {items|prop 1} 17 | {items|prop 0} 18 | -{items|prop foo} 19 | 20 | {object|prop 0} 21 | -{object|prop 1} 22 | 23 | :OUTPUT 24 | baz 25 | bar 26 | foo 27 | - 28 | 29 | foo 30 | - 31 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-quantity-input-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "item": { 4 | "id": "560c37c1a7c8465c4a71d99a", 5 | "structuredContent": { 6 | "productType": 1, 7 | "variants": [ 8 | {"qtyInStock": 0}, 9 | {"qtyInStock": 100} 10 | ], 11 | "isSubscribable": false 12 | } 13 | } 14 | } 15 | 16 | :TEMPLATE 17 | {item|quantity-input} 18 | 19 | :OUTPUT 20 |
21 |
Quantity:
22 | 23 |
24 | 25 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-quantity-input-2.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "item": { 4 | "id": "560c37c1a7c8465c4a71d99a", 5 | "structuredContent": { 6 | "productType": 1, 7 | "variants": [ 8 | {"qtyInStock": 0} 9 | ], 10 | "isSubscribable": false 11 | } 12 | } 13 | } 14 | 15 | :TEMPLATE 16 | {item|quantity-input} 17 | 18 | :OUTPUT 19 | 20 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-quantity-input-3.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "item": { 4 | "id": "560c37c1a7c8465c4a71d99a", 5 | "structuredContent": { 6 | "productType": 2, 7 | "isSubscribable": false 8 | } 9 | } 10 | } 11 | 12 | :TEMPLATE 13 | {item|quantity-input} 14 | 15 | :OUTPUT -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-quantity-input-4.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "item": { 4 | "id": "560c37c1a7c8465c4a71d99a", 5 | "structuredContent": { 6 | "productType": 3, 7 | "variants": [ 8 | {"qtyInStock": 2} 9 | ], 10 | "isSubscribable": false 11 | } 12 | } 13 | } 14 | 15 | :TEMPLATE 16 | {item|quantity-input} 17 | 18 | :OUTPUT 19 |
20 |
Quantity:
21 | 22 |
-------------------------------------------------------------------------------- /__tests__/plugins/resources/f-quantity-input-5.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "item": { 4 | "id": "560c37c1a7c8465c4a71d99a", 5 | "structuredContent": { 6 | "productType": 1, 7 | "variants": [ 8 | {"qtyInStock": 0}, 9 | {"qtyInStock": 100} 10 | ], 11 | "isSubscribable": true 12 | } 13 | } 14 | } 15 | 16 | :TEMPLATE 17 | {item|quantity-input} 18 | 19 | :OUTPUT 20 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-raw-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "null": null, 4 | "number": -15, 5 | "boolean": false, 6 | "string": "Central Park", 7 | "object": { "color": "red", "price": "17.50" }, 8 | "array": [1, 2, "blue", 5] 9 | } 10 | 11 | :TEMPLATE 12 | {null|raw} 13 | {boolean|raw} 14 | {number|raw} 15 | {string|raw} 16 | {object|raw} 17 | {array|raw} 18 | 19 | :OUTPUT 20 | null 21 | false 22 | -15 23 | "Central Park" 24 | {"color":"red","price":"17.50"} 25 | [1,2,"blue",5] 26 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-relative-time-1.html: -------------------------------------------------------------------------------- 1 | :PARAMS 2 | { 3 | "now": 1502298000000 4 | } 5 | 6 | :JSON 7 | { 8 | "dates": [ 9 | {"start": 1509647217000, "end": 1510641417000}, 10 | {"start": 1502298000000, "end": 1502305200000} 11 | ], 12 | "timestamps": [ 13 | 1502305200000, 14 | 1502258000000 15 | ] 16 | } 17 | 18 | 19 | :TEMPLATE 20 | {.repeated section dates} 21 | {start, end|relative-time}{.end} 22 | {.repeated section timestamps} 23 | {@|relative-time context:begin-sentence}{.end} 24 | 25 | :OUTPUT 26 | in 2 weeks 27 | in 2 hours 28 | 29 | In 2 hours 30 | 11 hours ago 31 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-resized-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "sizes": [ 4 | "250x175", 5 | "400x100", 6 | "800x400" 7 | ] 8 | } 9 | 10 | :TEMPLATE 11 | {.repeated section sizes} 12 | {@} {@|resizedHeightForWidth 50} {@|resizedWidthForHeight 50} 13 | {@} {@|squarespaceThumbnailForHeight 50} {@|squarespaceThumbnailForWidth 50} 14 | {.end} 15 | 16 | :OUTPUT 17 | 250x175 35 71 18 | 250x175 100w 100w 19 | 20 | 400x100 12 200 21 | 400x100 300w 100w 22 | 23 | 800x400 25 100 24 | 800x400 100w 100w 25 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-round-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "numbers": [ 4 | -1.9, -1.6, -1.5, -1.4, -1.1, 1.1, 1.4, 1.5, 1.6, 1.9 5 | ] 6 | } 7 | 8 | :TEMPLATE 9 | {.repeated section numbers} 10 | {@} {@|round} 11 | {.end} 12 | 13 | :OUTPUT 14 | -1.9 -2 15 | 16 | -1.6 -2 17 | 18 | -1.5 -1 19 | 20 | -1.4 -1 21 | 22 | -1.1 -1 23 | 24 | 1.1 1 25 | 26 | 1.4 1 27 | 28 | 1.5 2 29 | 30 | 1.6 2 31 | 32 | 1.9 2 33 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-safe-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "snippets": [ 4 | "link", 5 | "bold string" 6 | ] 7 | } 8 | 9 | :TEMPLATE 10 | {.repeated section snippets} 11 | {@|safe} 12 | {.end} 13 | 14 | :OUTPUT 15 | link 16 | 17 | bold string 18 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-sale-price-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "structuredContent": { 4 | "productType": 1, 5 | "variants": [ 6 | {"priceMoney": { "value": "100" } }, 7 | {"onSale": true, "salePriceMoney": { "value": "50" } } 8 | ] 9 | } 10 | } 11 | 12 | :TEMPLATE 13 | {@|sale-price} 14 | 15 | :OUTPUT 16 | 5000 17 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-sale-price-2.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "structuredContent": { 4 | "productType": 2, 5 | "onSale": true, 6 | "salePriceMoney": { "value": "100.00" } 7 | } 8 | } 9 | 10 | :TEMPLATE 11 | {@|sale-price} 12 | 13 | :OUTPUT 14 | 10000 -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-sale-price-3.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "structuredContent": { 4 | "productType": 1, 5 | "variants": [] 6 | } 7 | } 8 | 9 | :TEMPLATE 10 | {@|sale-price} 11 | 12 | :OUTPUT 13 | 0 -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-sale-price-4.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "structuredContent": { 4 | "productType": 2 5 | } 6 | } 7 | 8 | :TEMPLATE 9 | {@|sale-price} 10 | 11 | :OUTPUT 12 | 0 -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-sale-price-5.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "structuredContent": { 4 | "productType": 1, 5 | "variants": [ 6 | {"priceMoney": { "value": "1.00" } } 7 | ] 8 | } 9 | } 10 | 11 | :TEMPLATE 12 | {@|sale-price} 13 | 14 | :OUTPUT 15 | 0 -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-sale-price-6.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "structuredContent": { 4 | "productType": 1, 5 | "variants": [ 6 | {"priceMoney": { "value": "1.00" } }, 7 | {"onSale": true, "salePriceMoney": { "value": ".50" } }, 8 | {"onSale": true, "salePriceMoney": { "value": ".25" } }, 9 | {"onSale": true, "salePriceMoney": { "value": ".75" } } 10 | ] 11 | } 12 | } 13 | 14 | :TEMPLATE 15 | {@|sale-price} 16 | 17 | :OUTPUT 18 | 25 -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-sale-price-7.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "structuredContent": { 4 | "productType": -1 5 | } 6 | } 7 | 8 | :TEMPLATE 9 | {@|sale-price} 10 | 11 | :OUTPUT 12 | 0 -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-slugify-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "headlines": [ 4 | "International Moose Count Finally Underway", 5 | "Cold Wave Linked to Temperatures", 6 | "If Strike Isn't Settled Quickly, It May Last Awhile" 7 | ] 8 | } 9 | 10 | :TEMPLATE 11 | {.repeated section headlines} 12 | {@|slugify} 13 | {.end} 14 | 15 | :OUTPUT 16 | international-moose-count-finally-underway 17 | 18 | cold-wave-linked-to-temperatures 19 | 20 | if-strike-isnt-settled-quickly-it-may-last-awhile 21 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-smartypants-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "snippets": [ 4 | "Yes, I've read both \"Don Quixote\" and \"A Tale of Two Cities\".", 5 | "I spoke to Larry--the project lead--about the issue." 6 | ] 7 | } 8 | 9 | :TEMPLATE 10 | {.repeated section snippets} 11 | {@} 12 | {@|smartypants} 13 | {.end} 14 | 15 | :OUTPUT 16 | Yes, I've read both "Don Quixote" and "A Tale of Two Cities". 17 | Yes, I’ve read both “Don Quixote” and “A Tale of Two Cities”. 18 | 19 | I spoke to Larry--the project lead--about the issue. 20 | I spoke to Larry—the project lead—about the issue. 21 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-social-button-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "website": {"shareButtonOptions": ["foo"]}, 4 | "mainImageId": "560c37c1a7c8465c4a71d99a", 5 | "mainImage": {"assetUrl": "http://foo.com/bar.jpg"}, 6 | "recordType": 1, 7 | "title": "foo image", 8 | "fullUrl": "http://full.com/url" 9 | } 10 | 11 | :TEMPLATE 12 | {@|social-button} 13 | 14 | :OUTPUT 15 |
16 | 17 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-social-button-inline-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "website": {"shareButtonOptions": ["foo"]}, 4 | "mainImageId": "560c37c1a7c8465c4a71d99a", 5 | "mainImage": {"assetUrl": "http://foo.com/bar.jpg"}, 6 | "recordType": 1, 7 | "title": "foo image", 8 | "fullUrl": "http://full.com/url" 9 | } 10 | 11 | :TEMPLATE 12 | {@|social-button-inline} 13 | 14 | :OUTPUT 15 | 16 | 17 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-str-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "null": null, 4 | "number": -15, 5 | "boolean": false, 6 | "string": "Central Park", 7 | "object": { "color": "red", "price": "17.50" }, 8 | "array": [1, 2, "blue", 5] 9 | } 10 | 11 | :TEMPLATE 12 | {null|str} 13 | {boolean|str} 14 | {number|str} 15 | {string|str} 16 | {object|str} 17 | {array|str} 18 | 19 | :OUTPUT 20 | false 21 | -15 22 | Central Park 23 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-subscription-price-no-pricing-options.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "structuredContent": { 4 | "productType": 1, 5 | "variants": [{ 6 | "priceMoney": { 7 | "value": "50" 8 | }, 9 | "onSale": false 10 | }] 11 | } 12 | } 13 | 14 | :TEMPLATE 15 | {@|subscription-price} 16 | 17 | :OUTPUT 18 |
19 | 20 |
-------------------------------------------------------------------------------- /__tests__/plugins/resources/f-summary-form-field-address-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "field": { 4 | "type": "address", 5 | "rawTitle": "Address", 6 | "values": { 7 | "Line1": "123 Main St", 8 | "Line2": "Apt #1", 9 | "City": "New York", 10 | "State": "New York", 11 | "Zip": "10013", 12 | "Country": "US" 13 | } 14 | } 15 | } 16 | 17 | :TEMPLATE 18 | {field|summary-form-field} 19 | 20 | :OUTPUT 21 |
22 | Address:
23 |
123 Main St
24 |
Apt #1
25 |
New York, New York 10013 US
26 |
27 |
28 | 29 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-summary-form-field-address-2.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "field": { 4 | "type": "address", 5 | "rawTitle": "Address", 6 | "values": { 7 | "Line1": "123 Main St", 8 | "City": "New York", 9 | "State": "New York", 10 | "Zip": "10013", 11 | "Country": "US" 12 | } 13 | } 14 | } 15 | 16 | :TEMPLATE 17 | {field|summary-form-field} 18 | 19 | :OUTPUT 20 |
21 | Address:
22 |
123 Main St
23 |
New York, New York 10013 US
24 |
25 |
26 | 27 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-summary-form-field-checkbox-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "field": { 4 | "type": "checkbox", 5 | "rawTitle": "Checkbox", 6 | "value": "Static Value" 7 | } 8 | } 9 | 10 | :TEMPLATE 11 | {field|summary-form-field} 12 | 13 | :OUTPUT 14 |
15 | Checkbox: Static Value 16 |
17 | 18 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-summary-form-field-checkbox-2.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "field": { 4 | "type": "checkbox", 5 | "rawTitle": "Checkbox", 6 | "values": [ 7 | "One", "Two", "Three" 8 | ] 9 | } 10 | } 11 | 12 | :TEMPLATE 13 | {field|summary-form-field} 14 | 15 | :OUTPUT 16 |
17 | Checkbox: One, Two, Three 18 | 19 |
20 | 21 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-summary-form-field-checkbox-3.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "field": { 4 | "type": "checkbox", 5 | "rawTitle": "Checkbox" 6 | } 7 | } 8 | 9 | :TEMPLATE 10 | {field|summary-form-field} 11 | 12 | :OUTPUT 13 |
14 | Checkbox: N/A 15 |
16 | 17 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-summary-form-field-date-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "field": { 4 | "type": "date", 5 | "rawTitle": "Date", 6 | "values": {"Month": "11", "Day": "23", "Year": "2010"} 7 | } 8 | } 9 | 10 | :TEMPLATE 11 | {field|summary-form-field} 12 | 13 | :OUTPUT 14 |
15 | Date: 11/23/2010 16 |
17 | 18 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-summary-form-field-default-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "field": { 4 | "type": "unknown", 5 | "rawTitle": "Unknown", 6 | "value": "Static Text" 7 | } 8 | } 9 | 10 | :TEMPLATE 11 | {field|summary-form-field} 12 | 13 | :OUTPUT 14 |
15 | Unknown: Static Text 16 |
17 | 18 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-summary-form-field-likert-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "field": { 4 | "type": "likert", 5 | "rawTitle": "Views", 6 | "values": { 7 | "Stuff is good": "1", 8 | "Things are nice": "2" 9 | } 10 | } 11 | } 12 | 13 | :TEMPLATE 14 | {field|summary-form-field} 15 | 16 | :OUTPUT 17 |
18 | Views:
19 |
Stuff is good: Agree
20 |
Things are nice: Strongly Agree
21 |
22 |
23 | 24 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-summary-form-field-name-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "field": { 4 | "type": "name", 5 | "rawTitle": "Name", 6 | "values": {"First": "John", "Last": "Doe"}} 7 | } 8 | 9 | :TEMPLATE 10 | {field|summary-form-field} 11 | 12 | :OUTPUT 13 |
14 | Name: John Doe 15 |
16 | 17 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-summary-form-field-phone-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "field": { 4 | "type": "phone", 5 | "rawTitle": "Phone", 6 | "values": { 7 | "Country": "1", 8 | "Areacode": "646", 9 | "Prefix": "123", 10 | "Line": "0000" 11 | } 12 | } 13 | } 14 | 15 | :TEMPLATE 16 | {field|summary-form-field} 17 | 18 | :OUTPUT 19 |
20 | Phone: +1 646-123-0000 21 |
22 | 23 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-summary-form-field-phone-2.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "field": { 4 | "type": "phone", 5 | "rawTitle": "Phone", 6 | "values": { 7 | "Areacode": "646", 8 | "Prefix": "123", 9 | "Line": "0000" 10 | } 11 | } 12 | } 13 | 14 | :TEMPLATE 15 | {field|summary-form-field} 16 | 17 | :OUTPUT 18 |
19 | Phone: 646-123-0000 20 |
21 | 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-summary-form-field-time-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "field": { 4 | "type": "time", 5 | "rawTitle": "Time", 6 | "values": {"Hour": 9, "Minute": 15, "Second": 31, "Ampm": "am"} 7 | } 8 | } 9 | 10 | :TEMPLATE 11 | {field|summary-form-field} 12 | 13 | :OUTPUT 14 |
15 | Time: 9:15:31 am 16 |
17 | 18 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-summary-form-field-time-2.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "field": { 4 | "type": "time", 5 | "rawTitle": "Time", 6 | "values": {"Hour": 4, "Ampm": "pm"} 7 | } 8 | } 9 | 10 | :TEMPLATE 11 | {field|summary-form-field} 12 | 13 | :OUTPUT 14 |
15 | Time: 4:00:00 pm 16 |
17 | 18 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-summary-form-field-time-3.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "field": { 4 | "type": "time", 5 | "rawTitle": "Time", 6 | "values": {"Minute": "30", "Ampm": "am"} 7 | } 8 | } 9 | 10 | :TEMPLATE 11 | {field|summary-form-field} 12 | 13 | :OUTPUT 14 |
15 | Time: 00:30:00 am 16 |
17 | 18 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-summary-form-field-unk-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "field": { 4 | "type": "unknown", 5 | "rawTitle": "Unknown" 6 | } 7 | } 8 | 9 | :TEMPLATE 10 | {field|summary-form-field} 11 | 12 | :OUTPUT 13 |
14 | Unknown: N/A 15 |
16 | 17 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-timesince-1.html: -------------------------------------------------------------------------------- 1 | :PARAMS 2 | { 3 | "now": 1627849845000 4 | } 5 | 6 | :JSON 7 | { 8 | "events": [ 9 | -607001400000, 10 | 1577987019000 11 | ] 12 | } 13 | 14 | :TEMPLATE 15 | {.repeated section events} 16 | {@|timesince} 17 | {.end} 18 | 19 | :OUTPUT 20 | about 70 years ago 21 | 22 | about a year ago 23 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-twitter-follow-button-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "userName": "foobar" 4 | } 5 | 6 | :TEMPLATE 7 | {@|twitter-follow-button} 8 | 9 | :OUTPUT 10 |
11 | 12 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-twitter-follow-button-2.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "userName": "", 4 | "profileUrl": "http://twitter.com/foobar" 5 | } 6 | 7 | :TEMPLATE 8 | {@|twitter-follow-button} 9 | 10 | :OUTPUT 11 |
12 | 13 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-url-encode-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "s": [ 4 | "“😍”", 5 | "\u201ca b\u201d" 6 | ] 7 | } 8 | 9 | :TEMPLATE 10 | {.repeated section s} 11 | {@} 12 | {@|url-encode} 13 | {.end} 14 | 15 | 16 | :OUTPUT 17 | “😍” 18 | %E2%80%9C%F0%9F%98%8D%E2%80%9D 19 | 20 | “a b” 21 | %E2%80%9Ca%20b%E2%80%9D 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-variant-descriptor-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "optionValues": [ 4 | {"value": "blue"}, 5 | {"value": "large"}, 6 | {"value": "normal"} 7 | ] 8 | } 9 | 10 | :TEMPLATE 11 | {@|variant-descriptor} 12 | 13 | :OUTPUT 14 | blue / large / normal 15 | 16 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-variant-descriptor-2.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | } 4 | 5 | :TEMPLATE 6 | {@|variant-descriptor} 7 | 8 | :OUTPUT 9 | 10 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-variants-select-3.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "item": { 4 | "id": "560c37c1a7c8465c4a71d99a", 5 | "structuredContent": { 6 | "variants": [], 7 | "variantOptionOrdering": [] 8 | } 9 | } 10 | } 11 | 12 | :TEMPLATE 13 | {item|variants-select} 14 | 15 | :OUTPUT 16 | 17 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-video-3.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "oembed": { 4 | "html": "", 5 | "providerName": "youtube" 6 | }, 7 | "originalSize": 1000, 8 | "assetUrl": "/foo/bar.mp4", 9 | "mediaFocalPoint": {"x": 0.3, "y": 0.7}, 10 | "overlay": true, 11 | "colorData": { 12 | } 13 | } 14 | 15 | :TEMPLATE 16 | {@|video color-data} 17 | 18 | :OUTPUT 19 |
20 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-website-color-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "hue": 200, 4 | "saturation": 0.3, 5 | "lightness": 0.5, 6 | "alpha": 0.9 7 | } 8 | 9 | :TEMPLATE 10 | {@|website-color} 11 | 12 | :OUTPUT 13 | 14 | hsla(200, 30%, 50%, 0.9) 15 | 16 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-website-color-2.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "hue": 110, 4 | "saturation": 0.9, 5 | "lightness": 1 6 | } 7 | 8 | :TEMPLATE 9 | {@|website-color} 10 | 11 | :OUTPUT 12 | 13 | hsl(110, 90%, 100%) 14 | 15 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-website-color-3.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "saturation": 0.9, 4 | "lightness": 1 5 | } 6 | 7 | :TEMPLATE 8 | {@|website-color} 9 | 10 | :OUTPUT 11 | 12 | Missing an H/S/L value. 13 | 14 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-website-color-4.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "hue": 400, 4 | "saturation": -0.3, 5 | "lightness": 5, 6 | "alpha": 3 7 | } 8 | 9 | :TEMPLATE 10 | {@|website-color} 11 | 12 | :OUTPUT 13 | 14 | Hue out of bounds. Saturation out of bounds. Lightness out of bounds. Alpha out of bounds. 15 | 16 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-website-color-5.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "hue": 0.956, 4 | "saturation": 0.9554, 5 | "lightness": 0.9567, 6 | "alpha": 0.555 7 | } 8 | 9 | :TEMPLATE 10 | {@|website-color} 11 | 12 | :OUTPUT 13 | 14 | hsla(0.96, 95.54%, 95.67%, 0.56) -------------------------------------------------------------------------------- /__tests__/plugins/resources/f-width-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "hw": "800x400" 4 | } 5 | 6 | :TEMPLATE 7 | {hw|width} 8 | 9 | :OUTPUT 10 | 800 11 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/has-variants.json: -------------------------------------------------------------------------------- 1 | :hasVariedPrices-1-true 2 | { 3 | "structuredContent": { 4 | "productType": 1, 5 | "variants": [{}, {}, {}] 6 | } 7 | } 8 | 9 | :hasVariedPrices-2-false 10 | { 11 | "structuredContent": { 12 | "productType": 3, 13 | "variants": [] 14 | } 15 | } 16 | 17 | :hasVariedPrices-3-false 18 | { 19 | "structuredContent": { 20 | "productType": 1, 21 | "variants": [{}] 22 | } 23 | } 24 | 25 | :hasVariedPrices-4-false 26 | { 27 | "structuredContent": { 28 | "productType": 2 29 | } 30 | } 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/f-datetime-interval-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "website": {"timeZone": "America/Los_Angeles"}, 4 | "dates": [ 5 | {"start": 1509647217000, "end": 1510641417000}, 6 | {"start": 1502298000000, "end": 1502305200000} 7 | ] 8 | } 9 | 10 | 11 | :TEMPLATE 12 | {.repeated section dates} 13 | {start, end|datetime-interval}{.end} 14 | {.repeated section dates} 15 | {start, end|datetime-interval yMMMd}{.end} 16 | 17 | :OUTPUT 18 | Nov 2 – 13, 2017 19 | 10:00 AM – 12:00 PM PT 20 | 21 | Nov 2 – 13, 2017 22 | Aug 9, 2017 – Aug 9, 2017 23 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/f-decimal-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "nums": ["0", "1", "1.00", "3.59", "1200", "-15789.12", "99999.00", "-100200300.40", "-10000000001.00"], 4 | "invalid": "xyz" 5 | } 6 | 7 | :TEMPLATE 8 | {.repeated section nums} 9 | {@|decimal} {@|decimal group}{.end} 10 | 11 | {invalid|decimal group:true} 12 | 13 | :OUTPUT 14 | 0 0 15 | 1 1 16 | 1 1 17 | 3.59 3.59 18 | 1200 1,200 19 | -15789.12 -15,789.12 20 | 99999 99,999 21 | -100200300.4 -100,200,300.4 22 | -10000000001 -10,000,000,001 23 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/f-decimal-2.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | [ 3 | "0", "1", "1.01", "1.001", "3.14159", "1.3456" 4 | ] 5 | 6 | :TEMPLATE 7 | {.repeated section @} 8 | {@|decimal mode:significant-maxfrac minsig:1 maxfrac:3}{.end} 9 | 10 | :OUTPUT 11 | 0 12 | 1 13 | 1.01 14 | 1.001 15 | 3.142 16 | 1.346 17 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/f-foo.html: -------------------------------------------------------------------------------- 1 | 2 | :JSON 3 | { 4 | "structuredContent": { 5 | "productType": 1, 6 | "variants": [ 7 | {"price": 10000}, 8 | {"price": 20000} 9 | ] 10 | }, 11 | "localizedStrings": { 12 | "productPriceStartingFromText": "hello {0}" 13 | } 14 | } 15 | 16 | :TEMPLATE 17 | {@|product-price} 18 | 19 | :OUTPUT 20 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/f-message-datetime-interval-en-US.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "messages": { 4 | "event": "The event will take place {0;1 datetime-interval}." 5 | }, 6 | "events": [ 7 | {"s": "1525198211000", "e": "1531678211000"}, 8 | {"s": "1525604400000", "e": "1525626000000"} 9 | ] 10 | } 11 | 12 | :TEMPLATE 13 | {.repeated section events} 14 | {messages.event|message s e}{.end} 15 | 16 | :OUTPUT 17 | The event will take place May 1 – Jul 15, 2018. 18 | The event will take place 7:00 AM – 1:00 PM ET. 19 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/f-message-datetime-interval-fr-FR.html: -------------------------------------------------------------------------------- 1 | :PROPERTIES 2 | locale=fr-FR 3 | 4 | :JSON 5 | { 6 | "messages": { 7 | "event": "The event will take place {0;1 datetime-interval}." 8 | }, 9 | "events": [ 10 | {"s": "1525198211000", "e": "1531678211000"}, 11 | {"s": "1525604400000", "e": "1525626000000"} 12 | ] 13 | } 14 | 15 | :TEMPLATE 16 | {.repeated section events} 17 | {messages.event|message s e}{.end} 18 | 19 | :OUTPUT 20 | The event will take place 1 mai – 15 juil. 2018. 21 | The event will take place 7:00 AM – 1:00 PM UTC−4. 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/f-message-named-args.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "messages": { 4 | "transfer": "Transmission of {data unit in:byte compact:bytes} took {elapsed unit in:second sequence:hour,minute,second format:long}" 5 | }, 6 | "bytes": "12345657890", 7 | "duration": "12345" 8 | } 9 | 10 | :TEMPLATE 11 | {messages.transfer|message data:bytes elapsed:duration} 12 | 13 | :OUTPUT 14 | Transmission of 11.5GB took 3 hours 25 minutes 45 seconds 15 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/f-message-plural-pl-PL.html: -------------------------------------------------------------------------------- 1 | :PROPERTIES 2 | locale=pl-PL 3 | 4 | :JSON 5 | { 6 | "numbers": [0, 0.0, 0.1, 1, 1.0, 1.1, 2, 2.0, 3, 5, 8, 17, 17.0, 100, 101, 200], 7 | "messages": { 8 | "plural": "{0 plural zero{# ZERO} one{# ONE} two{# TWO} few{# FEW} many{# MANY} other{# OTHER}}" 9 | } 10 | } 11 | 12 | :TEMPLATE 13 | {.repeated section numbers} 14 | {messages.plural|message @}{.end} 15 | 16 | :OUTPUT 17 | 0 MANY 18 | 0.0 OTHER 19 | 0.1 OTHER 20 | 1 ONE 21 | 1.0 OTHER 22 | 1.1 OTHER 23 | 2 FEW 24 | 2.0 OTHER 25 | 3 FEW 26 | 5 MANY 27 | 8 MANY 28 | 17 MANY 29 | 17.0 OTHER 30 | 100 MANY 31 | 101 MANY 32 | 200 MANY 33 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/f-message-units-en-US.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "messages": { 4 | "transfer": "Transmission of {0 unit in:byte compact:bytes} took {1 unit in:second sequence:hour,minute,second format:long}" 5 | }, 6 | "bytes": "12345657890", 7 | "duration": "12345" 8 | } 9 | 10 | :TEMPLATE 11 | {messages.transfer|message bytes duration} 12 | 13 | :OUTPUT 14 | Transmission of 11.5GB took 3 hours 25 minutes 45 seconds 15 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/f-message-units-fr-FR.html: -------------------------------------------------------------------------------- 1 | :PROPERTIES 2 | locale=fr-FR 3 | 4 | :JSON 5 | { 6 | "messages": { 7 | "transfer": "Transmission of {0 unit in:byte compact:bytes} took {1 unit in:second sequence:hour,minute,second format:long}" 8 | }, 9 | "bytes": "12345657890", 10 | "duration": "12345" 11 | } 12 | 13 | :TEMPLATE 14 | {messages.transfer|message bytes duration} 15 | 16 | :OUTPUT 17 | Transmission of 11,5 Go took 3 heures 25 minutes 45 secondes -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/f-unit-angle-en-US.html: -------------------------------------------------------------------------------- 1 | :PROPERTIES 2 | locale: en-US 3 | 4 | :JSON 5 | { 6 | "degrees": "389.3592", 7 | "revs": 3.152, 8 | "radians": 17.2, 9 | "arcmins": "0.123" 10 | } 11 | 12 | :TEMPLATE 13 | {degrees|unit in:degree sequence:degree,arc-minute,arc-second} 14 | {degrees|unit in:degree sequence:degree,arc-minute,arc-second format:long} 15 | 16 | {revs|unit in:revolution sequence:degree,arc-minute} 17 | 18 | {radians|unit in:radians sequence:degree,arc-minute} 19 | 20 | {arcmins|unit in:arc-minute out:arc-minute,arc-second} 21 | 22 | :OUTPUT 23 | 389° 21′ 33.1″ 24 | 389 degrees 21 arcminutes 33.1 arcseconds 25 | 26 | 1134° 43.2′ 27 | 28 | 985° 29.2′ 29 | 30 | 7.4″ 31 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/f-unit-area-en-US.html: -------------------------------------------------------------------------------- 1 | :PROPERTIES 2 | locale: en-US 3 | 4 | :JSON 5 | { 6 | "acres": "15243.987" 7 | } 8 | 9 | :TEMPLATE 10 | {acres|unit in:acre out:square-kilometer group} 11 | {acres|unit in:acre out:square-yard group} 12 | {acres|unit in:acre out:square-centimeter group} 13 | 14 | :OUTPUT 15 | 61.7 km² 16 | 73,780,897.1yd² 17 | 616,902,266,939.3cm² 18 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/f-unit-frequency-en-US.html: -------------------------------------------------------------------------------- 1 | :PROPERTIES 2 | locale: en-US 3 | 4 | :JSON 5 | { 6 | "giga": "12345678999.12", 7 | "mega": "12345678.99" 8 | } 9 | 10 | :TEMPLATE 11 | {giga|unit in:hertz} 12 | {mega|unit in:hertz} 13 | {mega|unit in:hertz out:gigahertz maxfrac:6} 14 | 15 | :OUTPUT 16 | 12.3GHz 17 | 12.3MHz 18 | 0.012346GHz 19 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/i18n-money-format-AUD-de_DE.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | [ 3 | { 4 | "currencyCode": "AUD", 5 | "decimalValue": 1234.56 6 | }, 7 | { 8 | "currencyCode": "AUD", 9 | "decimalValue": -1234.56 10 | } 11 | ] 12 | 13 | :TEMPLATE 14 | {.repeated section @} 15 | {@|i18n-money-format de-DE} 16 | {.end} 17 | 18 | :OUTPUT 19 | 1.234,56 A$ 20 | 21 | -1.234,56 A$ 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/i18n-money-format-AUD-en_UK.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | [ 3 | { 4 | "currencyCode": "AUD", 5 | "decimalValue": 1234.56 6 | }, 7 | { 8 | "currencyCode": "AUD", 9 | "decimalValue": -1234.56 10 | } 11 | ] 12 | 13 | :TEMPLATE 14 | {.repeated section @} 15 | {@|i18n-money-format en-UK} 16 | {.end} 17 | 18 | :OUTPUT 19 | A$1,234.56 20 | 21 | -A$1,234.56 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/i18n-money-format-AUD-en_US.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | [ 3 | { 4 | "currencyCode": "AUD", 5 | "decimalValue": 1234.56 6 | }, 7 | { 8 | "currencyCode": "AUD", 9 | "decimalValue": -1234.56 10 | } 11 | ] 12 | 13 | :TEMPLATE 14 | {.repeated section @} 15 | {@|i18n-money-format en-US} 16 | {.end} 17 | 18 | :OUTPUT 19 | A$1,234.56 20 | 21 | -A$1,234.56 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/i18n-money-format-AUD-es_US.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | [ 3 | { 4 | "currencyCode": "AUD", 5 | "decimalValue": 1234.56 6 | }, 7 | { 8 | "currencyCode": "AUD", 9 | "decimalValue": -1234.56 10 | } 11 | ] 12 | 13 | :TEMPLATE 14 | {.repeated section @} 15 | {@|i18n-money-format es-US} 16 | {.end} 17 | 18 | :OUTPUT 19 | A$1,234.56 20 | 21 | -A$1,234.56 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/i18n-money-format-AUD-fr_FR.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | [ 3 | { 4 | "currencyCode": "AUD", 5 | "decimalValue": 1234.56 6 | }, 7 | { 8 | "currencyCode": "AUD", 9 | "decimalValue": -1234.56 10 | } 11 | ] 12 | 13 | :TEMPLATE 14 | {.repeated section @} 15 | {@|i18n-money-format fr-FR} 16 | {.end} 17 | 18 | :OUTPUT 19 | 1 234,56 A$ 20 | 21 | -1 234,56 A$ 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/i18n-money-format-AUD-sv_SE.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | [ 3 | { 4 | "currencyCode": "AUD", 5 | "decimalValue": 1234.56 6 | }, 7 | { 8 | "currencyCode": "AUD", 9 | "decimalValue": -1234.56 10 | } 11 | ] 12 | 13 | :TEMPLATE 14 | {.repeated section @} 15 | {@|i18n-money-format sv-SE} 16 | {.end} 17 | 18 | :OUTPUT 19 | 1 234,56 A$ 20 | 21 | -1 234,56 A$ 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/i18n-money-format-CAD-de_DE.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | [ 3 | { 4 | "currencyCode": "CAD", 5 | "decimalValue": 1234.56 6 | }, 7 | { 8 | "currencyCode": "CAD", 9 | "decimalValue": -1234.56 10 | } 11 | ] 12 | 13 | :TEMPLATE 14 | {.repeated section @} 15 | {@|i18n-money-format de-DE} 16 | {.end} 17 | 18 | :OUTPUT 19 | 1.234,56 C$ 20 | 21 | -1.234,56 C$ 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/i18n-money-format-CAD-en_UK.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | [ 3 | { 4 | "currencyCode": "CAD", 5 | "decimalValue": 1234.56 6 | }, 7 | { 8 | "currencyCode": "CAD", 9 | "decimalValue": -1234.56 10 | } 11 | ] 12 | 13 | :TEMPLATE 14 | {.repeated section @} 15 | {@|i18n-money-format en-UK} 16 | {.end} 17 | 18 | :OUTPUT 19 | C$1,234.56 20 | 21 | -C$1,234.56 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/i18n-money-format-CAD-en_US.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | [ 3 | { 4 | "currencyCode": "CAD", 5 | "decimalValue": 1234.56 6 | }, 7 | { 8 | "currencyCode": "CAD", 9 | "decimalValue": -1234.56 10 | } 11 | ] 12 | 13 | :TEMPLATE 14 | {.repeated section @} 15 | {@|i18n-money-format en-US} 16 | {.end} 17 | 18 | :OUTPUT 19 | C$1,234.56 20 | 21 | -C$1,234.56 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/i18n-money-format-CAD-es_US.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | [ 3 | { 4 | "currencyCode": "CAD", 5 | "decimalValue": 1234.56 6 | }, 7 | { 8 | "currencyCode": "CAD", 9 | "decimalValue": -1234.56 10 | } 11 | ] 12 | 13 | :TEMPLATE 14 | {.repeated section @} 15 | {@|i18n-money-format es-US} 16 | {.end} 17 | 18 | :OUTPUT 19 | C$1,234.56 20 | 21 | -C$1,234.56 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/i18n-money-format-CAD-fr_FR.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | [ 3 | { 4 | "currencyCode": "CAD", 5 | "decimalValue": 1234.56 6 | }, 7 | { 8 | "currencyCode": "CAD", 9 | "decimalValue": -1234.56 10 | } 11 | ] 12 | 13 | :TEMPLATE 14 | {.repeated section @} 15 | {@|i18n-money-format fr-FR} 16 | {.end} 17 | 18 | :OUTPUT 19 | 1 234,56 C$ 20 | 21 | -1 234,56 C$ 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/i18n-money-format-CAD-sv_SE.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | [ 3 | { 4 | "currencyCode": "CAD", 5 | "decimalValue": 1234.56 6 | }, 7 | { 8 | "currencyCode": "CAD", 9 | "decimalValue": -1234.56 10 | } 11 | ] 12 | 13 | :TEMPLATE 14 | {.repeated section @} 15 | {@|i18n-money-format sv-SE} 16 | {.end} 17 | 18 | :OUTPUT 19 | 1 234,56 C$ 20 | 21 | -1 234,56 C$ 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/i18n-money-format-EUR-de_DE.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | [ 3 | { 4 | "currencyCode": "EUR", 5 | "decimalValue": 1234.56 6 | }, 7 | { 8 | "currencyCode": "EUR", 9 | "decimalValue": -1234.56 10 | } 11 | ] 12 | 13 | :TEMPLATE 14 | {.repeated section @} 15 | {@|i18n-money-format de-DE} 16 | {.end} 17 | 18 | :OUTPUT 19 | 1.234,56€ 20 | 21 | -1.234,56€ 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/i18n-money-format-EUR-en_UK.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | [ 3 | { 4 | "currencyCode": "EUR", 5 | "decimalValue": 1234.56 6 | }, 7 | { 8 | "currencyCode": "EUR", 9 | "decimalValue": -1234.56 10 | } 11 | ] 12 | 13 | :TEMPLATE 14 | {.repeated section @} 15 | {@|i18n-money-format en-UK} 16 | {.end} 17 | 18 | :OUTPUT 19 | €1,234.56 20 | 21 | -€1,234.56 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/i18n-money-format-EUR-en_US.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | [ 3 | { 4 | "currencyCode": "EUR", 5 | "decimalValue": 1234.56 6 | }, 7 | { 8 | "currencyCode": "EUR", 9 | "decimalValue": -1234.56 10 | } 11 | ] 12 | 13 | :TEMPLATE 14 | {.repeated section @} 15 | {@|i18n-money-format en-US} 16 | {.end} 17 | 18 | :OUTPUT 19 | €1,234.56 20 | 21 | -€1,234.56 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/i18n-money-format-EUR-es_US.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | [ 3 | { 4 | "currencyCode": "EUR", 5 | "decimalValue": 1234.56 6 | }, 7 | { 8 | "currencyCode": "EUR", 9 | "decimalValue": -1234.56 10 | } 11 | ] 12 | 13 | :TEMPLATE 14 | {.repeated section @} 15 | {@|i18n-money-format es-US} 16 | {.end} 17 | 18 | :OUTPUT 19 | €1,234.56 20 | 21 | -€1,234.56 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/i18n-money-format-EUR-fr_FR.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | [ 3 | { 4 | "currencyCode": "EUR", 5 | "decimalValue": 1234.56 6 | }, 7 | { 8 | "currencyCode": "EUR", 9 | "decimalValue": -1234.56 10 | } 11 | ] 12 | 13 | :TEMPLATE 14 | {.repeated section @} 15 | {@|i18n-money-format fr-FR} 16 | {.end} 17 | 18 | :OUTPUT 19 | 1 234,56€ 20 | 21 | -1 234,56€ 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/i18n-money-format-EUR-sv_SE.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | [ 3 | { 4 | "currencyCode": "EUR", 5 | "decimalValue": 1234.56 6 | }, 7 | { 8 | "currencyCode": "EUR", 9 | "decimalValue": -1234.56 10 | } 11 | ] 12 | 13 | :TEMPLATE 14 | {.repeated section @} 15 | {@|i18n-money-format sv-SE} 16 | {.end} 17 | 18 | :OUTPUT 19 | 1 234,56€ 20 | 21 | -1 234,56€ 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/i18n-money-format-GBP-de_DE.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | [ 3 | { 4 | "currencyCode": "GBP", 5 | "decimalValue": 1234.56 6 | }, 7 | { 8 | "currencyCode": "GBP", 9 | "decimalValue": -1234.56 10 | } 11 | ] 12 | 13 | :TEMPLATE 14 | {.repeated section @} 15 | {@|i18n-money-format de-DE} 16 | {.end} 17 | 18 | :OUTPUT 19 | 1.234,56£ 20 | 21 | -1.234,56£ 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/i18n-money-format-GBP-en_UK.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | [ 3 | { 4 | "currencyCode": "GBP", 5 | "decimalValue": 1234.56 6 | }, 7 | { 8 | "currencyCode": "GBP", 9 | "decimalValue": -1234.56 10 | } 11 | ] 12 | 13 | :TEMPLATE 14 | {.repeated section @} 15 | {@|i18n-money-format en-UK} 16 | {.end} 17 | 18 | :OUTPUT 19 | £1,234.56 20 | 21 | -£1,234.56 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/i18n-money-format-GBP-en_US.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | [ 3 | { 4 | "currencyCode": "GBP", 5 | "decimalValue": 1234.56 6 | }, 7 | { 8 | "currencyCode": "GBP", 9 | "decimalValue": -1234.56 10 | } 11 | ] 12 | 13 | :TEMPLATE 14 | {.repeated section @} 15 | {@|i18n-money-format en-US} 16 | {.end} 17 | 18 | :OUTPUT 19 | £1,234.56 20 | 21 | -£1,234.56 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/i18n-money-format-GBP-es_US.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | [ 3 | { 4 | "currencyCode": "GBP", 5 | "decimalValue": 1234.56 6 | }, 7 | { 8 | "currencyCode": "GBP", 9 | "decimalValue": -1234.56 10 | } 11 | ] 12 | 13 | :TEMPLATE 14 | {.repeated section @} 15 | {@|i18n-money-format es-US} 16 | {.end} 17 | 18 | :OUTPUT 19 | £1,234.56 20 | 21 | -£1,234.56 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/i18n-money-format-GBP-fr_FR.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | [ 3 | { 4 | "currencyCode": "GBP", 5 | "decimalValue": 1234.56 6 | }, 7 | { 8 | "currencyCode": "GBP", 9 | "decimalValue": -1234.56 10 | } 11 | ] 12 | 13 | :TEMPLATE 14 | {.repeated section @} 15 | {@|i18n-money-format fr-FR} 16 | {.end} 17 | 18 | :OUTPUT 19 | 1 234,56£ 20 | 21 | -1 234,56£ 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/i18n-money-format-GBP-sv_SE.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | [ 3 | { 4 | "currencyCode": "GBP", 5 | "decimalValue": 1234.56 6 | }, 7 | { 8 | "currencyCode": "GBP", 9 | "decimalValue": -1234.56 10 | } 11 | ] 12 | 13 | :TEMPLATE 14 | {.repeated section @} 15 | {@|i18n-money-format sv-SE} 16 | {.end} 17 | 18 | :OUTPUT 19 | 1 234,56£ 20 | 21 | -1 234,56£ 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/i18n-money-format-JPY-de_DE.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | [ 3 | { 4 | "currencyCode": "JPY", 5 | "decimalValue": 1234.56 6 | }, 7 | { 8 | "currencyCode": "JPY", 9 | "decimalValue": -1234.56 10 | } 11 | ] 12 | 13 | :TEMPLATE 14 | {.repeated section @} 15 | {@|i18n-money-format de-DE} 16 | {.end} 17 | 18 | :OUTPUT 19 | 1.235¥ 20 | 21 | -1.235¥ 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/i18n-money-format-JPY-en_UK.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | [ 3 | { 4 | "currencyCode": "JPY", 5 | "decimalValue": 1234.56 6 | }, 7 | { 8 | "currencyCode": "JPY", 9 | "decimalValue": -1234.56 10 | } 11 | ] 12 | 13 | :TEMPLATE 14 | {.repeated section @} 15 | {@|i18n-money-format en-UK} 16 | {.end} 17 | 18 | :OUTPUT 19 | ¥1,235 20 | 21 | -¥1,235 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/i18n-money-format-JPY-en_US.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | [ 3 | { 4 | "currencyCode": "JPY", 5 | "decimalValue": 1234.56 6 | }, 7 | { 8 | "currencyCode": "JPY", 9 | "decimalValue": -1234.56 10 | } 11 | ] 12 | 13 | :TEMPLATE 14 | {.repeated section @} 15 | {@|i18n-money-format en-US} 16 | {.end} 17 | 18 | :OUTPUT 19 | ¥1,235 20 | 21 | -¥1,235 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/i18n-money-format-JPY-es_US.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | [ 3 | { 4 | "currencyCode": "JPY", 5 | "decimalValue": 1234.56 6 | }, 7 | { 8 | "currencyCode": "JPY", 9 | "decimalValue": -1234.56 10 | } 11 | ] 12 | 13 | :TEMPLATE 14 | {.repeated section @} 15 | {@|i18n-money-format es-US} 16 | {.end} 17 | 18 | :OUTPUT 19 | ¥1,235 20 | 21 | -¥1,235 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/i18n-money-format-JPY-fr_FR.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | [ 3 | { 4 | "currencyCode": "JPY", 5 | "decimalValue": 1234.56 6 | }, 7 | { 8 | "currencyCode": "JPY", 9 | "decimalValue": -1234.56 10 | } 11 | ] 12 | 13 | :TEMPLATE 14 | {.repeated section @} 15 | {@|i18n-money-format fr-FR} 16 | {.end} 17 | 18 | :OUTPUT 19 | 1 235¥ 20 | 21 | -1 235¥ 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/i18n-money-format-JPY-sv_SE.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | [ 3 | { 4 | "currencyCode": "JPY", 5 | "decimalValue": 1234.56 6 | }, 7 | { 8 | "currencyCode": "JPY", 9 | "decimalValue": -1234.56 10 | } 11 | ] 12 | 13 | :TEMPLATE 14 | {.repeated section @} 15 | {@|i18n-money-format sv-SE} 16 | {.end} 17 | 18 | :OUTPUT 19 | 1 235¥ 20 | 21 | -1 235¥ 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/i18n-money-format-SEK-de_DE.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | [ 3 | { 4 | "currencyCode": "SEK", 5 | "decimalValue": 1234.56 6 | }, 7 | { 8 | "currencyCode": "SEK", 9 | "decimalValue": -1234.56 10 | } 11 | ] 12 | 13 | :TEMPLATE 14 | {.repeated section @} 15 | {@|i18n-money-format de-DE} 16 | {.end} 17 | 18 | :OUTPUT 19 | 1.234,56 kr 20 | 21 | -1.234,56 kr 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/i18n-money-format-SEK-en_UK.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | [ 3 | { 4 | "currencyCode": "SEK", 5 | "decimalValue": 1234.56 6 | }, 7 | { 8 | "currencyCode": "SEK", 9 | "decimalValue": -1234.56 10 | } 11 | ] 12 | 13 | :TEMPLATE 14 | {.repeated section @} 15 | {@|i18n-money-format en-UK} 16 | {.end} 17 | 18 | :OUTPUT 19 | kr 1,234.56 20 | 21 | kr -1,234.56 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/i18n-money-format-SEK-en_US.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | [ 3 | { 4 | "currencyCode": "SEK", 5 | "decimalValue": 1234.56 6 | }, 7 | { 8 | "currencyCode": "SEK", 9 | "decimalValue": -1234.56 10 | } 11 | ] 12 | 13 | :TEMPLATE 14 | {.repeated section @} 15 | {@|i18n-money-format en-US} 16 | {.end} 17 | 18 | :OUTPUT 19 | kr 1,234.56 20 | 21 | kr -1,234.56 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/i18n-money-format-SEK-es_US.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | [ 3 | { 4 | "currencyCode": "SEK", 5 | "decimalValue": 1234.56 6 | }, 7 | { 8 | "currencyCode": "SEK", 9 | "decimalValue": -1234.56 10 | } 11 | ] 12 | 13 | :TEMPLATE 14 | {.repeated section @} 15 | {@|i18n-money-format es-US} 16 | {.end} 17 | 18 | :OUTPUT 19 | kr 1,234.56 20 | 21 | kr -1,234.56 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/i18n-money-format-SEK-fr_FR.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | [ 3 | { 4 | "currencyCode": "SEK", 5 | "decimalValue": 1234.56 6 | }, 7 | { 8 | "currencyCode": "SEK", 9 | "decimalValue": -1234.56 10 | } 11 | ] 12 | 13 | :TEMPLATE 14 | {.repeated section @} 15 | {@|i18n-money-format fr-FR} 16 | {.end} 17 | 18 | :OUTPUT 19 | 1 234,56 kr 20 | 21 | -1 234,56 kr 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/i18n-money-format-SEK-sv_SE.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | [ 3 | { 4 | "currencyCode": "SEK", 5 | "decimalValue": 1234.56 6 | }, 7 | { 8 | "currencyCode": "SEK", 9 | "decimalValue": -1234.56 10 | } 11 | ] 12 | 13 | :TEMPLATE 14 | {.repeated section @} 15 | {@|i18n-money-format sv-SE} 16 | {.end} 17 | 18 | :OUTPUT 19 | 1 234,56 kr 20 | 21 | -1 234,56 kr 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/i18n-money-format-USD-de_DE.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | [ 3 | { 4 | "currencyCode": "USD", 5 | "decimalValue": 1234.56 6 | }, 7 | { 8 | "currencyCode": "USD", 9 | "decimalValue": -1234.56 10 | } 11 | ] 12 | 13 | :TEMPLATE 14 | {.repeated section @} 15 | {@|i18n-money-format de-DE} 16 | {.end} 17 | 18 | :OUTPUT 19 | 1.234,56$ 20 | 21 | -1.234,56$ 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/i18n-money-format-USD-en_UK.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | [ 3 | { 4 | "currencyCode": "USD", 5 | "decimalValue": 1234.56 6 | }, 7 | { 8 | "currencyCode": "USD", 9 | "decimalValue": -1234.56 10 | } 11 | ] 12 | 13 | :TEMPLATE 14 | {.repeated section @} 15 | {@|i18n-money-format en-UK} 16 | {.end} 17 | 18 | :OUTPUT 19 | $1,234.56 20 | 21 | -$1,234.56 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/i18n-money-format-USD-en_US.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | [ 3 | { 4 | "currencyCode": "USD", 5 | "decimalValue": 1234.56 6 | }, 7 | { 8 | "currencyCode": "USD", 9 | "decimalValue": -1234.56 10 | } 11 | ] 12 | 13 | :TEMPLATE 14 | {.repeated section @} 15 | {@|i18n-money-format en-US} 16 | {.end} 17 | 18 | :OUTPUT 19 | $1,234.56 20 | 21 | -$1,234.56 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/i18n-money-format-USD-es_US.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | [ 3 | { 4 | "currencyCode": "USD", 5 | "decimalValue": 1234.56 6 | }, 7 | { 8 | "currencyCode": "USD", 9 | "decimalValue": -1234.56 10 | } 11 | ] 12 | 13 | :TEMPLATE 14 | {.repeated section @} 15 | {@|i18n-money-format es-US} 16 | {.end} 17 | 18 | :OUTPUT 19 | $1,234.56 20 | 21 | -$1,234.56 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/i18n-money-format-USD-fr_FR.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | [ 3 | { 4 | "currencyCode": "USD", 5 | "decimalValue": 1234.56 6 | }, 7 | { 8 | "currencyCode": "USD", 9 | "decimalValue": -1234.56 10 | } 11 | ] 12 | 13 | :TEMPLATE 14 | {.repeated section @} 15 | {@|i18n-money-format fr-FR} 16 | {.end} 17 | 18 | :OUTPUT 19 | 1 234,56$ 20 | 21 | -1 234,56$ 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/i18n-money-format-USD-sv_SE.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | [ 3 | { 4 | "currencyCode": "USD", 5 | "decimalValue": 1234.56 6 | }, 7 | { 8 | "currencyCode": "USD", 9 | "decimalValue": -1234.56 10 | } 11 | ] 12 | 13 | :TEMPLATE 14 | {.repeated section @} 15 | {@|i18n-money-format sv-SE} 16 | {.end} 17 | 18 | :OUTPUT 19 | 1 234,56$ 20 | 21 | -1 234,56$ 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/units/acceleration-in.html: -------------------------------------------------------------------------------- 1 | 2 | {fib-1|unit in:g-force out:g-force} 3 | {fib-1|unit in:g-force out:meter-per-second-squared} 4 | {fib-5|unit in:g-force out:meter-per-second-squared} 5 | 6 | {fib-1|unit in:meter-per-second-squared out:g-force maxfrac:3} 7 | {fib-5|unit in:meter-per-second-squared out:g-force maxfrac:3} 8 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/units/acceleration-out-en-US.html: -------------------------------------------------------------------------------- 1 | 2 | 1G 3 | 9.8m/s² 4 | 49m/s² 5 | 6 | 0.102Gs 7 | 0.510Gs 8 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/units/acceleration-out-fr-FR.html: -------------------------------------------------------------------------------- 1 | 2 | 1G 3 | 9,8 m/s² 4 | 49 m/s² 5 | 6 | 0,102G 7 | 0,510G 8 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/units/angle-out-en-US.html: -------------------------------------------------------------------------------- 1 | 2 | 21886.1° 3 | 21886° 6′ 18.7″ 4 | 21886 deg 6 arcmins 18.7 arcsecs 5 | 21886 degrees 6 arcminutes 18.7 arcseconds 6 | 7 | 60.8rev 8 | 60.8 rev 9 | 60.8 revolutions 10 | 11 | 382rad 12 | 382 rad 13 | 382 radians 14 | 15 | 11.2 degrees 16 | 672 degrees 17 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/units/angle-out-fr-FR.html: -------------------------------------------------------------------------------- 1 | 2 | 21886,1° 3 | 21886° 6′ 18,7″ 4 | 21886° 6′ 18,7″ 5 | 21886 degrés 6 minutes d’arc 18,7 secondes d’arc 6 | 7 | 60,8 tr 8 | 60,8 tr 9 | 60,8 tours 10 | 11 | 382 rad 12 | 382 rad 13 | 382 radians 14 | 15 | 11,2 degrés 16 | 672 degrés 17 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/units/area-in.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | {fib-15|unit in:square-centimeter} 4 | {fib-15|unit in:square-centimeter compact:area} 5 | {fib-15|unit in:square-meter out:square-foot group} 6 | 7 | {fac-12-neg|unit in:square-meter out:square-mile group} 8 | {fac-12|unit in:square-meter sequence:square-mile,square-foot group} 9 | 10 | {sqrt-fac-12|unit in:acre sequence:square-mile,square-yard group} 11 | {sqrt-fac-5|unit in:square-kilometer sequence:square-mile,acre,square-yard,square-foot group} 12 | {sqrt-fac-5|unit in:square-kilometer sequence:square-mile,acre,square-yard,square-foot group format:long} 13 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/units/area-out-en-US.html: -------------------------------------------------------------------------------- 1 | 2 | 94.6in² 3 | 94.6in² 4 | 6,566ft² 5 | 6 | -184.9mi² 7 | 184mi² 26,304,711.9ft² 8 | 9 | 34mi² 610,349.1yd² 10 | 4mi² 146ac 4,374yd² 4.8ft² 11 | 4 square miles 146 acres 4,374 square yards 4.8 square feet 12 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/units/area-out-fr-FR.html: -------------------------------------------------------------------------------- 1 | 2 | 610 cm² 3 | 610 cm² 4 | 5 | 6 566pi² 6 | -184,9mi² 7 | 184mi² 26 304 711,9pi² 8 | 9 | 34mi² 610 349,1 yd² 10 | 4mi² 146ac 4 374 yd² 4,8pi² 11 | 4 miles carrés 146 acres anglo-saxonnes 4 374 yards carrés 4,8 pieds carrés 12 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/units/consumption-out-en-US.html: -------------------------------------------------------------------------------- 1 | 2 | 1mpg 3 | 235.2mpg 4 | 5 | 4.3mpg 6 | 4.3mpg 7 | 4.3 miles per gallon 8 | 9 | 55mpg 10 | 4.3L/100km 11 | 4.3 liters per 100 kilometers 12 | 13 | 13mpg 14 | 0.2mpg 15 | 16 | 13 miles per gallon 17 | 0.2 miles per gallon 18 | 19 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/units/consumption-out-fr-FR.html: -------------------------------------------------------------------------------- 1 | 2 | 235,2l/100km 3 | 1l/100km 4 | 5 | 55l/100km 6 | 4,3 mi/gal 7 | 4,3 miles par gallon 8 | 9 | 4,3l/100km 10 | 4,3l/100km 11 | 4,3 litres aux 100 km 12 | 13 | 18,1l/100km 14 | 1 300l/100km 15 | 16 | 18,1 litres aux 100 km 17 | 1 300 litres aux 100 km 18 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/units/digital-out-en-US.html: -------------------------------------------------------------------------------- 1 | 2 | 0 bytes 3 | 1 byte 4 | 8 bits 5 | 6 | -1.4 bytes 7 | -1,448.2 kilobytes 8 | 9 | 4MB 10 | 4 megabytes 11 | 4,194,304byte 12 | 4096kB 13 | 14 | -26.8GB 15 | -26.8 gigabytes 16 | -27,476.8MB 17 | 18 | 54,210.11TB 19 | 54,210.11 terabytes 20 | 21 | 1,307.7Gb 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/units/digital-out-fr-FR.html: -------------------------------------------------------------------------------- 1 | 2 | 0 octet 3 | 1 octet 4 | 8 bits 5 | 6 | -1,4 octet 7 | -1 448,2 kilooctets 8 | 9 | 4 Mo 10 | 4 mégaoctets 11 | 4 194 304 octet 12 | 4096 ko 13 | 14 | -26,8 Go 15 | -26,8 gigaoctets 16 | -27 476,8 Mo 17 | 18 | 54 210,11 To 19 | 54 210,11 téraoctets 20 | 21 | 1 307,7 Gb 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/units/duration-out-en-US.html: -------------------------------------------------------------------------------- 1 | 2 | 38y 8m 5.8d 3 | 38 yrs 8 mths 5.8 days 4 | 38 years 8 months 5.8 days 5 | 6 | 1,220,703,125 nanoseconds 7 | 1s 220.7ms 8 | 0.02035 minutes 9 | 10 | 3 months 21 days 17 hours 13 minutes 7 seconds 11 | 1 year 6 months 17 days 6 hours 38 minutes 17 seconds 12 | 7 years 8 months 25 days 12 hours 13 minutes 13 seconds 13 | 14 | 1.4 months 15 | 1.4 months 16 | 42 days 17 | 18 | 12 minutes 19 | 0.00833 days 20 | 12 minutes 21 | 22 | 2 seconds 23 | 6 seconds 24 | 24 seconds 25 | 2 minutes 26 | 12 minutes 27 | 1.4 hours 28 | 11.2 hours 29 | 100.8 hours 30 | 1008 hours 31 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/units/duration-out-fr-FR.html: -------------------------------------------------------------------------------- 1 | 2 | 38a 8m 5,8j 3 | 38 ans 8 m 5,8 j 4 | 38 ans 8 mois 5,8 jours 5 | 6 | 1 220 703 125 nanosecondes 7 | 1s 220,7ms 8 | 0,02035 minute 9 | 10 | 3 mois 21 jours 17 heures 13 minutes 7 secondes 11 | 1 an 6 mois 17 jours 6 heures 38 minutes 17 secondes 12 | 7 ans 8 mois 25 jours 12 heures 13 minutes 13 secondes 13 | 14 | 1,4 mois 15 | 1,4 mois 16 | 42 jours 17 | 18 | 12 minutes 19 | 0,00833 jour 20 | 12 minutes 21 | 22 | 2 secondes 23 | 6 secondes 24 | 24 secondes 25 | 2 minutes 26 | 12 minutes 27 | 1,4 heure 28 | 11,2 heures 29 | 100,8 heures 30 | 1008 heures 31 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/units/electric-in.html: -------------------------------------------------------------------------------- 1 | 2 | {sqrt-fac-10|unit in:amp} 3 | {sqrt-fac-10|unit in:amps} 4 | {sqrt-fac-10|unit in:ampere} 5 | {sqrt-fac-10|unit in:ampere out:milliampere group} 6 | {sqrt-fac-10|unit in:amp sequence:amp,milliamp} 7 | 8 | {fac-10|unit in:milliamp group} 9 | {fac-10|unit in:milliamp compact:electric group} 10 | {fac-3|unit in:milliamp compact:electric group} -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/units/electric-out-en-US.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 1904.9A 4 | 1904.9A 5 | 1904.9A 6 | 1,904,940.9mA 7 | 1904A 940.9mA 8 | 9 | 3,628.8A 10 | 3,628.8A 11 | 6mA 12 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/units/electric-out-fr-FR.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 1904,9 A 4 | 1904,9 A 5 | 1904,9 A 6 | 1 904 940,9 mA 7 | 1904 A 940,9 mA 8 | 9 | 3 628,8 A 10 | 3 628,8 A 11 | 6 mA 12 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/units/energy-in.html: -------------------------------------------------------------------------------- 1 | 2 | {fac-10|unit in:joules compact:energy format:long} 3 | {fac-6|unit in:joules compact:energy format:long} 4 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/units/energy-out-en-US.html: -------------------------------------------------------------------------------- 1 | 2 | 3628.8 kilojoules 3 | 720 joules 4 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/units/energy-out-fr-FR.html: -------------------------------------------------------------------------------- 1 | 2 | 3628,8 kilojoules 3 | 720 joules 4 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/units/frequency-in.html: -------------------------------------------------------------------------------- 1 | 2 | {sqrt-fac-5|unit in:hertz} 3 | {sqrt-fac-18|unit in:hertz} 4 | {pow-5-13-neg|unit in:hertz} 5 | 6 | {sqrt-fac-5|unit in:megahertz out:kilohertz group} 7 | 8 | {fac-15|unit in:hertz compact:frequency group format:long} 9 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/units/frequency-out-en-US.html: -------------------------------------------------------------------------------- 1 | 2 | 11Hz 3 | 80MHz 4 | -1.2GHz 5 | 6 | 10,954.5kHz 7 | 8 | 1,307.7 gigahertz 9 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/units/frequency-out-fr-FR.html: -------------------------------------------------------------------------------- 1 | 2 | 11 Hz 3 | 80 MHz 4 | -1,2 GHz 5 | 6 | 10 954,5 kHz 7 | 8 | 1 307,7 gigahertz 9 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/units/length-out-en-US.html: -------------------------------------------------------------------------------- 1 | 2 | -2.4mi 3 | -2mi 2255′ 9.4″ 4 | -2 mi 2255 ft 9.4 in 5 | -2 miles 2255 feet 9.4 inches 6 | 7 | 7,560mi 8 | 140 yards 9 | 20 yards 10 | 3.3 yards 11 | 2 feet 12 | 6 inches 13 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/units/length-out-fr-FR.html: -------------------------------------------------------------------------------- 1 | 2 | -3,9km 3 | -3km 906m 25cm 4 | -3 km 906 m 25 cm 5 | -3 kilomètres 906 mètres 25 centimètres 6 | 7 | 12 166,6km 8 | 128 mètres 9 | 18,3 mètres 10 | 3 mètres 11 | 61 centimètres 12 | 15,2 centimètres 13 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/units/mass-out-en-US.html: -------------------------------------------------------------------------------- 1 | 2 | -430.6tn 3 | -430tn 1180# 11.4oz 4 | -430 tons 1,180 pounds 11.4 ounces 5 | 6 | 528 tons 7 | 44 tons 8 | 4 tons 9 | 800 pounds 10 | 88.9 pounds 11 | 11.1 pounds 12 | 1.6 pounds 13 | 4.2 ounces 14 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/units/mass-out-fr-FR.html: -------------------------------------------------------------------------------- 1 | 2 | -390,6 t 3 | -390 t 625kg 4 | -390 tonnes 625 kilogrammes 5 | 6 | 479 tonnes 7 | 39,9 tonnes 8 | 3,6 tonnes 9 | 362,9 kilogrammes 10 | 40,3 kilogrammes 11 | 5 kilogrammes 12 | 720 grammes 13 | 120 grammes 14 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/units/power-out-en-US.html: -------------------------------------------------------------------------------- 1 | 2 | 3.6kW 3 | 80kW 4 | 5 | 975,132.6 gigawatts 6 | 7 | 20.9 gigawatts 8 | 1.3 gigawatts 9 | 87.2 megawatts 10 | 6.2 megawatts 11 | 479 kilowatts 12 | 39.9 kilowatts 13 | 3.6 kilowatts 14 | 362.9 watts 15 | 16 | 5040W 17 | 40320W 18 | 362880W 19 | 3628800W 20 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/units/power-out-fr-FR.html: -------------------------------------------------------------------------------- 1 | 2 | 3,6kW 3 | 80kW 4 | 5 | 975 132,6 gigawatts 6 | 7 | 20,9 gigawatts 8 | 1,3 gigawatt 9 | 87,2 mégawatts 10 | 6,2 mégawatts 11 | 479 kilowatts 12 | 39,9 kilowatts 13 | 3,6 kilowatts 14 | 362,9 watts 15 | 16 | 5040W 17 | 40320W 18 | 362880W 19 | 3628800W 20 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/units/speed-in.html: -------------------------------------------------------------------------------- 1 | 2 | {sqrt-fac-15|unit in:meter-per-second group} 3 | {sqrt-fac-5|unit in:kilometer-per-hour group} 4 | 5 | {fac-10|unit in:meter-per-second compact:speed group} 6 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/units/speed-out-en-US.html: -------------------------------------------------------------------------------- 1 | 2 | 2,558,017mph 3 | 6.8mph 4 | 5 | 8,117,394.4mph 6 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/units/speed-out-fr-FR.html: -------------------------------------------------------------------------------- 1 | 2 | 4 116 729,3km/h 3 | 11km/h 4 | 5 | 13 063 680km/h 6 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/units/temperature-in.html: -------------------------------------------------------------------------------- 1 | 2 | {sqrt-fac-5|unit in:fahrenheit} 3 | {sqrt-fac-6|unit in:fahrenheit} 4 | {sqrt-fac-7|unit in:fahrenheit} 5 | {sqrt-fac-8|unit in:fahrenheit} 6 | 7 | {sqrt-fac-5|unit in:celsius} 8 | {sqrt-fac-6|unit in:celsius} 9 | {sqrt-fac-7|unit in:celsius} 10 | {sqrt-fac-8|unit in:celsius} 11 | 12 | {sqrt-fac-5|unit in:fahrenheit compact:temperature group format:long} 13 | {sqrt-fac-6|unit in:fahrenheit compact:temperature group format:long} 14 | {sqrt-fac-7|unit in:fahrenheit compact:temperature group format:long} 15 | 16 | {sqrt-fac-10|unit out:celsius} 17 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/units/temperature-out-en-US.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11° 4 | 26.8° 5 | 71° 6 | 200.8° 7 | 8 | 51.7° 9 | 80.3° 10 | 159.8° 11 | 393.4° 12 | 13 | 11 degrees Fahrenheit 14 | 26.8 degrees Fahrenheit 15 | 71 degrees Fahrenheit 16 | 17 | 1040.5°C 18 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/units/temperature-out-fr-FR.html: -------------------------------------------------------------------------------- 1 | 2 | -11,7°C 3 | -2,9°C 4 | 21,7°C 5 | 93,8°C 6 | 7 | 11°C 8 | 26,8°C 9 | 71°C 10 | 200,8°C 11 | 12 | -11,7 degrés Celsius 13 | -2,9 degrés Celsius 14 | 21,7 degrés Celsius 15 | 16 | 1904,9°C 17 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/units/volume-out-en-US.html: -------------------------------------------------------------------------------- 1 | 2 | 8.9mi³ 3 | 29m³ 4 | 232m³ 5 | 927.9m³ 6 | 7 | 1.5 cubic miles 8 | 1,710,373.5 cubic yards 9 | 8,144.6 cubic yards 10 | 4.7 cubic yards 11 | 12.8 cubic feet 12 | 1.4 cubic feet 13 | 307.6 cubic inches 14 | 43.9 cubic inches 15 | 16 | 1,691,328,201,806 gallons 17 | 345,451,021.6 gallons 18 | 1,645,004.9 gallons 19 | 958.6 gallons 20 | 95.9 gallons 21 | 10.7 gallons 22 | 1.3 gallons 23 | 1.5 pints 24 | 25 | 23.3ft³ 26 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/i18n/units/volume-out-fr-FR.html: -------------------------------------------------------------------------------- 1 | 2 | 8,9mi³ 3 | 29m³ 4 | 232m³ 5 | 927,9m³ 6 | 7 | 6,4 kilomètres cubes 8 | 1 307 674,4 mètres cubes 9 | 6 227 mètres cubes 10 | 3,6 mètres cubes 11 | 362 880 centimètres cubes 12 | 40 320 centimètres cubes 13 | 5 040 centimètres cubes 14 | 720 centimètres cubes 15 | 16 | 6 402 373,7 mégalitres 17 | 1 307,7 mégalitres 18 | 6,2 mégalitres 19 | 36,3 hectolitres 20 | 3,6 hectolitres 21 | 40,3 litres 22 | 5 litres 23 | 7,2 décilitres 24 | 25 | 1,4pi³ 26 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/is-multi-quantity-allowed-for-services.json: -------------------------------------------------------------------------------- 1 | :isMultipleQuantityAllowedForServices-1-true 2 | { 3 | "storeSettings": { 4 | } 5 | } 6 | 7 | :isMultipleQuantityAllowedForServices-2-true 8 | { 9 | "storeSettings": { 10 | "multipleQuantityAllowedForServices": true 11 | } 12 | } 13 | 14 | :isMultipleQuantityAllowedForServices-3-false 15 | { 16 | "storeSettings": { 17 | "multipleQuantityAllowedForServices": false 18 | } 19 | } -------------------------------------------------------------------------------- /__tests__/plugins/resources/p-active-time-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "items": [ 4 | { "recordType": 18 }, 5 | { "recordType": 31 } 6 | ] 7 | } 8 | 9 | :TEMPLATE 10 | {.repeated section items} 11 | {recordType} {.active-time?}yes{.or}no{.end} 12 | {.end} 13 | 14 | :OUTPUT 15 | 18 no 16 | 17 | 31 yes 18 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/p-attachment-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "items": [ 4 | { "recordType": 3 }, 5 | { "recordType": 19 } 6 | ] 7 | } 8 | 9 | :TEMPLATE 10 | {.repeated section items} 11 | {recordType} {.attachment?}yes{.or}no{.end} 12 | {.end} 13 | 14 | :OUTPUT 15 | 3 no 16 | 17 | 19 yes 18 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/p-audio-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "items": [ 4 | { "recordType": 18 }, 5 | { "recordType": 7 } 6 | ] 7 | } 8 | 9 | :TEMPLATE 10 | {.repeated section items} 11 | {recordType} {.audio?}yes{.or}no{.end} 12 | {.end} 13 | 14 | :OUTPUT 15 | 18 no 16 | 17 | 7 yes 18 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/p-background-source-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "items": [ 4 | {"backgroundSource": 1}, 5 | {"backgroundSource": 2}, 6 | {"backgroundSource": 3}, 7 | {"backgroundSource": 4} 8 | ] 9 | } 10 | 11 | :TEMPLATE 12 | {.section items.0}{.background-source-upload?}upload{.end}{.end} 13 | {.section items.1}{.background-source-instagram?}instagram{.end}{.end} 14 | {.section items.2}{.background-source-video?}video{.end}{.end} 15 | {.section items.3}{.background-source-none?}none{.end}{.end} 16 | 17 | :OUTPUT 18 | upload 19 | instagram 20 | video 21 | none 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/p-binary-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "items": [ 4 | { "recordType": 18 }, 5 | { "recordType": 15 } 6 | ] 7 | } 8 | 9 | 10 | :TEMPLATE 11 | {.repeated section items} 12 | {recordType} {.binary?}yes{.or}no{.end} 13 | {.end} 14 | 15 | :OUTPUT 16 | 18 no 17 | 18 | 15 yes 19 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/p-calendar-view-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "items": [ 4 | {"calendarView": true}, 5 | {"foo": 0}, 6 | {"calendarView": false} 7 | ] 8 | } 9 | 10 | :TEMPLATE 11 | {.section items.0}{.calendar-view?}0{.end}{.end} 12 | {.section items.1}{.calendar-view?}x{.or}1{.end}{.end} 13 | {.section items.2}{.calendar-view?}x{.or}2{.end}{.end} 14 | 15 | :OUTPUT 16 | 0 17 | 1 18 | 2 19 | 20 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/p-checkin-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "items": [ 4 | { "recordType": 3 }, 5 | { "recordType": 52 } 6 | ] 7 | } 8 | 9 | :TEMPLATE 10 | {.repeated section items} 11 | {recordType} {.checkin?}yes{.or}no{.end} 12 | {.end} 13 | 14 | :OUTPUT 15 | 3 no 16 | 17 | 52 yes 18 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/p-child-images-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "items": [ 4 | {"mainImageId": "560c37c1a7c8465c4a71d99a"} 5 | ] 6 | } 7 | 8 | :TEMPLATE 9 | {.section @}{.child-images?}yes{.or}no{.end}{.end} 10 | 11 | :OUTPUT 12 | yes 13 | 14 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/p-child-images-2.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "items": [ 4 | {"systemDataId": "560c37c1a7c8465c4a71d99a"} 5 | ] 6 | } 7 | 8 | :TEMPLATE 9 | {.section @}{.child-images?}yes{.or}no{.end}{.end} 10 | 11 | :OUTPUT 12 | yes 13 | 14 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/p-child-images-3.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "items": [ 4 | {"foo": 0} 5 | ] 6 | } 7 | 8 | :TEMPLATE 9 | {.section @}{.child-images?}yes{.or}no{.end}{.end} 10 | 11 | :OUTPUT 12 | no 13 | 14 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/p-child-images-4.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "items": [] 4 | } 5 | 6 | :TEMPLATE 7 | {.section @}{.child-images?}yes{.or}no{.end}{.end} 8 | 9 | :OUTPUT 10 | no 11 | 12 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/p-clickable-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "items": [ 4 | {"folderBehavior": 1}, 5 | {"folderBehavior": 2}, 6 | {"folderBehavior": -1}, 7 | {"foo": 0} 8 | ] 9 | } 10 | :TEMPLATE 11 | {.section items.0}{.clickable?}0{.end}{.end} 12 | {.section items.1}{.clickable?}1{.end}{.end} 13 | {.section items.2}{.clickable?}x{.or}2{.end}{.end} 14 | {.section items.3}{.clickable?}3{.end}{.end} 15 | 16 | :OUTPUT 17 | 0 18 | 1 19 | 2 20 | 3 21 | 22 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/p-collection-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "items": [ 4 | {"collection": {"foo": 0}}, 5 | {"collection": {}} 6 | ] 7 | } 8 | 9 | :TEMPLATE 10 | {.section items.0}{.collection?}0{.end}{.end} 11 | {.section items.1}{.collection?}x{.or}1{.end}{.end} 12 | 13 | :OUTPUT 14 | 0 15 | 1 16 | 17 | 18 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/p-collection-page-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "items": [ 4 | {"collection": {"type": 10}}, 5 | {"collection": {"type": 3}}, 6 | {"collection": {"foo": 0}} 7 | ] 8 | } 9 | 10 | :TEMPLATE 11 | {.section items.0}{.collection-page?}0{.end}{.end} 12 | {.section items.1}{.collection-page?}x{.or}1{.end}{.end} 13 | {.section items.2}{.collection-page?}x{.or}2{.end}{.end} 14 | 15 | :OUTPUT 16 | 0 17 | 1 18 | 2 19 | 20 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/p-collection-type-name-equals-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "one": { "typeName": "foo" }, 4 | "two": { "name": "foo" } 5 | } 6 | 7 | :TEMPLATE 8 | {.section one}{.collectionTypeNameEquals? foo}0{.end}{.end} 9 | {.section one}{.collectionTypeNameEquals? bar}x{.or}1{.end}{.end} 10 | {.section one}{.collectionTypeNameEquals?}x{.or}2{.end}{.end} 11 | {.section two}{.collectionTypeNameEquals? foo}x{.or}3{.end}{.end} 12 | {.section two}{.collectionTypeNameEquals?}x{.or}4{.end}{.end} 13 | 14 | :OUTPUT 15 | 0 16 | 1 17 | 2 18 | 3 19 | 4 -------------------------------------------------------------------------------- /__tests__/plugins/resources/p-current-type.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "items": [ 4 | {"currentType": 5}, 5 | {"currentType": -1} 6 | ] 7 | } 8 | 9 | :TEMPLATE 10 | {.section items.0}{.current-type? gallery}0{.end}{.end} 11 | {.section items.1}{.current-type? gallery}x{.or}1{.end}{.end} 12 | 13 | :OUTPUT 14 | 0 15 | 1 16 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/p-debug-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | {} 3 | 4 | :TEMPLATE 5 | {.debug?}true{.or}false{.end} 6 | 7 | :OUTPUT 8 | false 9 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/p-debug-2.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "debug": 1 4 | } 5 | 6 | :TEMPLATE 7 | {.debug?}true{.or}false{.end} 8 | 9 | :OUTPUT 10 | true 11 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/p-disqus-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "items": [ 4 | {"websiteSettings": {"disqusShortName": "abc"}}, 5 | {"websiteSettings": {"disqusShortName": ""}}, 6 | {"websiteSettings": {}} 7 | ] 8 | } 9 | 10 | :TEMPLATE 11 | {.section items.0}{.disqus?}0{.end}{.end} 12 | {.section items.1}{.disqus?}x{.or}1{.end}{.end} 13 | {.section items.2}{.disqus?}x{.or}2{.end}{.end} 14 | 15 | :OUTPUT 16 | 0 17 | 1 18 | 2 19 | 20 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/p-even-odd-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "items": [ 4 | -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 5 | 1.2, -3.3 6 | ] 7 | } 8 | 9 | :TEMPLATE 10 | {.repeated section items} 11 | {@} is {.even?}even{.end}{.odd?}odd{.end}{.end} 12 | 13 | :OUTPUT 14 | -5 is odd 15 | -4 is even 16 | -3 is odd 17 | -2 is even 18 | -1 is odd 19 | 0 is even 20 | 1 is odd 21 | 2 is even 22 | 3 is odd 23 | 4 is even 24 | 5 is odd 25 | 1.2 is 26 | -3.3 is 27 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/p-excerpt-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "items": [ 4 | {"excerpt": {"html": "foo bar baz"}}, 5 | {"excerpt": {"html": " "}}, 6 | {"excerpt": "abc def ghi"}, 7 | {"excerpt": " "}, 8 | {"excerpt": 123} 9 | ] 10 | } 11 | 12 | :TEMPLATE 13 | {.section items.0}{.excerpt?}0{.end}{.end} 14 | {.section items.1}{.excerpt?}x{.or}1{.end}{.end} 15 | {.section items.2}{.excerpt?}2{.end}{.end} 16 | {.section items.3}{.excerpt?}x{.or}3{.end}{.end} 17 | {.section items.4}{.excerpt?}x{.or}4{.end}{.end} 18 | 19 | :OUTPUT 20 | 0 21 | 1 22 | 2 23 | 3 24 | 4 25 | 26 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/p-external-link-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "items": [ 4 | {"externalLink": "http://foo.com/bar"}, 5 | {"externalLink": ""}, 6 | {"foo": 0} 7 | ] 8 | } 9 | 10 | :TEMPLATE 11 | {.section items.0}{.external-link?}0{.end}{.end} 12 | {.section items.1}{.external-link?}x{.or}1{.end}{.end} 13 | {.section items.2}{.external-link?}x{.or}2{.end}{.end} 14 | 15 | :OUTPUT 16 | 0 17 | 1 18 | 2 19 | 20 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/p-external-video-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "items": [ 4 | { "recordType": 3 }, 5 | { "promotedBlockType": "link" }, 6 | { "recordType": 18 }, 7 | { "promotedBlockType": "video" } 8 | ] 9 | } 10 | 11 | :TEMPLATE 12 | {.repeated section items} 13 | {@|json} {.external-video?}yes{.or}no{.end}{.end} 14 | 15 | :OUTPUT 16 | {"recordType":3} no 17 | {"promotedBlockType":"link"} no 18 | {"recordType":18} no 19 | {"promotedBlockType":"video"} yes 20 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/p-folder-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "items": [ 4 | {"collection": {"folder": true}}, 5 | {"collection": {"folder": false}}, 6 | {"collection": {"foo": 0}}, 7 | {"foo": 0} 8 | ] 9 | } 10 | 11 | :TEMPLATE 12 | {.section items.0}{.folder?}0{.end}{.end} 13 | {.section items.1}{.folder?}x{.or}1{.end}{.end} 14 | {.section items.2}{.folder?}x{.or}2{.end}{.end} 15 | {.section items.3}{.folder?}x{.or}3{.end}{.end} 16 | 17 | :OUTPUT 18 | 0 19 | 1 20 | 2 21 | 3 22 | 23 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/p-gallery-design-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "items": [ 4 | {"options": {"design": "grid"}}, 5 | {"options": {"design": "slideshow"}}, 6 | {"options": {"design": "slider"}}, 7 | {"options": {"design": "stacked"}}, 8 | {"options": {"design": "unknown"}}, 9 | {"options": {}} 10 | ] 11 | } 12 | 13 | :TEMPLATE 14 | {.repeated section items} 15 | {.gallery-design-grid?}grid{.end}{.gallery-design-slideshow?}slideshow{.end}{.gallery-design-slider?}slider{.end}{.gallery-design-stacked?}stacked{.end} {@index}{.end} 16 | 17 | :OUTPUT 18 | grid 1 19 | slideshow 2 20 | slider 3 21 | stacked 4 22 | 5 23 | 6 24 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/p-gallery-meta-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "items": [ 4 | {"options": {"controls": true}}, 5 | {"options": {"indicators": true}}, 6 | {"options": {"controls": false}}, 7 | {"options": {"indicators": false}}, 8 | {"options": {"foo": 0}} 9 | ] 10 | } 11 | 12 | :TEMPLATE 13 | {.section items.0}{.gallery-meta?}0{.end}{.end} 14 | {.section items.1}{.gallery-meta?}1{.end}{.end} 15 | {.section items.2}{.gallery-meta?}x{.or}2{.end}{.end} 16 | {.section items.3}{.gallery-meta?}x{.or}3{.end}{.end} 17 | {.section items.4}{.gallery-meta?}x{.or}4{.end}{.end} 18 | 19 | :OUTPUT 20 | 0 21 | 1 22 | 2 23 | 3 24 | 4 25 | 26 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/p-has-multiple-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "items": [ 4 | [1, 2, 3], 5 | [1] 6 | ] 7 | } 8 | 9 | :TEMPLATE 10 | {.section items.0}{.has-multiple?}0{.end}{.end} 11 | {.section items.1}{.has-multiple?}x{.or}1{.end}{.end} 12 | 13 | :OUTPUT 14 | 0 15 | 1 16 | 17 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/p-has-variants-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "items": [ 4 | {"structuredContent": {"productType": 1, "variants": [{}, {}]}}, 5 | {"structuredContent": {"productType": 2}}, 6 | {"structuredContent": {"variants": [{}]}} 7 | ] 8 | } 9 | 10 | :TEMPLATE 11 | {.section items.0}{.has-variants?}0{.end}{.end} 12 | {.section items.1}{.has-variants?}x{.or}1{.end}{.end} 13 | {.section items.2}{.has-variants?}x{.or}2{.end}{.end} 14 | 15 | :OUTPUT 16 | 0 17 | 1 18 | 2 19 | 20 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/p-location-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "items": [ 4 | {"location": {"mapLat": 33.448377, "mapLng": -112.074037}}, 5 | {"location": {"mapLat": 33.448377}}, 6 | {"location": {"foo": 0}}, 7 | {"foo": 0} 8 | ] 9 | } 10 | 11 | :TEMPLATE 12 | {.section items.0}{.location?}0{.end}{.end} 13 | {.section items.1}{.location?}x{.or}1{.end}{.end} 14 | {.section items.2}{.location?}x{.or}2{.end}{.end} 15 | {.section items.3}{.location?}x{.or}3{.end}{.end} 16 | 17 | :OUTPUT 18 | 0 19 | 1 20 | 2 21 | 3 22 | 23 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/p-main-image-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "items": [ 4 | {"mainImageId": "560c37c1a7c8465c4a71d99a"}, 5 | {"systemDataId": "560c37c1a7c8465c4a71d99a"}, 6 | {"foo": 0} 7 | ] 8 | } 9 | 10 | :TEMPLATE 11 | {.section items.0}{.main-image?}0{.end}{.end} 12 | {.section items.1}{.main-image?}1{.end}{.end} 13 | {.section items.2}{.main-image?}x{.or}2{.end}{.end} 14 | 15 | :OUTPUT 16 | 0 17 | 1 18 | 2 19 | 20 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/p-passthrough-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "items": [ 4 | {"passthrough": true, "sourceUrl": "http://foo.com/bar"}, 5 | {"passthrough": true, "sourceUrl": ""}, 6 | {"passthrough": false, "sourceUrl": "http://foo.com/bar"}, 7 | {"foo": 0} 8 | ] 9 | } 10 | 11 | :TEMPLATE 12 | {.section items.0}{.passthrough?}0{.end}{.end} 13 | {.section items.1}{.passthrough?}x{.or}1{.end}{.end} 14 | {.section items.2}{.passthrough?}x{.or}2{.end}{.end} 15 | {.section items.3}{.passthrough?}x{.or}3{.end}{.end} 16 | 17 | :OUTPUT 18 | 0 19 | 1 20 | 2 21 | 3 22 | 23 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/p-plural-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "n": [0, 1, 2, 3] 4 | } 5 | 6 | :TEMPLATE 7 | {.repeated section n} 8 | {@} {.plural?}yes{.or}no{.end}{.end} 9 | 10 | :OUTPUT 11 | 0 no 12 | 1 no 13 | 2 yes 14 | 3 yes 15 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/p-redirect-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "items": [ 4 | {"folderBehavior": 2}, 5 | {"folderBehavior": 1}, 6 | {"foo": 0} 7 | ] 8 | } 9 | 10 | :TEMPLATE 11 | {.section items.0}{.redirect?}0{.end}{.end} 12 | {.section items.1}{.redirect?}x{.or}1{.end}{.end} 13 | {.section items.2}{.redirect?}x{.or}2{.end}{.end} 14 | 15 | :OUTPUT 16 | 0 17 | 1 18 | 2 19 | 20 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/p-same-day-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "t": [ 4 | { "startDate": 1384518630000, "endDate": 1384515030000 }, 5 | { "startDate": 1384518630000, "endDate": 1384432230000 }, 6 | { "startDate": 1384518630000, "endDate": 1384605030000 } 7 | ] 8 | } 9 | 10 | :TEMPLATE 11 | {.repeated section t} 12 | {@|json} {.same-day?}yes{.or}no{.end}{.end} 13 | 14 | :OUTPUT 15 | {"startDate":1384518630000,"endDate":1384515030000} yes 16 | {"startDate":1384518630000,"endDate":1384432230000} no 17 | {"startDate":1384518630000,"endDate":1384605030000} no 18 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/p-service-name-email-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "items": [ 4 | {"serviceName": "email"}, 5 | {"serviceName": "other"}, 6 | {"foo": "0"} 7 | ] 8 | } 9 | 10 | :TEMPLATE 11 | {.section items.0}{.serviceNameEmail?}0{.end}{.end} 12 | {.section items.1}{.serviceNameEmail?}x{.or}1{.end}{.end} 13 | {.section items.2}{.serviceNameEmail?}x{.or}2{.end}{.end} 14 | 15 | :OUTPUT 16 | 0 17 | 1 18 | 2 19 | 20 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/p-show-past-events-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "items": [ 4 | {"showPastOrUpcomingEvents": "past"}, 5 | {"showPastOrUpcomingEvents": "upcoming"}, 6 | {"foo": 0} 7 | ] 8 | } 9 | 10 | :TEMPLATE 11 | {.section items.0}{.show-past-events?}0{.end}{.end} 12 | {.section items.1}{.show-past-events?}x{.or}1{.end}{.end} 13 | {.section items.2}{.show-past-events?}x{.or}2{.end}{.end} 14 | 15 | :OUTPUT 16 | 0 17 | 1 18 | 2 19 | 20 | -------------------------------------------------------------------------------- /__tests__/plugins/resources/p-singular-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | { 3 | "n": [0, 1, 2, 3] 4 | } 5 | 6 | :TEMPLATE 7 | {.repeated section n} 8 | {@} {.singular?}yes{.or}no{.end}{.end} 9 | 10 | :OUTPUT 11 | 0 no 12 | 1 yes 13 | 2 no 14 | 3 no 15 | -------------------------------------------------------------------------------- /__tests__/plugins/util.color.test.ts: -------------------------------------------------------------------------------- 1 | import { hexColorToInt } from '../../src/plugins/util.color'; 2 | 3 | test('hex 3', () => { 4 | expect(hexColorToInt('xyz')).toEqual(-1); 5 | }); 6 | 7 | test('hex 6', () => { 8 | expect(hexColorToInt('#000000')).toEqual(0); 9 | expect(hexColorToInt('ffffff')).toEqual(16777215); 10 | 11 | expect(hexColorToInt('a')).toEqual(-1); 12 | expect(hexColorToInt('xyzxyz')).toEqual(-1); 13 | }); 14 | -------------------------------------------------------------------------------- /__tests__/plugins/util.content.test.ts: -------------------------------------------------------------------------------- 1 | import * as contentutil from '../../src/plugins/util.content'; 2 | import { Node } from '../../src/node'; 3 | 4 | test('focal point', () => { 5 | const node = new Node({ mediaFocalPoint: { x: 0.6, y: 0.1 } }); 6 | expect(contentutil.getFocalPoint(node)).toEqual('0.6,0.1'); 7 | 8 | expect(contentutil.getFocalPoint(new Node({}))).toEqual('0.5,0.5'); 9 | }); 10 | -------------------------------------------------------------------------------- /__tests__/resources/ast-1.html: -------------------------------------------------------------------------------- 1 | :TEMPLATE 2 | a{b}c 3 | {d}e{f} 4 | 5 | :JSON 6 | [17, 1, [ 7 | [0, "a"], 8 | [1, [["b"]], 0], 9 | [0, "c\n"], 10 | [1, [["d"]], 0], 11 | [0, "e"], 12 | [1, [["f"]], 0] 13 | ], 18] 14 | -------------------------------------------------------------------------------- /__tests__/resources/ast-10.html: -------------------------------------------------------------------------------- 1 | :TEMPLATE 2 | {.newline} 3 | {.meta-left}abc{.meta-right} 4 | {.space} 5 | {.tab} 6 | 7 | :JSON 8 | [17,1, [ 9 | 14, 10 | [0, "\n"], 11 | 12, 12 | [0, "abc"], 13 | 13, 14 | [0, "\n"], 15 | 15, 16 | [0, "\n"], 17 | 16 18 | ], 18] 19 | -------------------------------------------------------------------------------- /__tests__/resources/ast-11.html: -------------------------------------------------------------------------------- 1 | :TEMPLATE 2 | {.if equal? foo bar} 3 | they are equal. 4 | {.end} 5 | 6 | :JSON 7 | [17, 1, [ 8 | [5, "equal?", [["foo","bar"], " "], [ 9 | [0,"\n they are equal.\n"] 10 | ], 3] 11 | ], 18] 12 | -------------------------------------------------------------------------------- /__tests__/resources/ast-12.html: -------------------------------------------------------------------------------- 1 | :TEMPLATE 2 | {.equal? foo bar} 3 | equal 4 | {.or} 5 | not equal 6 | {.end} 7 | 8 | :JSON 9 | [17, 1, [ 10 | [5, "equal?", [["foo", "bar"], " "], 11 | [[0,"\n equal\n"]], 12 | [7, 0, 0,[ 13 | [0,"\n not equal\n"] 14 | ], 3] 15 | ] 16 | ], 18] 17 | -------------------------------------------------------------------------------- /__tests__/resources/ast-13.html: -------------------------------------------------------------------------------- 1 | :TEMPLATE 2 | Hi, {person|apply person.html}! 3 | 4 | :JSON 5 | [17, 1, [ 6 | [0, "Hi, "], 7 | [1, [["person"]], [["apply", [["person.html"], " "]]]], 8 | [0, "!"] 9 | ], 18] 10 | -------------------------------------------------------------------------------- /__tests__/resources/ast-14.html: -------------------------------------------------------------------------------- 1 | :TEMPLATE 2 | {.if equal? distance 15} 3 | Distance is 15. 4 | {.end} 5 | 6 | :JSON 7 | [17, 1, [ 8 | [5, "equal?", [["distance","15"], " "], [ 9 | [0,"\nDistance is 15.\n"] 10 | ], 3] 11 | ], 18] 12 | -------------------------------------------------------------------------------- /__tests__/resources/ast-15.html: -------------------------------------------------------------------------------- 1 | :TEMPLATE 2 | Hi, {people.0.name}! 3 | 4 | :JSON 5 | [17, 1, [ 6 | [0, "Hi, "], 7 | [1, [["people", 0, "name"]], 0], 8 | [0, "!"] 9 | ], 18] 10 | -------------------------------------------------------------------------------- /__tests__/resources/ast-16.html: -------------------------------------------------------------------------------- 1 | :TEMPLATE 2 | {.ctx @foo a=bar.baz b=biz.quux} 3 | 4 | :JSON 5 | [17, 1, [ 6 | [22, "@foo", [ 7 | ["a", ["bar", "baz"]], 8 | ["b", ["biz", "quux"]] 9 | ]] 10 | ], 18] 11 | -------------------------------------------------------------------------------- /__tests__/resources/ast-17.html: -------------------------------------------------------------------------------- 1 | :TEMPLATE 2 | {## foo 3 | {.section baz} 4 | {a.b.c} 5 | {.end} 6 | bar ##} 7 | {# baz #} 8 | 9 | :JSON 10 | [17, 1, [ 11 | [11, " foo\n {.section baz}\n {a.b.c}\n {.end}\nbar ", 1], 12 | [0, "\n"], 13 | [11, " baz #", 0] 14 | ], 18] 15 | -------------------------------------------------------------------------------- /__tests__/resources/ast-18.html: -------------------------------------------------------------------------------- 1 | :TEMPLATE 2 | {.equal?|foo|"foo bar"} 3 | branch 1 4 | {.or equal?|baz|"foo bar"} 5 | branch 2 6 | {.or} 7 | branch 3 8 | {.end} 9 | 10 | :JSON 11 | [17, 1, [ 12 | [5,"equal?",[["foo","\"foo bar\""],"|"],[ 13 | [0,"\n branch 1\n"] 14 | ],[7,"equal?",[["baz","\"foo bar\""],"|"],[ 15 | [0,"\n branch 2\n"] 16 | ],[7,0,0,[ 17 | [0,"\n branch 3\n"] 18 | ],3]]] 19 | ],18] 20 | -------------------------------------------------------------------------------- /__tests__/resources/ast-19.html: -------------------------------------------------------------------------------- 1 | :TEMPLATE 2 | {.eval 1 * (2 + 7 / 2)} 3 | 4 | :JSON 5 | [17, 1, [ 6 | [23,"1 * (2 + 7 / 2)"] 7 | ],18] 8 | -------------------------------------------------------------------------------- /__tests__/resources/ast-2.html: -------------------------------------------------------------------------------- 1 | :TEMPLATE 2 | {foo|html|json} 3 | {bar|truncate 10|json-pretty} 4 | 5 | :JSON 6 | [17, 1, [ 7 | [1, [["foo"]], [["html"], ["json"]]], 8 | [0, "\n"], 9 | [1, [["bar"]], [["truncate", [["10"], " "]], ["json-pretty"]]] 10 | ], 18] 11 | -------------------------------------------------------------------------------- /__tests__/resources/ast-20.html: -------------------------------------------------------------------------------- 1 | :TEMPLATE 2 | {.include foo.html} 3 | {.include foo.html output} 4 | 5 | :JSON 6 | [17, 1, [ 7 | [24, "foo.html", [[], " "]], 8 | [0, "\n"], 9 | [24, "foo.html", [["output"], " "]] 10 | ], 18] 11 | -------------------------------------------------------------------------------- /__tests__/resources/ast-3.html: -------------------------------------------------------------------------------- 1 | :TEMPLATE 2 | {.repeated section items} 3 | a{.alternates with}---{.or}b 4 | {.end} 5 | 6 | {.repeated section items} 7 | {name} 8 | {.end} 9 | 10 | :JSON 11 | [17, 1, [ 12 | [4, ["items"], [ 13 | [0, "\na"] 14 | ], [7, 0, 0, [ 15 | [0, "b\n"] 16 | ], 3], [ 17 | [0, "---"] 18 | ]], 19 | [0, "\n\n"], 20 | [4, ["items"], [ 21 | [0, "\n"], 22 | [1, [["name"]], 0], 23 | [0, "\n"] 24 | ], 3, []] 25 | ], 18] 26 | -------------------------------------------------------------------------------- /__tests__/resources/ast-4.html: -------------------------------------------------------------------------------- 1 | :TEMPLATE 2 | {.even?}node is even{.end} 3 | {.odd? foo}foo is odd{.end} 4 | bar{.plural? bar}s{.end} 5 | 6 | :JSON 7 | [17, 1, [ 8 | [5, "even?", 0, [ 9 | [0, "node is even"] 10 | ], 3], 11 | [0, "\n"], 12 | [5, "odd?", [["foo"], " "], [ 13 | [0, "foo is odd"] 14 | ], 3], 15 | [0, "\nbar"], 16 | [5, "plural?", [["bar"], " "], [ 17 | [0, "s"] 18 | ], 3] 19 | ], 18] 20 | -------------------------------------------------------------------------------- /__tests__/resources/ast-5.html: -------------------------------------------------------------------------------- 1 | :TEMPLATE 2 | {.var @foo bar|html} 3 | {@foo} 4 | 5 | :JSON 6 | [17, 1, [ 7 | [6, "@foo", [["bar"]], [["html"]]], 8 | [0, "\n"], 9 | [1, [["@foo"]], 0] 10 | ], 18] 11 | -------------------------------------------------------------------------------- /__tests__/resources/ast-6.html: -------------------------------------------------------------------------------- 1 | :TEMPLATE 2 | {.macro person.html} 3 | {name} is {status}. 4 | {.end} 5 | {.section person} 6 | {@|apply person.html} 7 | {.end} 8 | 9 | :JSON 10 | [17,1,[ 11 | 12 | [10, "person.html", [ 13 | [0, "\n "], 14 | [1, [["name"]], 0], 15 | [0, " is " ], 16 | [1, [["status"]], 0], 17 | [0, ".\n"] 18 | ]], 19 | 20 | [0, "\n" ], 21 | 22 | [2, ["person"], [ 23 | [0, "\n "], 24 | [1, [["@"]], [[ "apply", [["person.html"], " "]]]], 25 | [0, "\n"] 26 | ], 3] 27 | 28 | ],18] 29 | -------------------------------------------------------------------------------- /__tests__/resources/ast-7.html: -------------------------------------------------------------------------------- 1 | :TEMPLATE 2 | {.if a && b || c} 3 | {a} 4 | {.or} 5 | {b} or {c} 6 | {.end} 7 | 8 | :JSON 9 | [17,1,[ 10 | [8, [1, 0], [["a"], ["b"], ["c"]], [ 11 | [0, "\n"], 12 | [1, [["a"]], 0], 13 | [ 0, "\n"] 14 | ], [7, 0, 0, [ 15 | [0, "\n"], 16 | [1, [["b"]], 0], 17 | [0, " or "], 18 | [1, [["c"]], 0], 19 | [0, "\n"] 20 | ], 3]] 21 | ],18] 22 | -------------------------------------------------------------------------------- /__tests__/resources/ast-8.html: -------------------------------------------------------------------------------- 1 | :TEMPLATE 2 | {.inject @foo bar} 3 | 4 | :JSON 5 | [17,1,[ 6 | [9, "@foo", "bar", 0] 7 | ],18] 8 | -------------------------------------------------------------------------------- /__tests__/resources/ast-9.html: -------------------------------------------------------------------------------- 1 | :TEMPLATE 2 | begin 3 | {# comment #} 4 | --- 5 | {## 6 | multi-line comment 7 | ##} 8 | end 9 | 10 | :JSON 11 | [17,1,[ 12 | [0, "begin\n"], 13 | [11, " comment #", 0], 14 | [0, "\n---\n"], 15 | [11, "\n multi-line comment\n", 1], 16 | [0, "\nend"] 17 | ],18] 18 | 19 | -------------------------------------------------------------------------------- /__tests__/resources/bindvar-1.html: -------------------------------------------------------------------------------- 1 | :TEMPLATE 2 | {.repeated section managers}{.var @boss name}{.var @boss-idx @index} 3 | {.repeated section employees} 4 | {@boss-idx}.{@index}({@index0}) {name} is managed by {@boss}{.end} 5 | {.alternates with}---{.end} 6 | 7 | :JSON 8 | { 9 | "managers": [ 10 | {"name": "Bill", "employees": [ 11 | {"name": "Peter"}, 12 | {"name": "Michael"} 13 | ]}, 14 | {"name": "Bob", "employees": [ 15 | {"name": "Samir"} 16 | ]} 17 | ] 18 | } 19 | 20 | :OUTPUT 21 | 22 | 1.1(0) Peter is managed by Bill 23 | 1.2(1) Michael is managed by Bill 24 | --- 25 | 26 | 2.1(0) Samir is managed by Bob 27 | -------------------------------------------------------------------------------- /__tests__/resources/bindvar-2.html: -------------------------------------------------------------------------------- 1 | :TEMPLATE 2 | {.var @person person} 3 | {@person.name} is {@person.age} 4 | 5 | :JSON 6 | {"person": {"name": "Larry", "age": 21}} 7 | 8 | :OUTPUT 9 | Larry is 21 10 | -------------------------------------------------------------------------------- /__tests__/resources/ctxvar-1.html: -------------------------------------------------------------------------------- 1 | :TEMPLATE 2 | {.macro mymacro} 3 | dims {dims.width} x {dims.height} and focus at ({pt.x}, {pt.y}) 4 | missing -> {missing.baz} 5 | {.end} 6 | 7 | {.ctx @thing dims=item.image.dimensions pt=focal.point missing=foo.bar} 8 | {@thing|apply mymacro} 9 | 10 | :JSON 11 | { 12 | "item": { 13 | "image": { 14 | "dimensions": { 15 | "width": 800, 16 | "height": 600 17 | } 18 | } 19 | }, 20 | "focal": { 21 | "point": { 22 | "x": 100, 23 | "y": 200 24 | } 25 | } 26 | } 27 | 28 | :OUTPUT 29 | 30 | dims 800 x 600 and focus at (100, 200) 31 | missing -> 32 | -------------------------------------------------------------------------------- /__tests__/resources/eval-10.html: -------------------------------------------------------------------------------- 1 | :TEMPLATE 2 | 3 | # GTE 4 | {.eval 1 >= 0} 5 | {.eval 1 >= 1} 6 | {.eval 1 >= 2} 7 | 8 | :JSON 9 | {} 10 | 11 | :OUTPUT 12 | # GTE 13 | true 14 | true 15 | false 16 | -------------------------------------------------------------------------------- /__tests__/resources/eval-11.html: -------------------------------------------------------------------------------- 1 | :TEMPLATE 2 | 3 | # LNOT 4 | {.eval !true} 5 | {.eval !false} 6 | {.eval !2} 7 | {.eval !!a.b} 8 | {.eval !!!!a.b} 9 | 10 | # AND, OR 11 | {.eval true && true} 12 | {.eval true && false} 13 | {.eval true && (false || true)} 14 | 15 | :JSON 16 | { 17 | "a": { 18 | "b": true 19 | } 20 | } 21 | 22 | :OUTPUT 23 | 24 | # LNOT 25 | false 26 | true 27 | false 28 | true 29 | true 30 | 31 | # AND, OR 32 | true 33 | false 34 | true 35 | -------------------------------------------------------------------------------- /__tests__/resources/eval-12.html: -------------------------------------------------------------------------------- 1 | :TEMPLATE 2 | 3 | # variables, ASN 4 | {.eval @a = 2; @b = 5 * 7.2; @c = @a * @b; @c} 5 | 6 | :JSON 7 | { 8 | "a": { 9 | "b": true 10 | } 11 | } 12 | 13 | :OUTPUT 14 | 15 | # variables, ASN 16 | 72 17 | -------------------------------------------------------------------------------- /__tests__/resources/eval-3.html: -------------------------------------------------------------------------------- 1 | :TEMPLATE 2 | 3 | # mixed types 4 | {.eval 5 + a} 5 | {.eval a + 5} 6 | {.eval true + 2} 7 | 8 | # conversions 9 | {.eval 5 + num(a)} 10 | 11 | :JSON 12 | { 13 | "a": "-6.5" 14 | } 15 | 16 | :OUTPUT 17 | # mixed types 18 | 5-6.5 19 | -6.55 20 | 3 21 | 22 | # conversions 23 | -1.5 24 | -------------------------------------------------------------------------------- /__tests__/resources/eval-5.html: -------------------------------------------------------------------------------- 1 | :TEMPLATE 2 | # EQ 3 | {.eval 1 == 1} 4 | {.eval 1 == 2} 5 | {.eval 1 == NaN} 6 | {.eval NaN == NaN} 7 | {.eval true == 1} 8 | {.eval false == 1} 9 | {.eval "1" == 1} 10 | 11 | # NEQ 12 | {.eval 1 != 1} 13 | {.eval 1 != 2} 14 | {.eval "1" != 1} 15 | 16 | :JSON 17 | {} 18 | 19 | :OUTPUT 20 | 21 | # EQ 22 | true 23 | false 24 | false 25 | false 26 | true 27 | false 28 | true 29 | 30 | # NEQ 31 | false 32 | true 33 | false 34 | -------------------------------------------------------------------------------- /__tests__/resources/eval-6.html: -------------------------------------------------------------------------------- 1 | :TEMPLATE 2 | # SEQ 3 | {.eval 1 === 1} 4 | {.eval 1 === 2} 5 | {.eval 1 === NaN} 6 | {.eval NaN === NaN} 7 | 8 | {.eval true === 1} 9 | {.eval false === 1} 10 | {.eval "1" === 1} 11 | 12 | # SNEQ 13 | {.eval 1 !== 1} 14 | {.eval 1 !== 2} 15 | {.eval "1" !== 1} 16 | 17 | 18 | :JSON 19 | {} 20 | 21 | :OUTPUT 22 | # SEQ 23 | true 24 | false 25 | false 26 | false 27 | 28 | false 29 | false 30 | false 31 | 32 | # SNEQ 33 | false 34 | true 35 | true 36 | -------------------------------------------------------------------------------- /__tests__/resources/eval-7.html: -------------------------------------------------------------------------------- 1 | :TEMPLATE 2 | # LT 3 | {.eval 1 < 2} 4 | {.eval 2 < 2} 5 | {.eval 3 < 2} 6 | 7 | {.eval 0 < "1"} 8 | {.eval 0 < "0x01"} 9 | {.eval 5 < "1"} 10 | {.eval 5 < "0x01"} 11 | 12 | {.eval 0 < true} 13 | {.eval 0 < false} 14 | 15 | {.eval "a" < "b"} 16 | {.eval "a" < "a"} 17 | {.eval "b" < "a"} 18 | 19 | 20 | :JSON 21 | {} 22 | 23 | :OUTPUT 24 | # LT 25 | true 26 | false 27 | false 28 | 29 | true 30 | true 31 | false 32 | false 33 | 34 | true 35 | false 36 | 37 | true 38 | false 39 | false 40 | -------------------------------------------------------------------------------- /__tests__/resources/eval-8.html: -------------------------------------------------------------------------------- 1 | :TEMPLATE 2 | 3 | # LTE 4 | {.eval 1 <= 0} 5 | {.eval 1 <= 1} 6 | {.eval 1 <= 2} 7 | 8 | {.eval 0 <= true} 9 | {.eval 0 <= false} 10 | 11 | {.eval "a" <= "b"} 12 | {.eval "a" <= "a"} 13 | {.eval "b" <= "a"} 14 | 15 | :JSON 16 | {} 17 | 18 | :OUTPUT 19 | 20 | # LTE 21 | false 22 | true 23 | true 24 | 25 | true 26 | true 27 | 28 | true 29 | true 30 | false 31 | -------------------------------------------------------------------------------- /__tests__/resources/eval-9.html: -------------------------------------------------------------------------------- 1 | :TEMPLATE 2 | 3 | # GT 4 | {.eval 1 > 2} 5 | {.eval 2 > 2} 6 | {.eval 3 > 2} 7 | 8 | :JSON 9 | {} 10 | 11 | :OUTPUT 12 | 13 | # GT 14 | false 15 | false 16 | true 17 | -------------------------------------------------------------------------------- /__tests__/resources/include-1.html: -------------------------------------------------------------------------------- 1 | :TEMPLATE 2 | {.macro foo.html} 3 | {.eval @width = 600 ; @height = @width * aspectRatio} 4 | {.end} 5 | {.include foo.html} 6 |
7 | 8 | :JSON 9 | { 10 | "aspectRatio": 0.6 11 | } 12 | 13 | :OUTPUT 14 |
-------------------------------------------------------------------------------- /__tests__/resources/include-2.html: -------------------------------------------------------------------------------- 1 | :TEMPLATE 2 | {.macro first} pre {.eval @foo = 3 ** factor} post {.end} 3 | {.macro second} pre {.eval @bar = 4 << factor} post {.end} 4 | 5 | 1. {.include first} 6 | {@foo} 7 | 8 | 2. {.include second output} 9 | {@bar} 10 | 11 | :JSON 12 | { 13 | "factor": 3 14 | } 15 | 16 | :OUTPUT 17 | 1. 18 | 27 19 | 20 | 2. pre post 21 | 32 22 | -------------------------------------------------------------------------------- /__tests__/resources/inject-1.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | {} 3 | 4 | :PARTIALS 5 | {} 6 | 7 | :INJECT 8 | { 9 | "foo.json": "{\"name\": \"albert\"}", 10 | "bar.json": "{\"value\": 123}", 11 | "quux.json": "3.14159" 12 | } 13 | 14 | :TEMPLATE 15 | {.inject @foo foo.json} 16 | {.inject @bar bar.json} 17 | {.inject @quux quux.json} 18 | {@foo.name}-{@bar.value}-{@quux} 19 | 20 | :OUTPUT 21 | albert-123-3.14159 22 | -------------------------------------------------------------------------------- /__tests__/resources/inject-2.html: -------------------------------------------------------------------------------- 1 | :JSON 2 | {} 3 | 4 | :PARTIALS 5 | { 6 | "partial": "{.inject @foo foo.json}{@foo.name}" 7 | } 8 | 9 | :INJECT 10 | { 11 | "foo.json": "{\"name\": \"albert\"}" 12 | } 13 | 14 | :TEMPLATE 15 | {@|apply partial} 16 | 17 | :OUTPUT 18 | albert 19 | -------------------------------------------------------------------------------- /__tests__/resources/pretty-2.txt: -------------------------------------------------------------------------------- 1 | :TEMPLATE 2 | {a.b.c|capitalize} 3 | 4 | :JSON 5 | [17, 1, [ 6 | [1, [["a", "b", "c"]], [["capitalize"]]] 7 | ], 18] 8 | -------------------------------------------------------------------------------- /__tests__/resources/variables-1.html: -------------------------------------------------------------------------------- 1 | :TEMPLATE 2 | {.var @foo $foo} 3 | {$foo.$bar} 4 | {@foo.$bar} 5 | {@foo.$bar , $foo.$bar} 6 | 7 | :JSON 8 | { 9 | "$foo": { 10 | "$bar": "hello" 11 | } 12 | } 13 | 14 | :OUTPUT 15 | hello 16 | hello 17 | hello 18 | -------------------------------------------------------------------------------- /__tests__/rng.ts: -------------------------------------------------------------------------------- 1 | export const xmur3 = (str: string): (() => number) => { 2 | for (var i = 0, h = 1779033703 ^ str.length; i < str.length; i++) 3 | (h = Math.imul(h ^ str.charCodeAt(i), 3432918353)), (h = (h << 13) | (h >>> 19)); 4 | return () => { 5 | h = Math.imul(h ^ (h >>> 16), 2246822507); 6 | h = Math.imul(h ^ (h >>> 13), 3266489909); 7 | return (h ^= h >>> 16) >>> 0; 8 | }; 9 | }; 10 | -------------------------------------------------------------------------------- /deprecate: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | MESSAGE="Outdated pre-release version" 4 | VERSIONS=$* 5 | 6 | PACKAGES=" 7 | @squarespace/template-engine 8 | " 9 | for version in $VERSIONS ; do 10 | for pkg in $PACKAGES ; do 11 | echo $pkg $version 12 | npm deprecate $pkg@$version "$MESSAGE" 13 | done 14 | done 15 | 16 | 17 | -------------------------------------------------------------------------------- /examples/basic-usage/README.md: -------------------------------------------------------------------------------- 1 | # Example 2 | 3 | ``` 4 | npm install 5 | npm run build 6 | ``` 7 | 8 | Output: 9 | 10 | ``` 11 | [17,1,[[4,["items"],[[1,[["name"]],0],[0,"\n"]],3,[]]],18] 12 | First 13 | Second 14 | Third 15 | ``` 16 | -------------------------------------------------------------------------------- /examples/basic-usage/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example-basic-usage", 3 | "private": true, 4 | "main": "lib/index.js", 5 | "scripts": { 6 | "build": "tsc && node lib/index.js" 7 | }, 8 | "dependencies": { 9 | "@phensley/cldr": "^1.3.3", 10 | "@squarespace/template-engine": "2.8.27" 11 | }, 12 | "devDependencies": { 13 | "ts-node": "^8.3.0", 14 | "typescript": "^3.7.x" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /prerelease: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | REG=$(npm config get registry) 4 | if [[ $REG != *"registry.npmjs.org"* ]] ; then 5 | echo "Please configure the official NPM registry. Found $REG" 6 | exit 1 7 | fi 8 | 9 | yarn clean 10 | yarn build 11 | yarn publish --tag beta 12 | 13 | -------------------------------------------------------------------------------- /release: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | REG=$(npm config get registry) 4 | if [[ $REG != *"registry.npmjs.org"* ]] ; then 5 | echo "Please configure the official NPM registry. Found $REG" 6 | exit 1 7 | fi 8 | 9 | # until 2.0 is released, block normal releases off of master 10 | #BRANCH=$(git rev-parse --abbrev-ref HEAD) 11 | 12 | #if [[ $BRANCH != 1.x ]] ; then 13 | # echo "Release script can only be used on the 1.x branch" 14 | # exit 1 15 | #fi 16 | 17 | yarn clean 18 | yarn build 19 | yarn publish 20 | 21 | echo "run: git push origin main --tags" 22 | 23 | 24 | -------------------------------------------------------------------------------- /scripts/dump-plugins.ts: -------------------------------------------------------------------------------- 1 | import { Formatters, Predicates } from '../src/plugins'; 2 | const names = [Formatters, Predicates] 3 | .reduce((p, c) => p.concat(Object.keys(c)), [] as string[]) 4 | .sort(); 5 | console.log(JSON.stringify(names, undefined, ' ')); 6 | -------------------------------------------------------------------------------- /src/plugins/predicates.i18n.ts: -------------------------------------------------------------------------------- 1 | import { PredicateTable } from '../plugin'; 2 | 3 | // TODO: units-metric? 4 | 5 | export const I18N_PREDICATES: PredicateTable = {}; 6 | -------------------------------------------------------------------------------- /src/plugins/predicates.slide.ts: -------------------------------------------------------------------------------- 1 | import { Context } from '../context'; 2 | import { PredicatePlugin, PredicateTable } from '../plugin'; 3 | import { SliceType } from './enums'; 4 | 5 | // TODO: current-type? should be generalized. 6 | 7 | export class CurrentTypePredicate extends PredicatePlugin { 8 | apply(args: string[], ctx: Context): boolean { 9 | const expected = ctx.node().get('currentType').asNumber() | 0; 10 | const type = SliceType.fromName(args[0]); 11 | return (type && type.code === expected) || false; 12 | } 13 | } 14 | 15 | export const SLIDE_PREDICATES: PredicateTable = { 16 | 'current-type?': new CurrentTypePredicate(), 17 | }; 18 | -------------------------------------------------------------------------------- /src/plugins/templates/audio-player.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | -------------------------------------------------------------------------------- /src/plugins/templates/audio-player.json: -------------------------------------------------------------------------------- 1 | [17, 1, [ 2 | [0, "\n
"] 9 | ], 18] -------------------------------------------------------------------------------- /src/plugins/templates/comment-link.html: -------------------------------------------------------------------------------- 1 | {.if websiteSettings.disqusShortname} 2 | 3 | {.or} 4 | 5 | {.equal? publicCommentCount 0}No{.or}{publicCommentCount}{.end} 6 | Comment{.notEqual? publicCommentCount 1}s{.end} 7 | 8 | {.end} 9 | -------------------------------------------------------------------------------- /src/plugins/templates/comments.html: -------------------------------------------------------------------------------- 1 | {.if websiteSettings.disqusShortname} 2 |
3 | {.or} 4 |
5 | {.end} 6 | -------------------------------------------------------------------------------- /src/plugins/templates/like-button.html: -------------------------------------------------------------------------------- 1 | {.if @ && websiteSettings.simpleLikingEnabled} 2 | 3 | 4 | 5 | 6 | {.end} 7 | -------------------------------------------------------------------------------- /src/plugins/templates/like-button.json: -------------------------------------------------------------------------------- 1 | [17, 1, [ 2 | [8, [1], [["@"], ["websiteSettings", "simpleLikingEnabled"]], [ 3 | [0, "\n \n \n \n \n"] 8 | ], 3] 9 | ], 18] -------------------------------------------------------------------------------- /src/plugins/templates/product-checkout.html: -------------------------------------------------------------------------------- 1 | {@|variants-select}{@|quantity-input}{@|add-to-cart-btn} -------------------------------------------------------------------------------- /src/plugins/templates/product-checkout.json: -------------------------------------------------------------------------------- 1 | [17, 1, [ 2 | [1, [["@"]], [["variants-select"]]], 3 | [1, [["@"]], [["quantity-input"]]], 4 | [1, [["@"]], [["add-to-cart-btn"]]] 5 | ], 18] -------------------------------------------------------------------------------- /src/plugins/templates/product-scarcity.html: -------------------------------------------------------------------------------- 1 | {.repeated section scarcityTemplateViews} 2 |
3 | {scarcityText|message qtyInStock:qtyInStock|htmltag} 4 |
5 | {.end} 6 | -------------------------------------------------------------------------------- /src/plugins/templates/product-scarcity.json: -------------------------------------------------------------------------------- 1 | [17, 1, [ 2 | [4, ["scarcityTemplateViews"], [ 3 | [0, "\n
\n "], 10 | [1, [["scarcityText"]], [["message", [["qtyInStock:qtyInStock"], " "]], ["htmltag"]]], 11 | [0, "\n
\n"] 12 | ], 3, []] 13 | ], 18] -------------------------------------------------------------------------------- /src/plugins/templates/quantity-input.html: -------------------------------------------------------------------------------- 1 | {.var @quantityLabel localizedStrings.productQuantityInputLabel} 2 | {## 3 | We use aria-label for the input below since we didn't want to change the div above and potentially break user sites. 4 | And it was hard to guarantee unique ids for using aria-labelledby 5 | ##} 6 | 7 |
8 |
{.if @quantityLabel}{@quantityLabel}{.or}Quantity{.end}:
9 | 10 |
11 | -------------------------------------------------------------------------------- /src/plugins/templates/summary-form-field-address.html: -------------------------------------------------------------------------------- 1 |
2 |
{values.Line1}
{.if values.Line2} 3 |
{values.Line2}
{.end} 4 |
{values.City}, {values.State} {values.Zip} {values.Country}
5 |
6 | -------------------------------------------------------------------------------- /src/plugins/templates/summary-form-field-address.json: -------------------------------------------------------------------------------- 1 | [17, 1, [ 2 | [0, "
\n
"], 3 | [1, [["values", "Line1"]], 0], 4 | [0, "
"], 5 | [8, [], [["values", "Line2"]], [ 6 | [0, "\n
"], 7 | [1, [["values", "Line2"]], 0], 8 | [0, "
"] 9 | ], 3], 10 | [0, "\n
"], 11 | [1, [["values", "City"]], 0], 12 | [0, ", "], 13 | [1, [["values", "State"]], 0], 14 | [0, " "], 15 | [1, [["values", "Zip"]], 0], 16 | [0, " "], 17 | [1, [["values", "Country"]], 0], 18 | [0, "
\n
"] 19 | ], 18] -------------------------------------------------------------------------------- /src/plugins/templates/summary-form-field-checkbox.html: -------------------------------------------------------------------------------- 1 | {.if values}{.repeated section values}{.greaterThan? @index 1}, {.end}{@}{.end} 2 | {.or}{.if value}{value}{.end}{.end} 3 | -------------------------------------------------------------------------------- /src/plugins/templates/summary-form-field-checkbox.json: -------------------------------------------------------------------------------- 1 | [17, 1, [ 2 | [8, [], [["values"]], [ 3 | [4, ["values"], [ 4 | [5, "greaterThan?", [["@index", "1"], " "], [ 5 | [0, ", "] 6 | ], 3], 7 | [1, [["@"]], 0] 8 | ], 3, []], 9 | [0, "\n"] 10 | ], [7, 0, 0, [ 11 | [8, [], [["value"]], [ 12 | [1, [["value"]], 0] 13 | ], 3] 14 | ], 3]] 15 | ], 18] -------------------------------------------------------------------------------- /src/plugins/templates/summary-form-field-date.html: -------------------------------------------------------------------------------- 1 | {values.Month}/{values.Day}/{values.Year} -------------------------------------------------------------------------------- /src/plugins/templates/summary-form-field-date.json: -------------------------------------------------------------------------------- 1 | [17, 1, [ 2 | [1, [["values", "Month"]], 0], 3 | [0, "/"], 4 | [1, [["values", "Day"]], 0], 5 | [0, "/"], 6 | [1, [["values", "Year"]], 0] 7 | ], 18] -------------------------------------------------------------------------------- /src/plugins/templates/summary-form-field-likert.html: -------------------------------------------------------------------------------- 1 |
{.repeated section @} 2 |
{question}: {answer}
{.end} 3 |
4 | 5 | -------------------------------------------------------------------------------- /src/plugins/templates/summary-form-field-likert.json: -------------------------------------------------------------------------------- 1 | [17, 1, [ 2 | [0, "
"], 3 | [4, ["@"], [ 4 | [0, "\n
"], 5 | [1, [["question"]], 0], 6 | [0, ": "], 7 | [1, [["answer"]], 0], 8 | [0, "
"] 9 | ], 3, []], 10 | [0, "\n
"] 11 | ], 18] -------------------------------------------------------------------------------- /src/plugins/templates/summary-form-field-name.html: -------------------------------------------------------------------------------- 1 | {values.First} {values.Last} 2 | -------------------------------------------------------------------------------- /src/plugins/templates/summary-form-field-name.json: -------------------------------------------------------------------------------- 1 | [17, 1, [ 2 | [1, [["values", "First"]], 0], 3 | [0, " "], 4 | [1, [["values", "Last"]], 0] 5 | ], 18] -------------------------------------------------------------------------------- /src/plugins/templates/summary-form-field-phone.html: -------------------------------------------------------------------------------- 1 | {.if values.Country}+{values.Country} {.end}{values.Areacode}-{values.Prefix}-{values.Line} 2 | -------------------------------------------------------------------------------- /src/plugins/templates/summary-form-field-phone.json: -------------------------------------------------------------------------------- 1 | [17, 1, [ 2 | [8, [], [["values", "Country"]], [ 3 | [0, "+"], 4 | [1, [["values", "Country"]], 0], 5 | [0, " "] 6 | ], 3], 7 | [1, [["values", "Areacode"]], 0], 8 | [0, "-"], 9 | [1, [["values", "Prefix"]], 0], 10 | [0, "-"], 11 | [1, [["values", "Line"]], 0] 12 | ], 18] -------------------------------------------------------------------------------- /src/plugins/templates/summary-form-field-time.html: -------------------------------------------------------------------------------- 1 | {.if values.Hour}{values.Hour}{.or}00{.end}:{.if values.Minute}{values.Minute}{.or}00{.end}:{.if values.Second}{values.Second}{.or}00{.end} {values.Ampm} 2 | -------------------------------------------------------------------------------- /src/plugins/templates/summary-form-field-time.json: -------------------------------------------------------------------------------- 1 | [17, 1, [ 2 | [8, [], [["values", "Hour"]], [ 3 | [1, [["values", "Hour"]], 0] 4 | ], [7, 0, 0, [ 5 | [0, "00"] 6 | ], 3]], 7 | [0, ":"], 8 | [8, [], [["values", "Minute"]], [ 9 | [1, [["values", "Minute"]], 0] 10 | ], [7, 0, 0, [ 11 | [0, "00"] 12 | ], 3]], 13 | [0, ":"], 14 | [8, [], [["values", "Second"]], [ 15 | [1, [["values", "Second"]], 0] 16 | ], [7, 0, 0, [ 17 | [0, "00"] 18 | ], 3]], 19 | [0, " "], 20 | [1, [["values", "Ampm"]], 0] 21 | ], 18] -------------------------------------------------------------------------------- /src/plugins/util.color.ts: -------------------------------------------------------------------------------- 1 | const VALID_COLOR = /^[abcdef0-9]{3,6}$/i; 2 | 3 | export const hexColorToInt = (hex: string): number => { 4 | if (hex[0] === '#') { 5 | hex = hex.slice(1); 6 | } 7 | if (VALID_COLOR.test(hex)) { 8 | if (hex.length === 3) { 9 | return parseInt(hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2], 16); 10 | } 11 | return parseInt(hex, 16); 12 | } 13 | return -1; 14 | }; 15 | -------------------------------------------------------------------------------- /src/plugins/util.i18n.ts: -------------------------------------------------------------------------------- 1 | import { Decimal } from '@phensley/cldr-core'; 2 | import { Context } from '../context'; 3 | import { isTruthy } from '../node'; 4 | 5 | export const parseDecimal = (s: string | number): Decimal | undefined => { 6 | try { 7 | return new Decimal(s); 8 | } catch (e) { 9 | return undefined; 10 | } 11 | }; 12 | 13 | export const useCLDRMode = (ctx: Context) => isTruthy(ctx.resolve(['featureFlags', 'useCLDRMoneyFormat'])); 14 | -------------------------------------------------------------------------------- /src/plugins/util.timezone.ts: -------------------------------------------------------------------------------- 1 | import { Context } from '../context'; 2 | /** 3 | * Retrieves the Website's timeZone from the context, falling 4 | * back to the default NY. 5 | */ 6 | export const getTimeZone = (ctx: Context) => { 7 | const node = ctx.resolve(['website', 'timeZone']); 8 | return node.isMissing() ? 'America/New_York' : node.asString(); 9 | }; 10 | -------------------------------------------------------------------------------- /src/sink.ts: -------------------------------------------------------------------------------- 1 | import { Instruction } from './instructions'; 2 | import { Opcode } from './opcodes'; 3 | import { TemplateError } from './errors'; 4 | 5 | export abstract class Sink { 6 | /** 7 | * Accept an instruction. 8 | */ 9 | abstract accept(inst: Instruction | Opcode): void; 10 | 11 | /** 12 | * Run the completion checks. 13 | */ 14 | abstract complete(): void; 15 | 16 | /** 17 | * Push an error to the sink. 18 | */ 19 | abstract error(err: TemplateError): void; 20 | } 21 | -------------------------------------------------------------------------------- /src/variable.ts: -------------------------------------------------------------------------------- 1 | import { Node } from './node'; 2 | 3 | /** 4 | * Wrapper for passing variables to formatters, simplifying passing 5 | * multiple values through a formatter chain. 6 | */ 7 | export class Variable { 8 | constructor(readonly name: string, public node: Node) { 9 | this.set(node); 10 | } 11 | 12 | set(node: Node | any): void { 13 | this.node = node instanceof Node ? node : new Node(node); 14 | } 15 | 16 | get(): any { 17 | return this.node.value; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tsconfig.lint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": ".scratch", 5 | }, 6 | "include": [ 7 | "src/**/*", 8 | "__tests__/**/*" 9 | ] 10 | } 11 | 12 | --------------------------------------------------------------------------------