govuk_tech_docs 6.6.0.rc.local.tested → 6.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +35 -4
- data/Rakefile +3 -3
- data/govuk_tech_docs.gemspec +82 -24
- data/lib/govuk_tech_docs/version.rb +1 -1
- data/lib/tasks/lint.rake +24 -30
- data/node_modules/.bin/nunjucks-precompile +1 -0
- data/node_modules/.package-lock.json +62 -0
- data/{documentation → node_modules/a-sync-waterfall}/LICENSE +8 -8
- data/node_modules/a-sync-waterfall/README.md +95 -0
- data/node_modules/a-sync-waterfall/index.js +83 -0
- data/node_modules/a-sync-waterfall/package.json +21 -0
- data/node_modules/a-sync-waterfall/test.js +77 -0
- data/node_modules/asap/CHANGES.md +70 -0
- data/node_modules/asap/LICENSE.md +21 -0
- data/node_modules/asap/README.md +237 -0
- data/node_modules/asap/asap.js +65 -0
- data/node_modules/asap/browser-asap.js +66 -0
- data/node_modules/asap/browser-raw.js +223 -0
- data/node_modules/asap/package.json +58 -0
- data/node_modules/asap/raw.js +101 -0
- data/node_modules/commander/CHANGELOG.md +385 -0
- data/node_modules/commander/LICENSE +22 -0
- data/node_modules/commander/Readme.md +737 -0
- data/node_modules/commander/index.js +1756 -0
- data/node_modules/commander/package.json +48 -0
- data/node_modules/commander/typings/index.d.ts +386 -0
- data/node_modules/govuk-frontend/README.md +92 -0
- data/node_modules/govuk-frontend/dist/govuk/all.bundle.js.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/all.bundle.mjs.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/all.mjs.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/common/closest-attribute-value.mjs.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/common/configuration.mjs.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/common/create-element.mjs.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/common/govuk-frontend-version.mjs.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/common/index.mjs.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/component.mjs.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/README.md +15 -0
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.js.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.mjs.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.mjs.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/fixtures.json +377 -0
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/macro-options.json +142 -0
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/macro.njk +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/template-default.html +30 -0
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/template-with-additional-descriptions.html +39 -0
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/template-with-all-sections-already-open.html +30 -0
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/template-with-long-content-and-description.html +36 -0
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/template.njk +67 -0
- data/node_modules/govuk-frontend/dist/govuk/components/back-link/README.md +15 -0
- data/node_modules/govuk-frontend/dist/govuk/components/back-link/fixtures.json +86 -0
- data/node_modules/govuk-frontend/dist/govuk/components/back-link/macro-options.json +32 -0
- data/node_modules/govuk-frontend/dist/govuk/components/back-link/macro.njk +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/back-link/template-default.html +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/back-link/template-inverse.html +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/back-link/template.njk +6 -0
- data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/README.md +15 -0
- data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/fixtures.json +258 -0
- data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/macro-options.json +58 -0
- data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/macro.njk +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-default.html +16 -0
- data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-inverse.html +11 -0
- data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-with-collapse-on-mobile.html +13 -0
- data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-with-last-breadcrumb-as-current-page.html +11 -0
- data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-with-one-level.html +7 -0
- data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-without-the-home-section.html +10 -0
- data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template.njk +30 -0
- data/node_modules/govuk-frontend/dist/govuk/components/button/README.md +15 -0
- data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.js.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.mjs.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/button/button.mjs.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/button/fixtures.json +496 -0
- data/node_modules/govuk-frontend/dist/govuk/components/button/macro-options.json +74 -0
- data/node_modules/govuk-frontend/dist/govuk/components/button/macro.njk +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/button/template-default-active-state.html +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/button/template-default-focus-state.html +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/button/template-default-hover-state.html +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/button/template-default.html +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/button/template-disabled.html +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/button/template-inverse-active-state.html +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/button/template-inverse-disabled.html +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/button/template-inverse-focus-state.html +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/button/template-inverse-hover-state.html +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/button/template-inverse.html +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/button/template-link.html +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/button/template-secondary-active-state.html +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/button/template-secondary-disabled.html +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/button/template-secondary-focus-state.html +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/button/template-secondary-hover-state.html +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/button/template-secondary.html +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/button/template-start.html +6 -0
- data/node_modules/govuk-frontend/dist/govuk/components/button/template-warning-active-state.html +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/button/template-warning-disabled.html +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/button/template-warning-focus-state.html +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/button/template-warning-hover-state.html +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/button/template-warning.html +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/button/template.njk +58 -0
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/README.md +15 -0
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.js.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.mjs.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.mjs.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/fixtures.json +630 -0
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/macro-options.json +206 -0
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/macro.njk +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-default.html +9 -0
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-count-type-characters-and-error-message.html +12 -0
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-count-type-characters-and-threshold.html +9 -0
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-count-type-characters-and-value.html +9 -0
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-count-type-characters.html +9 -0
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-count-type-length.html +9 -0
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-count-type-words-and-error-message.html +12 -0
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-count-type-words-and-threshold.html +9 -0
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-count-type-words-and-value.html +9 -0
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-count-type-words.html +9 -0
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-custom-rows.html +9 -0
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-default-value-exceeding-limit.html +15 -0
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-default-value.html +12 -0
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-hint-and-error.html +15 -0
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-hint.html +12 -0
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-label-as-page-heading.html +11 -0
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-maxwords.html +9 -0
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-threshold.html +9 -0
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/template.njk +128 -0
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/README.md +15 -0
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.js.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.mjs.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.mjs.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/fixtures.json +1344 -0
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/macro-options.json +229 -0
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/macro.njk +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-default.html +27 -0
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-small-with-conditional-reveal.html +25 -0
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-small-with-divider-and-none.html +34 -0
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-small-with-error.html +30 -0
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-small-with-hint.html +30 -0
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-small-with-long-text.html +27 -0
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-small.html +27 -0
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-conditional-items.html +39 -0
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-divider-and-none.html +34 -0
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-divider-none-and-conditional-items.html +44 -0
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-error-message.html +39 -0
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-hint.html +30 -0
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-hints-on-items.html +27 -0
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-legend-as-a-page-heading.html +32 -0
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-optional-form-group-classes-showing-group-error.html +40 -0
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-pre-checked-values.html +39 -0
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-very-long-option-text.html +30 -0
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template.njk +122 -0
- data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/README.md +15 -0
- data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/fixtures.json +543 -0
- data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/macro-options.json +132 -0
- data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/macro.njk +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/template-accepted-confirmation-banner.html +19 -0
- data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/template-default.html +26 -0
- data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/template-rejected-confirmation-banner.html +19 -0
- data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/template-with-html.html +27 -0
- data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/template.njk +57 -0
- data/node_modules/govuk-frontend/dist/govuk/components/date-input/README.md +15 -0
- data/node_modules/govuk-frontend/dist/govuk/components/date-input/fixtures.json +1314 -0
- data/node_modules/govuk-frontend/dist/govuk/components/date-input/macro-options.json +213 -0
- data/node_modules/govuk-frontend/dist/govuk/components/date-input/macro.njk +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/date-input/template-day-and-month-using-items.html +28 -0
- data/node_modules/govuk-frontend/dist/govuk/components/date-input/template-day-and-month.html +28 -0
- data/node_modules/govuk-frontend/dist/govuk/components/date-input/template-default.html +36 -0
- data/node_modules/govuk-frontend/dist/govuk/components/date-input/template-month-and-year-using-items.html +28 -0
- data/node_modules/govuk-frontend/dist/govuk/components/date-input/template-month-and-year.html +28 -0
- data/node_modules/govuk-frontend/dist/govuk/components/date-input/template-with-error-message-and-hint-using-items.html +39 -0
- data/node_modules/govuk-frontend/dist/govuk/components/date-input/template-with-error-message-and-hint.html +39 -0
- data/node_modules/govuk-frontend/dist/govuk/components/date-input/template-with-error-on-day-input-using-items.html +39 -0
- data/node_modules/govuk-frontend/dist/govuk/components/date-input/template-with-error-on-day-input.html +39 -0
- data/node_modules/govuk-frontend/dist/govuk/components/date-input/template-with-error-on-month-input-using-items.html +39 -0
- data/node_modules/govuk-frontend/dist/govuk/components/date-input/template-with-error-on-month-input.html +39 -0
- data/node_modules/govuk-frontend/dist/govuk/components/date-input/template-with-error-on-year-input-using-items.html +39 -0
- data/node_modules/govuk-frontend/dist/govuk/components/date-input/template-with-error-on-year-input.html +39 -0
- data/node_modules/govuk-frontend/dist/govuk/components/date-input/template-with-errors-only-using-classes.html +33 -0
- data/node_modules/govuk-frontend/dist/govuk/components/date-input/template-with-errors-only-using-items-and-classes.html +33 -0
- data/node_modules/govuk-frontend/dist/govuk/components/date-input/template-with-errors-only-using-items.html +33 -0
- data/node_modules/govuk-frontend/dist/govuk/components/date-input/template-with-errors-only.html +33 -0
- data/node_modules/govuk-frontend/dist/govuk/components/date-input/template-with-items.html +36 -0
- data/node_modules/govuk-frontend/dist/govuk/components/date-input/template-with-translations.html +36 -0
- data/node_modules/govuk-frontend/dist/govuk/components/date-input/template-with-values-and-name-prefix.html +36 -0
- data/node_modules/govuk-frontend/dist/govuk/components/date-input/template-with-values-name-prefix-and-custom-names.html +36 -0
- data/node_modules/govuk-frontend/dist/govuk/components/date-input/template-with-values.html +36 -0
- data/node_modules/govuk-frontend/dist/govuk/components/date-input/template.njk +161 -0
- data/node_modules/govuk-frontend/dist/govuk/components/details/README.md +15 -0
- data/node_modules/govuk-frontend/dist/govuk/components/details/fixtures.json +133 -0
- data/node_modules/govuk-frontend/dist/govuk/components/details/implementation.md +87 -0
- data/node_modules/govuk-frontend/dist/govuk/components/details/macro-options.json +56 -0
- data/node_modules/govuk-frontend/dist/govuk/components/details/macro.njk +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/details/template-default.html +10 -0
- data/node_modules/govuk-frontend/dist/govuk/components/details/template-expanded.html +10 -0
- data/node_modules/govuk-frontend/dist/govuk/components/details/template-with-html.html +18 -0
- data/node_modules/govuk-frontend/dist/govuk/components/details/template.njk +14 -0
- data/node_modules/govuk-frontend/dist/govuk/components/error-message/README.md +15 -0
- data/node_modules/govuk-frontend/dist/govuk/components/error-message/fixtures.json +113 -0
- data/node_modules/govuk-frontend/dist/govuk/components/error-message/macro-options.json +38 -0
- data/node_modules/govuk-frontend/dist/govuk/components/error-message/macro.njk +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/error-message/template-default.html +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/error-message/template-translated.html +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/error-message/template.njk +13 -0
- data/node_modules/govuk-frontend/dist/govuk/components/error-summary/README.md +15 -0
- data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.js.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.mjs.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.mjs.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/error-summary/fixtures.json +326 -0
- data/node_modules/govuk-frontend/dist/govuk/components/error-summary/macro-options.json +82 -0
- data/node_modules/govuk-frontend/dist/govuk/components/error-summary/macro.njk +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/error-summary/template-default.html +17 -0
- data/node_modules/govuk-frontend/dist/govuk/components/error-summary/template-mixed-with-and-without-links.html +17 -0
- data/node_modules/govuk-frontend/dist/govuk/components/error-summary/template-with-description-only.html +12 -0
- data/node_modules/govuk-frontend/dist/govuk/components/error-summary/template-with-everything.html +20 -0
- data/node_modules/govuk-frontend/dist/govuk/components/error-summary/template-without-links.html +14 -0
- data/node_modules/govuk-frontend/dist/govuk/components/error-summary/template.njk +37 -0
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/README.md +15 -0
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.js.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.mjs.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/fixtures.json +62 -0
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/macro-options.json +62 -0
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/macro.njk +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/template-default.html +5 -0
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/template.njk +25 -0
- data/node_modules/govuk-frontend/dist/govuk/components/feedback/README.md +15 -0
- data/node_modules/govuk-frontend/dist/govuk/components/feedback/fixtures.json +95 -0
- data/node_modules/govuk-frontend/dist/govuk/components/feedback/macro-options.json +50 -0
- data/node_modules/govuk-frontend/dist/govuk/components/feedback/macro.njk +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/feedback/template-default.html +12 -0
- data/node_modules/govuk-frontend/dist/govuk/components/feedback/template-silly-example.html +19 -0
- data/node_modules/govuk-frontend/dist/govuk/components/feedback/template.njk +24 -0
- data/node_modules/govuk-frontend/dist/govuk/components/fieldset/README.md +15 -0
- data/node_modules/govuk-frontend/dist/govuk/components/fieldset/fixtures.json +260 -0
- data/node_modules/govuk-frontend/dist/govuk/components/fieldset/macro-options.json +70 -0
- data/node_modules/govuk-frontend/dist/govuk/components/fieldset/macro.njk +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/fieldset/template-as-page-heading-l.html +7 -0
- data/node_modules/govuk-frontend/dist/govuk/components/fieldset/template-as-page-heading-m.html +7 -0
- data/node_modules/govuk-frontend/dist/govuk/components/fieldset/template-as-page-heading-s.html +7 -0
- data/node_modules/govuk-frontend/dist/govuk/components/fieldset/template-as-page-heading-without-class.html +7 -0
- data/node_modules/govuk-frontend/dist/govuk/components/fieldset/template-as-page-heading-xl.html +7 -0
- data/node_modules/govuk-frontend/dist/govuk/components/fieldset/template-default.html +5 -0
- data/node_modules/govuk-frontend/dist/govuk/components/fieldset/template-styled-as-large-text.html +5 -0
- data/node_modules/govuk-frontend/dist/govuk/components/fieldset/template-styled-as-medium-text.html +5 -0
- data/node_modules/govuk-frontend/dist/govuk/components/fieldset/template-styled-as-small-text.html +5 -0
- data/node_modules/govuk-frontend/dist/govuk/components/fieldset/template-styled-as-xl-text.html +5 -0
- data/node_modules/govuk-frontend/dist/govuk/components/fieldset/template.njk +24 -0
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/README.md +15 -0
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.js.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.mjs.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.mjs.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/fixtures.json +416 -0
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/macro-options.json +179 -0
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/macro.njk +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-default.html +6 -0
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-enhanced-custom-wrapper-classes-and-attributes.html +11 -0
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-enhanced-multiple-files.html +11 -0
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-enhanced-with-error-message-and-hint.html +17 -0
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-enhanced.html +11 -0
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-translated.html +11 -0
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-with-error-message-and-hint.html +12 -0
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-with-hint-text.html +9 -0
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-with-label-as-page-heading.html +8 -0
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template.njk +90 -0
- data/node_modules/govuk-frontend/dist/govuk/components/footer/README.md +15 -0
- data/node_modules/govuk-frontend/dist/govuk/components/footer/fixtures.json +773 -0
- data/node_modules/govuk-frontend/dist/govuk/components/footer/macro-options.json +164 -0
- data/node_modules/govuk-frontend/dist/govuk/components/footer/macro.njk +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/footer/template-default.html +59 -0
- data/node_modules/govuk-frontend/dist/govuk/components/footer/template-full-gds-example.html +233 -0
- data/node_modules/govuk-frontend/dist/govuk/components/footer/template-three-equal-columns.html +167 -0
- data/node_modules/govuk-frontend/dist/govuk/components/footer/template-with-custom-html-content-licence-and-copyright-notice.html +54 -0
- data/node_modules/govuk-frontend/dist/govuk/components/footer/template-with-custom-meta.html +63 -0
- data/node_modules/govuk-frontend/dist/govuk/components/footer/template-with-custom-text-content-licence-and-copyright-notice.html +54 -0
- data/node_modules/govuk-frontend/dist/govuk/components/footer/template-with-default-width-navigation-one-column.html +97 -0
- data/node_modules/govuk-frontend/dist/govuk/components/footer/template-with-default-width-navigation-two-columns.html +97 -0
- data/node_modules/govuk-frontend/dist/govuk/components/footer/template-with-meta-links-and-meta-content.html +105 -0
- data/node_modules/govuk-frontend/dist/govuk/components/footer/template-with-navigation.html +117 -0
- data/node_modules/govuk-frontend/dist/govuk/components/footer/template-with-no-content-licence.html +37 -0
- data/node_modules/govuk-frontend/dist/govuk/components/footer/template-with-only-custom-meta.html +41 -0
- data/node_modules/govuk-frontend/dist/govuk/components/footer/template-with-only-meta-links.html +80 -0
- data/node_modules/govuk-frontend/dist/govuk/components/footer/template.njk +104 -0
- data/node_modules/govuk-frontend/dist/govuk/components/generic-header/README.md +15 -0
- data/node_modules/govuk-frontend/dist/govuk/components/generic-header/fixtures.json +90 -0
- data/node_modules/govuk-frontend/dist/govuk/components/generic-header/macro-options.json +38 -0
- data/node_modules/govuk-frontend/dist/govuk/components/generic-header/macro.njk +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/generic-header/template-default.html +11 -0
- data/node_modules/govuk-frontend/dist/govuk/components/generic-header/template-full-width.html +20 -0
- data/node_modules/govuk-frontend/dist/govuk/components/generic-header/template-with-image-logo.html +20 -0
- data/node_modules/govuk-frontend/dist/govuk/components/generic-header/template-with-text-and-image-logo.html +20 -0
- data/node_modules/govuk-frontend/dist/govuk/components/generic-header/template.njk +14 -0
- data/node_modules/govuk-frontend/dist/govuk/components/header/README.md +15 -0
- data/node_modules/govuk-frontend/dist/govuk/components/header/fixtures.json +73 -0
- data/node_modules/govuk-frontend/dist/govuk/components/header/macro-options.json +32 -0
- data/node_modules/govuk-frontend/dist/govuk/components/header/macro.njk +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/header/template-default.html +34 -0
- data/node_modules/govuk-frontend/dist/govuk/components/header/template-full-width.html +34 -0
- data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-product-name.html +34 -0
- data/node_modules/govuk-frontend/dist/govuk/components/header/template.njk +23 -0
- data/node_modules/govuk-frontend/dist/govuk/components/hint/README.md +15 -0
- data/node_modules/govuk-frontend/dist/govuk/components/hint/fixtures.json +77 -0
- data/node_modules/govuk-frontend/dist/govuk/components/hint/macro-options.json +32 -0
- data/node_modules/govuk-frontend/dist/govuk/components/hint/macro.njk +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/hint/template-default.html +5 -0
- data/node_modules/govuk-frontend/dist/govuk/components/hint/template-with-html.html +4 -0
- data/node_modules/govuk-frontend/dist/govuk/components/hint/template.njk +6 -0
- data/node_modules/govuk-frontend/dist/govuk/components/input/README.md +15 -0
- data/node_modules/govuk-frontend/dist/govuk/components/input/fixtures.json +832 -0
- data/node_modules/govuk-frontend/dist/govuk/components/input/macro-options.json +245 -0
- data/node_modules/govuk-frontend/dist/govuk/components/input/macro.njk +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/input/template-default.html +6 -0
- data/node_modules/govuk-frontend/dist/govuk/components/input/template-with-error-and-hint.html +12 -0
- data/node_modules/govuk-frontend/dist/govuk/components/input/template-with-error-message.html +9 -0
- data/node_modules/govuk-frontend/dist/govuk/components/input/template-with-extra-letter-spacing.html +6 -0
- data/node_modules/govuk-frontend/dist/govuk/components/input/template-with-hint-text.html +9 -0
- data/node_modules/govuk-frontend/dist/govuk/components/input/template-with-label-as-page-heading.html +8 -0
- data/node_modules/govuk-frontend/dist/govuk/components/input/template-with-prefix-and-suffix-and-error.html +13 -0
- data/node_modules/govuk-frontend/dist/govuk/components/input/template-with-prefix-and-suffix-and-width-modifier.html +10 -0
- data/node_modules/govuk-frontend/dist/govuk/components/input/template-with-prefix-and-suffix.html +10 -0
- data/node_modules/govuk-frontend/dist/govuk/components/input/template-with-prefix.html +9 -0
- data/node_modules/govuk-frontend/dist/govuk/components/input/template-with-suffix.html +9 -0
- data/node_modules/govuk-frontend/dist/govuk/components/input/template-with-width-10-class.html +9 -0
- data/node_modules/govuk-frontend/dist/govuk/components/input/template-with-width-2-class.html +9 -0
- data/node_modules/govuk-frontend/dist/govuk/components/input/template-with-width-20-class.html +9 -0
- data/node_modules/govuk-frontend/dist/govuk/components/input/template-with-width-3-class.html +9 -0
- data/node_modules/govuk-frontend/dist/govuk/components/input/template-with-width-30-class.html +9 -0
- data/node_modules/govuk-frontend/dist/govuk/components/input/template-with-width-4-class.html +9 -0
- data/node_modules/govuk-frontend/dist/govuk/components/input/template-with-width-5-class.html +9 -0
- data/node_modules/govuk-frontend/dist/govuk/components/input/template.njk +133 -0
- data/node_modules/govuk-frontend/dist/govuk/components/inset-text/README.md +15 -0
- data/node_modules/govuk-frontend/dist/govuk/components/inset-text/fixtures.json +76 -0
- data/node_modules/govuk-frontend/dist/govuk/components/inset-text/macro-options.json +38 -0
- data/node_modules/govuk-frontend/dist/govuk/components/inset-text/macro.njk +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/inset-text/template-default.html +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/inset-text/template-with-html.html +11 -0
- data/node_modules/govuk-frontend/dist/govuk/components/inset-text/template.njk +6 -0
- data/node_modules/govuk-frontend/dist/govuk/components/label/README.md +15 -0
- data/node_modules/govuk-frontend/dist/govuk/components/label/fixtures.json +210 -0
- data/node_modules/govuk-frontend/dist/govuk/components/label/macro-options.json +38 -0
- data/node_modules/govuk-frontend/dist/govuk/components/label/macro.njk +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/label/template-as-page-heading-l.html +5 -0
- data/node_modules/govuk-frontend/dist/govuk/components/label/template-as-page-heading-m.html +5 -0
- data/node_modules/govuk-frontend/dist/govuk/components/label/template-as-page-heading-s.html +5 -0
- data/node_modules/govuk-frontend/dist/govuk/components/label/template-as-page-heading-without-class.html +5 -0
- data/node_modules/govuk-frontend/dist/govuk/components/label/template-as-page-heading-xl.html +5 -0
- data/node_modules/govuk-frontend/dist/govuk/components/label/template-default.html +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/label/template-styled-as-large-text.html +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/label/template-styled-as-medium-text.html +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/label/template-styled-as-small-text.html +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/label/template-styled-as-xl-text.html +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/label/template-with-bold-text.html +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/label/template.njk +19 -0
- data/node_modules/govuk-frontend/dist/govuk/components/language-navigation/README.md +15 -0
- data/node_modules/govuk-frontend/dist/govuk/components/language-navigation/fixtures.json +482 -0
- data/node_modules/govuk-frontend/dist/govuk/components/language-navigation/macro-options.json +88 -0
- data/node_modules/govuk-frontend/dist/govuk/components/language-navigation/macro.njk +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/language-navigation/template-default.html +12 -0
- data/node_modules/govuk-frontend/dist/govuk/components/language-navigation/template-inverse.html +12 -0
- data/node_modules/govuk-frontend/dist/govuk/components/language-navigation/template-with-language-description.html +12 -0
- data/node_modules/govuk-frontend/dist/govuk/components/language-navigation/template-with-large-amount-of-multiple-languages.html +99 -0
- data/node_modules/govuk-frontend/dist/govuk/components/language-navigation/template-with-mixed-text-directions.html +12 -0
- data/node_modules/govuk-frontend/dist/govuk/components/language-navigation/template-with-multiple-languages.html +24 -0
- data/node_modules/govuk-frontend/dist/govuk/components/language-navigation/template-with-translated-navigation-label.html +12 -0
- data/node_modules/govuk-frontend/dist/govuk/components/language-navigation/template.njk +33 -0
- data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/README.md +15 -0
- data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/fixtures.json +260 -0
- data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/macro-options.json +74 -0
- data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/macro.njk +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.js.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.mjs.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.mjs.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/template-default.html +12 -0
- data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/template-with-long-heading.html +12 -0
- data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/template-with-lots-of-content.html +19 -0
- data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/template-with-text-as-html.html +21 -0
- data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/template-with-type-as-success.html +12 -0
- data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/template.njk +49 -0
- data/node_modules/govuk-frontend/dist/govuk/components/pagination/README.md +15 -0
- data/node_modules/govuk-frontend/dist/govuk/components/pagination/fixtures.json +415 -0
- data/node_modules/govuk-frontend/dist/govuk/components/pagination/macro-options.json +140 -0
- data/node_modules/govuk-frontend/dist/govuk/components/pagination/macro.njk +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/pagination/template-default.html +39 -0
- data/node_modules/govuk-frontend/dist/govuk/components/pagination/template-first-page.html +29 -0
- data/node_modules/govuk-frontend/dist/govuk/components/pagination/template-last-page.html +29 -0
- data/node_modules/govuk-frontend/dist/govuk/components/pagination/template-with-custom-link-and-item-text.html +39 -0
- data/node_modules/govuk-frontend/dist/govuk/components/pagination/template-with-many-pages.html +65 -0
- data/node_modules/govuk-frontend/dist/govuk/components/pagination/template-with-next-only.html +12 -0
- data/node_modules/govuk-frontend/dist/govuk/components/pagination/template-with-prev-and-next-only-and-labels.html +26 -0
- data/node_modules/govuk-frontend/dist/govuk/components/pagination/template-with-prev-and-next-only-and-very-long-labels.html +26 -0
- data/node_modules/govuk-frontend/dist/govuk/components/pagination/template-with-prev-and-next-only.html +22 -0
- data/node_modules/govuk-frontend/dist/govuk/components/pagination/template-with-previous-only.html +12 -0
- data/node_modules/govuk-frontend/dist/govuk/components/pagination/template.njk +87 -0
- data/node_modules/govuk-frontend/dist/govuk/components/panel/README.md +15 -0
- data/node_modules/govuk-frontend/dist/govuk/components/panel/fixtures.json +353 -0
- data/node_modules/govuk-frontend/dist/govuk/components/panel/macro-options.json +108 -0
- data/node_modules/govuk-frontend/dist/govuk/components/panel/macro.njk +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/panel/template-default.html +8 -0
- data/node_modules/govuk-frontend/dist/govuk/components/panel/template-interruption-with-content-with-long-line-length.html +17 -0
- data/node_modules/govuk-frontend/dist/govuk/components/panel/template-interruption-with-headings-content-and-lists.html +23 -0
- data/node_modules/govuk-frontend/dist/govuk/components/panel/template-interruption.html +14 -0
- data/node_modules/govuk-frontend/dist/govuk/components/panel/template.njk +56 -0
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/fixtures.json +215 -0
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/macro-options.json +181 -0
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/macro.njk +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.js.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.mjs.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/template-default.html +11 -0
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/template-with-error-message.html +17 -0
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/template-with-hint-text.html +14 -0
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/template-with-input-width-class.html +11 -0
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/template-with-label-as-page-heading.html +13 -0
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/template.njk +93 -0
- data/node_modules/govuk-frontend/dist/govuk/components/phase-banner/README.md +15 -0
- data/node_modules/govuk-frontend/dist/govuk/components/phase-banner/fixtures.json +97 -0
- data/node_modules/govuk-frontend/dist/govuk/components/phase-banner/macro-options.json +33 -0
- data/node_modules/govuk-frontend/dist/govuk/components/phase-banner/macro.njk +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/phase-banner/template-default.html +10 -0
- data/node_modules/govuk-frontend/dist/govuk/components/phase-banner/template.njk +17 -0
- data/node_modules/govuk-frontend/dist/govuk/components/radios/README.md +15 -0
- data/node_modules/govuk-frontend/dist/govuk/components/radios/fixtures.json +1339 -0
- data/node_modules/govuk-frontend/dist/govuk/components/radios/macro-options.json +211 -0
- data/node_modules/govuk-frontend/dist/govuk/components/radios/macro.njk +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.js.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.mjs.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.mjs.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-default.html +21 -0
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-inline.html +24 -0
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-small-inline.html +27 -0
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-small-with-a-divider.html +28 -0
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-small-with-conditional-reveal.html +31 -0
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-small-with-error.html +30 -0
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-small-with-hint.html +30 -0
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-small-with-long-text.html +27 -0
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-small.html +27 -0
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-a-divider.html +28 -0
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-conditional-item-checked.html +39 -0
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-conditional-items-and-pre-checked-value.html +39 -0
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-conditional-items.html +39 -0
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-fieldset-and-error-message.html +24 -0
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-hint.html +24 -0
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-hints-on-items.html +29 -0
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-legend-as-page-heading.html +26 -0
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-optional-form-group-classes-showing-group-error.html +40 -0
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-very-long-option-text.html +33 -0
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-without-fieldset.html +22 -0
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template.njk +115 -0
- data/node_modules/govuk-frontend/dist/govuk/components/select/README.md +15 -0
- data/node_modules/govuk-frontend/dist/govuk/components/select/fixtures.json +550 -0
- data/node_modules/govuk-frontend/dist/govuk/components/select/macro-options.json +163 -0
- data/node_modules/govuk-frontend/dist/govuk/components/select/macro.njk +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/select/template-default.html +10 -0
- data/node_modules/govuk-frontend/dist/govuk/components/select/template-with-full-width-override.html +10 -0
- data/node_modules/govuk-frontend/dist/govuk/components/select/template-with-hint-text-and-error-message.html +16 -0
- data/node_modules/govuk-frontend/dist/govuk/components/select/template-with-label-as-page-heading.html +12 -0
- data/node_modules/govuk-frontend/dist/govuk/components/select/template.njk +68 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/README.md +15 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/fixtures.json +777 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/macro-options.json +164 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/macro.njk +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.js.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.mjs.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.mjs.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-default.html +57 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-inverse-with-language-navigation.html +72 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-inverse.html +63 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-a-single-navigation-item-and-collapsenavigationonmobile-set-to-true.html +38 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-a-single-navigation-item.html +35 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-collapsenavigationonmobile-set-to-false.html +60 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-html-navigation-items.html +49 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-inline-end-slot.html +33 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-language-navigation.html +62 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-large-navigation.html +153 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-long-service-name.html +20 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-navigation-with-a-current-item.html +58 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-non-link-navigation-items.html +49 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-right-aligned-language-navigation.html +62 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-service-link.html +20 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-service-name-and-navigation.html +63 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-service-name.html +18 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template.njk +111 -0
- data/node_modules/govuk-frontend/dist/govuk/components/skip-link/README.md +15 -0
- data/node_modules/govuk-frontend/dist/govuk/components/skip-link/fixtures.json +113 -0
- data/node_modules/govuk-frontend/dist/govuk/components/skip-link/macro-options.json +32 -0
- data/node_modules/govuk-frontend/dist/govuk/components/skip-link/macro.njk +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.js.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.mjs.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.mjs.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/skip-link/template-default.html +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/skip-link/template-with-focus.html +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/skip-link/template.njk +6 -0
- data/node_modules/govuk-frontend/dist/govuk/components/summary-list/README.md +15 -0
- data/node_modules/govuk-frontend/dist/govuk/components/summary-list/fixtures.json +1528 -0
- data/node_modules/govuk-frontend/dist/govuk/components/summary-list/macro-options.json +248 -0
- data/node_modules/govuk-frontend/dist/govuk/components/summary-list/macro.njk +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/summary-list/template-as-a-summary-card-extreme.html +106 -0
- data/node_modules/govuk-frontend/dist/govuk/components/summary-list/template-as-a-summary-card-with-a-html-header.html +28 -0
- data/node_modules/govuk-frontend/dist/govuk/components/summary-list/template-as-a-summary-card-with-a-text-header.html +28 -0
- data/node_modules/govuk-frontend/dist/govuk/components/summary-list/template-as-a-summary-card-with-actions-plus-summary-list-actions.html +49 -0
- data/node_modules/govuk-frontend/dist/govuk/components/summary-list/template-as-a-summary-card-with-actions.html +36 -0
- data/node_modules/govuk-frontend/dist/govuk/components/summary-list/template-default.html +35 -0
- data/node_modules/govuk-frontend/dist/govuk/components/summary-list/template-extreme.html +261 -0
- data/node_modules/govuk-frontend/dist/govuk/components/summary-list/template-no-border-on-last-row.html +35 -0
- data/node_modules/govuk-frontend/dist/govuk/components/summary-list/template-no-border.html +35 -0
- data/node_modules/govuk-frontend/dist/govuk/components/summary-list/template-with-actions.html +58 -0
- data/node_modules/govuk-frontend/dist/govuk/components/summary-list/template.njk +94 -0
- data/node_modules/govuk-frontend/dist/govuk/components/table/README.md +15 -0
- data/node_modules/govuk-frontend/dist/govuk/components/table/fixtures.json +651 -0
- data/node_modules/govuk-frontend/dist/govuk/components/table/macro-options.json +132 -0
- data/node_modules/govuk-frontend/dist/govuk/components/table/macro.njk +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/table/template-default.html +19 -0
- data/node_modules/govuk-frontend/dist/govuk/components/table/template-with-head-and-caption.html +27 -0
- data/node_modules/govuk-frontend/dist/govuk/components/table/template-with-head.html +26 -0
- data/node_modules/govuk-frontend/dist/govuk/components/table/template.njk +57 -0
- data/node_modules/govuk-frontend/dist/govuk/components/tabs/README.md +15 -0
- data/node_modules/govuk-frontend/dist/govuk/components/tabs/fixtures.json +333 -0
- data/node_modules/govuk-frontend/dist/govuk/components/tabs/macro-options.json +84 -0
- data/node_modules/govuk-frontend/dist/govuk/components/tabs/macro.njk +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.js.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.mjs.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.mjs.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/tabs/template-default.html +117 -0
- data/node_modules/govuk-frontend/dist/govuk/components/tabs/template-tabs-with-anchor-in-panel.html +26 -0
- data/node_modules/govuk-frontend/dist/govuk/components/tabs/template.njk +48 -0
- data/node_modules/govuk-frontend/dist/govuk/components/tag/README.md +15 -0
- data/node_modules/govuk-frontend/dist/govuk/components/tag/fixtures.json +149 -0
- data/node_modules/govuk-frontend/dist/govuk/components/tag/macro-options.json +26 -0
- data/node_modules/govuk-frontend/dist/govuk/components/tag/macro.njk +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/tag/template-default.html +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/tag/template-green.html +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/tag/template-grey.html +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/tag/template-orange.html +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/tag/template-pink.html +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/tag/template-purple.html +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/tag/template-red.html +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/tag/template-turquoise.html +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/tag/template-yellow.html +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/tag/template.njk +6 -0
- data/node_modules/govuk-frontend/dist/govuk/components/task-list/README.md +15 -0
- data/node_modules/govuk-frontend/dist/govuk/components/task-list/fixtures.json +563 -0
- data/node_modules/govuk-frontend/dist/govuk/components/task-list/macro-options.json +119 -0
- data/node_modules/govuk-frontend/dist/govuk/components/task-list/macro.njk +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/task-list/template-default.html +37 -0
- data/node_modules/govuk-frontend/dist/govuk/components/task-list/template-forced-hover-state.html +37 -0
- data/node_modules/govuk-frontend/dist/govuk/components/task-list/template-with-all-possible-colours.html +131 -0
- data/node_modules/govuk-frontend/dist/govuk/components/task-list/template-with-empty-values.html +27 -0
- data/node_modules/govuk-frontend/dist/govuk/components/task-list/template-with-hint-text-and-additional-states.html +77 -0
- data/node_modules/govuk-frontend/dist/govuk/components/task-list/template-with-very-long-single-word-tags.html +37 -0
- data/node_modules/govuk-frontend/dist/govuk/components/task-list/template.njk +41 -0
- data/node_modules/govuk-frontend/dist/govuk/components/textarea/README.md +15 -0
- data/node_modules/govuk-frontend/dist/govuk/components/textarea/fixtures.json +316 -0
- data/node_modules/govuk-frontend/dist/govuk/components/textarea/macro-options.json +143 -0
- data/node_modules/govuk-frontend/dist/govuk/components/textarea/macro.njk +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/textarea/template-default.html +6 -0
- data/node_modules/govuk-frontend/dist/govuk/components/textarea/template-with-custom-rows.html +6 -0
- data/node_modules/govuk-frontend/dist/govuk/components/textarea/template-with-default-value.html +9 -0
- data/node_modules/govuk-frontend/dist/govuk/components/textarea/template-with-error-message.html +9 -0
- data/node_modules/govuk-frontend/dist/govuk/components/textarea/template-with-hint.html +9 -0
- data/node_modules/govuk-frontend/dist/govuk/components/textarea/template-with-label-as-page-heading.html +8 -0
- data/node_modules/govuk-frontend/dist/govuk/components/textarea/template.njk +56 -0
- data/node_modules/govuk-frontend/dist/govuk/components/warning-text/README.md +15 -0
- data/node_modules/govuk-frontend/dist/govuk/components/warning-text/fixtures.json +101 -0
- data/node_modules/govuk-frontend/dist/govuk/components/warning-text/macro-options.json +32 -0
- data/node_modules/govuk-frontend/dist/govuk/components/warning-text/macro.njk +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/warning-text/template-default.html +7 -0
- data/node_modules/govuk-frontend/dist/govuk/components/warning-text/template-multiple-lines.html +7 -0
- data/node_modules/govuk-frontend/dist/govuk/components/warning-text/template.njk +10 -0
- data/node_modules/govuk-frontend/dist/govuk/errors/index.mjs.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.css +3 -0
- data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.css.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.js.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/i18n.mjs.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/init.mjs.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/macros/attributes.njk +110 -0
- data/node_modules/govuk-frontend/dist/govuk/macros/i18n.njk +21 -0
- data/node_modules/govuk-frontend/dist/govuk/macros/logo.njk +56 -0
- data/node_modules/govuk-frontend/dist/govuk/template.njk +107 -0
- data/node_modules/govuk-frontend/govuk-prototype-kit.config.json +188 -0
- data/node_modules/govuk-frontend/package.json +99 -0
- data/node_modules/nunjucks/LICENSE +26 -0
- data/node_modules/nunjucks/README.md +58 -0
- data/node_modules/nunjucks/bin/precompile +58 -0
- data/node_modules/nunjucks/bin/precompile.cmd +5 -0
- data/node_modules/nunjucks/browser/nunjucks-slim.js +3709 -0
- data/node_modules/nunjucks/browser/nunjucks-slim.js.map +1 -0
- data/node_modules/nunjucks/browser/nunjucks-slim.min.js +3 -0
- data/node_modules/nunjucks/browser/nunjucks-slim.min.js.map +1 -0
- data/node_modules/nunjucks/browser/nunjucks.js +7021 -0
- data/node_modules/nunjucks/browser/nunjucks.js.map +1 -0
- data/node_modules/nunjucks/browser/nunjucks.min.js +3 -0
- data/node_modules/nunjucks/browser/nunjucks.min.js.map +1 -0
- data/node_modules/nunjucks/index.js +82 -0
- data/node_modules/nunjucks/package.json +112 -0
- data/node_modules/nunjucks/src/compiler.js +1027 -0
- data/node_modules/nunjucks/src/environment.js +548 -0
- data/node_modules/nunjucks/src/express-app.js +23 -0
- data/node_modules/nunjucks/src/filters.js +546 -0
- data/node_modules/nunjucks/src/globals.js +65 -0
- data/node_modules/nunjucks/src/jinja-compat.js +293 -0
- data/node_modules/nunjucks/src/lexer.js +474 -0
- data/node_modules/nunjucks/src/lib.js +325 -0
- data/node_modules/nunjucks/src/loader.js +21 -0
- data/node_modules/nunjucks/src/loaders.js +5 -0
- data/node_modules/nunjucks/src/node-loaders.js +139 -0
- data/node_modules/nunjucks/src/nodes.js +350 -0
- data/node_modules/nunjucks/src/object.js +100 -0
- data/node_modules/nunjucks/src/parser.js +1028 -0
- data/node_modules/nunjucks/src/precompile-global.js +17 -0
- data/node_modules/nunjucks/src/precompile.js +108 -0
- data/node_modules/nunjucks/src/precompiled-loader.js +31 -0
- data/node_modules/nunjucks/src/runtime.js +333 -0
- data/node_modules/nunjucks/src/tests.js +265 -0
- data/node_modules/nunjucks/src/transformer.js +166 -0
- data/node_modules/nunjucks/src/web-loaders.js +94 -0
- metadata +609 -67
- data/.github/ISSUE_TEMPLATE/bug.yaml +0 -69
- data/.github/ISSUE_TEMPLATE/config.yaml +0 -6
- data/.github/ISSUE_TEMPLATE/documentation.yaml +0 -29
- data/.github/ISSUE_TEMPLATE/enhancement.yaml +0 -25
- data/.github/dependabot.yml +0 -67
- data/.github/pull_request_template.md +0 -28
- data/.github/workflows/build-middleman-artifact.yaml +0 -41
- data/.github/workflows/check-documentation-updates.yaml +0 -33
- data/.github/workflows/check-gem-version.yaml +0 -36
- data/.github/workflows/npm-vulnerability-scanner.yaml +0 -55
- data/.github/workflows/pipeline.yaml +0 -58
- data/.github/workflows/publish-gem.yaml +0 -52
- data/.github/workflows/publish-github-pages.yaml +0 -38
- data/.github/workflows/ruby-vulnerability-scanner.yaml +0 -44
- data/.github/workflows/test.yaml +0 -48
- data/documentation/.nvmrc +0 -1
- data/documentation/Gemfile +0 -11
- data/documentation/README.md +0 -30
- data/documentation/Staticfile +0 -4
- data/documentation/config/tech-docs.yml +0 -56
- data/documentation/config.rb +0 -21
- data/documentation/source/accessibility/index.html.md.erb +0 -64
- data/documentation/source/configure_project/frontmatter/index.html.md.erb +0 -206
- data/documentation/source/configure_project/global_configuration/index.html.md.erb +0 -386
- data/documentation/source/configure_project/index.html.md.erb +0 -17
- data/documentation/source/configure_project/page_expiry_and_review/index.html.md.erb +0 -93
- data/documentation/source/configure_project/structure_docs/index.html.md.erb +0 -117
- data/documentation/source/create_project/build/index.html.md.erb +0 -20
- data/documentation/source/create_project/create_new_project/index.html.md.erb +0 -23
- data/documentation/source/create_project/get_started/index.html.md.erb +0 -58
- data/documentation/source/create_project/index.html.md.erb +0 -17
- data/documentation/source/create_project/preview/index.html.md.erb +0 -26
- data/documentation/source/images/Basic multipage.svg +0 -1
- data/documentation/source/images/Basic_multipage.svg +0 -1
- data/documentation/source/images/Nested multipage.svg +0 -1
- data/documentation/source/images/Nested_multipage.svg +0 -1
- data/documentation/source/images/Single_page.svg +0 -1
- data/documentation/source/images/core-layout-without-sidebar.png +0 -0
- data/documentation/source/images/core-layout.png +0 -0
- data/documentation/source/images/daniel-the-manual-spaniel-screenshot.svg +0 -1
- data/documentation/source/images/expired-page.png +0 -0
- data/documentation/source/images/last-reviewed-only.png +0 -0
- data/documentation/source/images/last-reviewed-only.svg +0 -1
- data/documentation/source/images/layout-layout.png +0 -0
- data/documentation/source/images/multipage.svg +0 -3
- data/documentation/source/images/not-expired-page.png +0 -0
- data/documentation/source/index.html.md.erb +0 -19
- data/documentation/source/javascripts/application.js +0 -1
- data/documentation/source/maintain_project/index.html.md.erb +0 -18
- data/documentation/source/maintain_project/redirects/index.html.md.erb +0 -22
- data/documentation/source/maintain_project/review_content/index.html.md.erb +0 -45
- data/documentation/source/maintain_project/use_latest_template/index.html.md.erb +0 -34
- data/documentation/source/partials/_links.erb +0 -81
- data/documentation/source/publish_project/deploy/index.html.md.erb +0 -44
- data/documentation/source/publish_project/index.html.md.erb +0 -15
- data/documentation/source/publish_project/version/index.html.md.erb +0 -12
- data/documentation/source/stylesheets/print.css.scss +0 -3
- data/documentation/source/stylesheets/screen-old-ie.css.scss +0 -4
- data/documentation/source/stylesheets/screen.css.scss +0 -1
- data/documentation/source/support/index.html.md.erb +0 -46
- data/documentation/source/write_docs/add_openapi_spec/index.html.md.erb +0 -48
- data/documentation/source/write_docs/content/index.html.md.erb +0 -144
- data/documentation/source/write_docs/index.html.md.erb +0 -15
|
@@ -0,0 +1,1028 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
|
4
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
5
|
+
var lexer = require('./lexer');
|
|
6
|
+
var nodes = require('./nodes');
|
|
7
|
+
var Obj = require('./object').Obj;
|
|
8
|
+
var lib = require('./lib');
|
|
9
|
+
var Parser = /*#__PURE__*/function (_Obj) {
|
|
10
|
+
_inheritsLoose(Parser, _Obj);
|
|
11
|
+
function Parser() {
|
|
12
|
+
return _Obj.apply(this, arguments) || this;
|
|
13
|
+
}
|
|
14
|
+
var _proto = Parser.prototype;
|
|
15
|
+
_proto.init = function init(tokens) {
|
|
16
|
+
this.tokens = tokens;
|
|
17
|
+
this.peeked = null;
|
|
18
|
+
this.breakOnBlocks = null;
|
|
19
|
+
this.dropLeadingWhitespace = false;
|
|
20
|
+
this.extensions = [];
|
|
21
|
+
};
|
|
22
|
+
_proto.nextToken = function nextToken(withWhitespace) {
|
|
23
|
+
var tok;
|
|
24
|
+
if (this.peeked) {
|
|
25
|
+
if (!withWhitespace && this.peeked.type === lexer.TOKEN_WHITESPACE) {
|
|
26
|
+
this.peeked = null;
|
|
27
|
+
} else {
|
|
28
|
+
tok = this.peeked;
|
|
29
|
+
this.peeked = null;
|
|
30
|
+
return tok;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
tok = this.tokens.nextToken();
|
|
34
|
+
if (!withWhitespace) {
|
|
35
|
+
while (tok && tok.type === lexer.TOKEN_WHITESPACE) {
|
|
36
|
+
tok = this.tokens.nextToken();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return tok;
|
|
40
|
+
};
|
|
41
|
+
_proto.peekToken = function peekToken() {
|
|
42
|
+
this.peeked = this.peeked || this.nextToken();
|
|
43
|
+
return this.peeked;
|
|
44
|
+
};
|
|
45
|
+
_proto.pushToken = function pushToken(tok) {
|
|
46
|
+
if (this.peeked) {
|
|
47
|
+
throw new Error('pushToken: can only push one token on between reads');
|
|
48
|
+
}
|
|
49
|
+
this.peeked = tok;
|
|
50
|
+
};
|
|
51
|
+
_proto.error = function error(msg, lineno, colno) {
|
|
52
|
+
if (lineno === undefined || colno === undefined) {
|
|
53
|
+
var tok = this.peekToken() || {};
|
|
54
|
+
lineno = tok.lineno;
|
|
55
|
+
colno = tok.colno;
|
|
56
|
+
}
|
|
57
|
+
if (lineno !== undefined) {
|
|
58
|
+
lineno += 1;
|
|
59
|
+
}
|
|
60
|
+
if (colno !== undefined) {
|
|
61
|
+
colno += 1;
|
|
62
|
+
}
|
|
63
|
+
return new lib.TemplateError(msg, lineno, colno);
|
|
64
|
+
};
|
|
65
|
+
_proto.fail = function fail(msg, lineno, colno) {
|
|
66
|
+
throw this.error(msg, lineno, colno);
|
|
67
|
+
};
|
|
68
|
+
_proto.skip = function skip(type) {
|
|
69
|
+
var tok = this.nextToken();
|
|
70
|
+
if (!tok || tok.type !== type) {
|
|
71
|
+
this.pushToken(tok);
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
return true;
|
|
75
|
+
};
|
|
76
|
+
_proto.expect = function expect(type) {
|
|
77
|
+
var tok = this.nextToken();
|
|
78
|
+
if (tok.type !== type) {
|
|
79
|
+
this.fail('expected ' + type + ', got ' + tok.type, tok.lineno, tok.colno);
|
|
80
|
+
}
|
|
81
|
+
return tok;
|
|
82
|
+
};
|
|
83
|
+
_proto.skipValue = function skipValue(type, val) {
|
|
84
|
+
var tok = this.nextToken();
|
|
85
|
+
if (!tok || tok.type !== type || tok.value !== val) {
|
|
86
|
+
this.pushToken(tok);
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
return true;
|
|
90
|
+
};
|
|
91
|
+
_proto.skipSymbol = function skipSymbol(val) {
|
|
92
|
+
return this.skipValue(lexer.TOKEN_SYMBOL, val);
|
|
93
|
+
};
|
|
94
|
+
_proto.advanceAfterBlockEnd = function advanceAfterBlockEnd(name) {
|
|
95
|
+
var tok;
|
|
96
|
+
if (!name) {
|
|
97
|
+
tok = this.peekToken();
|
|
98
|
+
if (!tok) {
|
|
99
|
+
this.fail('unexpected end of file');
|
|
100
|
+
}
|
|
101
|
+
if (tok.type !== lexer.TOKEN_SYMBOL) {
|
|
102
|
+
this.fail('advanceAfterBlockEnd: expected symbol token or ' + 'explicit name to be passed');
|
|
103
|
+
}
|
|
104
|
+
name = this.nextToken().value;
|
|
105
|
+
}
|
|
106
|
+
tok = this.nextToken();
|
|
107
|
+
if (tok && tok.type === lexer.TOKEN_BLOCK_END) {
|
|
108
|
+
if (tok.value.charAt(0) === '-') {
|
|
109
|
+
this.dropLeadingWhitespace = true;
|
|
110
|
+
}
|
|
111
|
+
} else {
|
|
112
|
+
this.fail('expected block end in ' + name + ' statement');
|
|
113
|
+
}
|
|
114
|
+
return tok;
|
|
115
|
+
};
|
|
116
|
+
_proto.advanceAfterVariableEnd = function advanceAfterVariableEnd() {
|
|
117
|
+
var tok = this.nextToken();
|
|
118
|
+
if (tok && tok.type === lexer.TOKEN_VARIABLE_END) {
|
|
119
|
+
this.dropLeadingWhitespace = tok.value.charAt(tok.value.length - this.tokens.tags.VARIABLE_END.length - 1) === '-';
|
|
120
|
+
} else {
|
|
121
|
+
this.pushToken(tok);
|
|
122
|
+
this.fail('expected variable end');
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
_proto.parseFor = function parseFor() {
|
|
126
|
+
var forTok = this.peekToken();
|
|
127
|
+
var node;
|
|
128
|
+
var endBlock;
|
|
129
|
+
if (this.skipSymbol('for')) {
|
|
130
|
+
node = new nodes.For(forTok.lineno, forTok.colno);
|
|
131
|
+
endBlock = 'endfor';
|
|
132
|
+
} else if (this.skipSymbol('asyncEach')) {
|
|
133
|
+
node = new nodes.AsyncEach(forTok.lineno, forTok.colno);
|
|
134
|
+
endBlock = 'endeach';
|
|
135
|
+
} else if (this.skipSymbol('asyncAll')) {
|
|
136
|
+
node = new nodes.AsyncAll(forTok.lineno, forTok.colno);
|
|
137
|
+
endBlock = 'endall';
|
|
138
|
+
} else {
|
|
139
|
+
this.fail('parseFor: expected for{Async}', forTok.lineno, forTok.colno);
|
|
140
|
+
}
|
|
141
|
+
node.name = this.parsePrimary();
|
|
142
|
+
if (!(node.name instanceof nodes.Symbol)) {
|
|
143
|
+
this.fail('parseFor: variable name expected for loop');
|
|
144
|
+
}
|
|
145
|
+
var type = this.peekToken().type;
|
|
146
|
+
if (type === lexer.TOKEN_COMMA) {
|
|
147
|
+
// key/value iteration
|
|
148
|
+
var key = node.name;
|
|
149
|
+
node.name = new nodes.Array(key.lineno, key.colno);
|
|
150
|
+
node.name.addChild(key);
|
|
151
|
+
while (this.skip(lexer.TOKEN_COMMA)) {
|
|
152
|
+
var prim = this.parsePrimary();
|
|
153
|
+
node.name.addChild(prim);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
if (!this.skipSymbol('in')) {
|
|
157
|
+
this.fail('parseFor: expected "in" keyword for loop', forTok.lineno, forTok.colno);
|
|
158
|
+
}
|
|
159
|
+
node.arr = this.parseExpression();
|
|
160
|
+
this.advanceAfterBlockEnd(forTok.value);
|
|
161
|
+
node.body = this.parseUntilBlocks(endBlock, 'else');
|
|
162
|
+
if (this.skipSymbol('else')) {
|
|
163
|
+
this.advanceAfterBlockEnd('else');
|
|
164
|
+
node.else_ = this.parseUntilBlocks(endBlock);
|
|
165
|
+
}
|
|
166
|
+
this.advanceAfterBlockEnd();
|
|
167
|
+
return node;
|
|
168
|
+
};
|
|
169
|
+
_proto.parseMacro = function parseMacro() {
|
|
170
|
+
var macroTok = this.peekToken();
|
|
171
|
+
if (!this.skipSymbol('macro')) {
|
|
172
|
+
this.fail('expected macro');
|
|
173
|
+
}
|
|
174
|
+
var name = this.parsePrimary(true);
|
|
175
|
+
var args = this.parseSignature();
|
|
176
|
+
var node = new nodes.Macro(macroTok.lineno, macroTok.colno, name, args);
|
|
177
|
+
this.advanceAfterBlockEnd(macroTok.value);
|
|
178
|
+
node.body = this.parseUntilBlocks('endmacro');
|
|
179
|
+
this.advanceAfterBlockEnd();
|
|
180
|
+
return node;
|
|
181
|
+
};
|
|
182
|
+
_proto.parseCall = function parseCall() {
|
|
183
|
+
// a call block is parsed as a normal FunCall, but with an added
|
|
184
|
+
// 'caller' kwarg which is a Caller node.
|
|
185
|
+
var callTok = this.peekToken();
|
|
186
|
+
if (!this.skipSymbol('call')) {
|
|
187
|
+
this.fail('expected call');
|
|
188
|
+
}
|
|
189
|
+
var callerArgs = this.parseSignature(true) || new nodes.NodeList();
|
|
190
|
+
var macroCall = this.parsePrimary();
|
|
191
|
+
this.advanceAfterBlockEnd(callTok.value);
|
|
192
|
+
var body = this.parseUntilBlocks('endcall');
|
|
193
|
+
this.advanceAfterBlockEnd();
|
|
194
|
+
var callerName = new nodes.Symbol(callTok.lineno, callTok.colno, 'caller');
|
|
195
|
+
var callerNode = new nodes.Caller(callTok.lineno, callTok.colno, callerName, callerArgs, body);
|
|
196
|
+
|
|
197
|
+
// add the additional caller kwarg, adding kwargs if necessary
|
|
198
|
+
var args = macroCall.args.children;
|
|
199
|
+
if (!(args[args.length - 1] instanceof nodes.KeywordArgs)) {
|
|
200
|
+
args.push(new nodes.KeywordArgs());
|
|
201
|
+
}
|
|
202
|
+
var kwargs = args[args.length - 1];
|
|
203
|
+
kwargs.addChild(new nodes.Pair(callTok.lineno, callTok.colno, callerName, callerNode));
|
|
204
|
+
return new nodes.Output(callTok.lineno, callTok.colno, [macroCall]);
|
|
205
|
+
};
|
|
206
|
+
_proto.parseWithContext = function parseWithContext() {
|
|
207
|
+
var tok = this.peekToken();
|
|
208
|
+
var withContext = null;
|
|
209
|
+
if (this.skipSymbol('with')) {
|
|
210
|
+
withContext = true;
|
|
211
|
+
} else if (this.skipSymbol('without')) {
|
|
212
|
+
withContext = false;
|
|
213
|
+
}
|
|
214
|
+
if (withContext !== null) {
|
|
215
|
+
if (!this.skipSymbol('context')) {
|
|
216
|
+
this.fail('parseFrom: expected context after with/without', tok.lineno, tok.colno);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
return withContext;
|
|
220
|
+
};
|
|
221
|
+
_proto.parseImport = function parseImport() {
|
|
222
|
+
var importTok = this.peekToken();
|
|
223
|
+
if (!this.skipSymbol('import')) {
|
|
224
|
+
this.fail('parseImport: expected import', importTok.lineno, importTok.colno);
|
|
225
|
+
}
|
|
226
|
+
var template = this.parseExpression();
|
|
227
|
+
if (!this.skipSymbol('as')) {
|
|
228
|
+
this.fail('parseImport: expected "as" keyword', importTok.lineno, importTok.colno);
|
|
229
|
+
}
|
|
230
|
+
var target = this.parseExpression();
|
|
231
|
+
var withContext = this.parseWithContext();
|
|
232
|
+
var node = new nodes.Import(importTok.lineno, importTok.colno, template, target, withContext);
|
|
233
|
+
this.advanceAfterBlockEnd(importTok.value);
|
|
234
|
+
return node;
|
|
235
|
+
};
|
|
236
|
+
_proto.parseFrom = function parseFrom() {
|
|
237
|
+
var fromTok = this.peekToken();
|
|
238
|
+
if (!this.skipSymbol('from')) {
|
|
239
|
+
this.fail('parseFrom: expected from');
|
|
240
|
+
}
|
|
241
|
+
var template = this.parseExpression();
|
|
242
|
+
if (!this.skipSymbol('import')) {
|
|
243
|
+
this.fail('parseFrom: expected import', fromTok.lineno, fromTok.colno);
|
|
244
|
+
}
|
|
245
|
+
var names = new nodes.NodeList();
|
|
246
|
+
var withContext;
|
|
247
|
+
while (1) {
|
|
248
|
+
// eslint-disable-line no-constant-condition
|
|
249
|
+
var nextTok = this.peekToken();
|
|
250
|
+
if (nextTok.type === lexer.TOKEN_BLOCK_END) {
|
|
251
|
+
if (!names.children.length) {
|
|
252
|
+
this.fail('parseFrom: Expected at least one import name', fromTok.lineno, fromTok.colno);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// Since we are manually advancing past the block end,
|
|
256
|
+
// need to keep track of whitespace control (normally
|
|
257
|
+
// this is done in `advanceAfterBlockEnd`
|
|
258
|
+
if (nextTok.value.charAt(0) === '-') {
|
|
259
|
+
this.dropLeadingWhitespace = true;
|
|
260
|
+
}
|
|
261
|
+
this.nextToken();
|
|
262
|
+
break;
|
|
263
|
+
}
|
|
264
|
+
if (names.children.length > 0 && !this.skip(lexer.TOKEN_COMMA)) {
|
|
265
|
+
this.fail('parseFrom: expected comma', fromTok.lineno, fromTok.colno);
|
|
266
|
+
}
|
|
267
|
+
var name = this.parsePrimary();
|
|
268
|
+
if (name.value.charAt(0) === '_') {
|
|
269
|
+
this.fail('parseFrom: names starting with an underscore cannot be imported', name.lineno, name.colno);
|
|
270
|
+
}
|
|
271
|
+
if (this.skipSymbol('as')) {
|
|
272
|
+
var alias = this.parsePrimary();
|
|
273
|
+
names.addChild(new nodes.Pair(name.lineno, name.colno, name, alias));
|
|
274
|
+
} else {
|
|
275
|
+
names.addChild(name);
|
|
276
|
+
}
|
|
277
|
+
withContext = this.parseWithContext();
|
|
278
|
+
}
|
|
279
|
+
return new nodes.FromImport(fromTok.lineno, fromTok.colno, template, names, withContext);
|
|
280
|
+
};
|
|
281
|
+
_proto.parseBlock = function parseBlock() {
|
|
282
|
+
var tag = this.peekToken();
|
|
283
|
+
if (!this.skipSymbol('block')) {
|
|
284
|
+
this.fail('parseBlock: expected block', tag.lineno, tag.colno);
|
|
285
|
+
}
|
|
286
|
+
var node = new nodes.Block(tag.lineno, tag.colno);
|
|
287
|
+
node.name = this.parsePrimary();
|
|
288
|
+
if (!(node.name instanceof nodes.Symbol)) {
|
|
289
|
+
this.fail('parseBlock: variable name expected', tag.lineno, tag.colno);
|
|
290
|
+
}
|
|
291
|
+
this.advanceAfterBlockEnd(tag.value);
|
|
292
|
+
node.body = this.parseUntilBlocks('endblock');
|
|
293
|
+
this.skipSymbol('endblock');
|
|
294
|
+
this.skipSymbol(node.name.value);
|
|
295
|
+
var tok = this.peekToken();
|
|
296
|
+
if (!tok) {
|
|
297
|
+
this.fail('parseBlock: expected endblock, got end of file');
|
|
298
|
+
}
|
|
299
|
+
this.advanceAfterBlockEnd(tok.value);
|
|
300
|
+
return node;
|
|
301
|
+
};
|
|
302
|
+
_proto.parseExtends = function parseExtends() {
|
|
303
|
+
var tagName = 'extends';
|
|
304
|
+
var tag = this.peekToken();
|
|
305
|
+
if (!this.skipSymbol(tagName)) {
|
|
306
|
+
this.fail('parseTemplateRef: expected ' + tagName);
|
|
307
|
+
}
|
|
308
|
+
var node = new nodes.Extends(tag.lineno, tag.colno);
|
|
309
|
+
node.template = this.parseExpression();
|
|
310
|
+
this.advanceAfterBlockEnd(tag.value);
|
|
311
|
+
return node;
|
|
312
|
+
};
|
|
313
|
+
_proto.parseInclude = function parseInclude() {
|
|
314
|
+
var tagName = 'include';
|
|
315
|
+
var tag = this.peekToken();
|
|
316
|
+
if (!this.skipSymbol(tagName)) {
|
|
317
|
+
this.fail('parseInclude: expected ' + tagName);
|
|
318
|
+
}
|
|
319
|
+
var node = new nodes.Include(tag.lineno, tag.colno);
|
|
320
|
+
node.template = this.parseExpression();
|
|
321
|
+
if (this.skipSymbol('ignore') && this.skipSymbol('missing')) {
|
|
322
|
+
node.ignoreMissing = true;
|
|
323
|
+
}
|
|
324
|
+
this.advanceAfterBlockEnd(tag.value);
|
|
325
|
+
return node;
|
|
326
|
+
};
|
|
327
|
+
_proto.parseIf = function parseIf() {
|
|
328
|
+
var tag = this.peekToken();
|
|
329
|
+
var node;
|
|
330
|
+
if (this.skipSymbol('if') || this.skipSymbol('elif') || this.skipSymbol('elseif')) {
|
|
331
|
+
node = new nodes.If(tag.lineno, tag.colno);
|
|
332
|
+
} else if (this.skipSymbol('ifAsync')) {
|
|
333
|
+
node = new nodes.IfAsync(tag.lineno, tag.colno);
|
|
334
|
+
} else {
|
|
335
|
+
this.fail('parseIf: expected if, elif, or elseif', tag.lineno, tag.colno);
|
|
336
|
+
}
|
|
337
|
+
node.cond = this.parseExpression();
|
|
338
|
+
this.advanceAfterBlockEnd(tag.value);
|
|
339
|
+
node.body = this.parseUntilBlocks('elif', 'elseif', 'else', 'endif');
|
|
340
|
+
var tok = this.peekToken();
|
|
341
|
+
switch (tok && tok.value) {
|
|
342
|
+
case 'elseif':
|
|
343
|
+
case 'elif':
|
|
344
|
+
node.else_ = this.parseIf();
|
|
345
|
+
break;
|
|
346
|
+
case 'else':
|
|
347
|
+
this.advanceAfterBlockEnd();
|
|
348
|
+
node.else_ = this.parseUntilBlocks('endif');
|
|
349
|
+
this.advanceAfterBlockEnd();
|
|
350
|
+
break;
|
|
351
|
+
case 'endif':
|
|
352
|
+
node.else_ = null;
|
|
353
|
+
this.advanceAfterBlockEnd();
|
|
354
|
+
break;
|
|
355
|
+
default:
|
|
356
|
+
this.fail('parseIf: expected elif, else, or endif, got end of file');
|
|
357
|
+
}
|
|
358
|
+
return node;
|
|
359
|
+
};
|
|
360
|
+
_proto.parseSet = function parseSet() {
|
|
361
|
+
var tag = this.peekToken();
|
|
362
|
+
if (!this.skipSymbol('set')) {
|
|
363
|
+
this.fail('parseSet: expected set', tag.lineno, tag.colno);
|
|
364
|
+
}
|
|
365
|
+
var node = new nodes.Set(tag.lineno, tag.colno, []);
|
|
366
|
+
var target;
|
|
367
|
+
while (target = this.parsePrimary()) {
|
|
368
|
+
node.targets.push(target);
|
|
369
|
+
if (!this.skip(lexer.TOKEN_COMMA)) {
|
|
370
|
+
break;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
if (!this.skipValue(lexer.TOKEN_OPERATOR, '=')) {
|
|
374
|
+
if (!this.skip(lexer.TOKEN_BLOCK_END)) {
|
|
375
|
+
this.fail('parseSet: expected = or block end in set tag', tag.lineno, tag.colno);
|
|
376
|
+
} else {
|
|
377
|
+
node.body = new nodes.Capture(tag.lineno, tag.colno, this.parseUntilBlocks('endset'));
|
|
378
|
+
node.value = null;
|
|
379
|
+
this.advanceAfterBlockEnd();
|
|
380
|
+
}
|
|
381
|
+
} else {
|
|
382
|
+
node.value = this.parseExpression();
|
|
383
|
+
this.advanceAfterBlockEnd(tag.value);
|
|
384
|
+
}
|
|
385
|
+
return node;
|
|
386
|
+
};
|
|
387
|
+
_proto.parseSwitch = function parseSwitch() {
|
|
388
|
+
/*
|
|
389
|
+
* Store the tag names in variables in case someone ever wants to
|
|
390
|
+
* customize this.
|
|
391
|
+
*/
|
|
392
|
+
var switchStart = 'switch';
|
|
393
|
+
var switchEnd = 'endswitch';
|
|
394
|
+
var caseStart = 'case';
|
|
395
|
+
var caseDefault = 'default';
|
|
396
|
+
|
|
397
|
+
// Get the switch tag.
|
|
398
|
+
var tag = this.peekToken();
|
|
399
|
+
|
|
400
|
+
// fail early if we get some unexpected tag.
|
|
401
|
+
if (!this.skipSymbol(switchStart) && !this.skipSymbol(caseStart) && !this.skipSymbol(caseDefault)) {
|
|
402
|
+
this.fail('parseSwitch: expected "switch," "case" or "default"', tag.lineno, tag.colno);
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
// parse the switch expression
|
|
406
|
+
var expr = this.parseExpression();
|
|
407
|
+
|
|
408
|
+
// advance until a start of a case, a default case or an endswitch.
|
|
409
|
+
this.advanceAfterBlockEnd(switchStart);
|
|
410
|
+
this.parseUntilBlocks(caseStart, caseDefault, switchEnd);
|
|
411
|
+
|
|
412
|
+
// this is the first case. it could also be an endswitch, we'll check.
|
|
413
|
+
var tok = this.peekToken();
|
|
414
|
+
|
|
415
|
+
// create new variables for our cases and default case.
|
|
416
|
+
var cases = [];
|
|
417
|
+
var defaultCase;
|
|
418
|
+
|
|
419
|
+
// while we're dealing with new cases nodes...
|
|
420
|
+
do {
|
|
421
|
+
// skip the start symbol and get the case expression
|
|
422
|
+
this.skipSymbol(caseStart);
|
|
423
|
+
var cond = this.parseExpression();
|
|
424
|
+
this.advanceAfterBlockEnd(switchStart);
|
|
425
|
+
// get the body of the case node and add it to the array of cases.
|
|
426
|
+
var body = this.parseUntilBlocks(caseStart, caseDefault, switchEnd);
|
|
427
|
+
cases.push(new nodes.Case(tok.line, tok.col, cond, body));
|
|
428
|
+
// get our next case
|
|
429
|
+
tok = this.peekToken();
|
|
430
|
+
} while (tok && tok.value === caseStart);
|
|
431
|
+
|
|
432
|
+
// we either have a default case or a switch end.
|
|
433
|
+
switch (tok.value) {
|
|
434
|
+
case caseDefault:
|
|
435
|
+
this.advanceAfterBlockEnd();
|
|
436
|
+
defaultCase = this.parseUntilBlocks(switchEnd);
|
|
437
|
+
this.advanceAfterBlockEnd();
|
|
438
|
+
break;
|
|
439
|
+
case switchEnd:
|
|
440
|
+
this.advanceAfterBlockEnd();
|
|
441
|
+
break;
|
|
442
|
+
default:
|
|
443
|
+
// otherwise bail because EOF
|
|
444
|
+
this.fail('parseSwitch: expected "case," "default" or "endswitch," got EOF.');
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
// and return the switch node.
|
|
448
|
+
return new nodes.Switch(tag.lineno, tag.colno, expr, cases, defaultCase);
|
|
449
|
+
};
|
|
450
|
+
_proto.parseStatement = function parseStatement() {
|
|
451
|
+
var tok = this.peekToken();
|
|
452
|
+
var node;
|
|
453
|
+
if (tok.type !== lexer.TOKEN_SYMBOL) {
|
|
454
|
+
this.fail('tag name expected', tok.lineno, tok.colno);
|
|
455
|
+
}
|
|
456
|
+
if (this.breakOnBlocks && lib.indexOf(this.breakOnBlocks, tok.value) !== -1) {
|
|
457
|
+
return null;
|
|
458
|
+
}
|
|
459
|
+
switch (tok.value) {
|
|
460
|
+
case 'raw':
|
|
461
|
+
return this.parseRaw();
|
|
462
|
+
case 'verbatim':
|
|
463
|
+
return this.parseRaw('verbatim');
|
|
464
|
+
case 'if':
|
|
465
|
+
case 'ifAsync':
|
|
466
|
+
return this.parseIf();
|
|
467
|
+
case 'for':
|
|
468
|
+
case 'asyncEach':
|
|
469
|
+
case 'asyncAll':
|
|
470
|
+
return this.parseFor();
|
|
471
|
+
case 'block':
|
|
472
|
+
return this.parseBlock();
|
|
473
|
+
case 'extends':
|
|
474
|
+
return this.parseExtends();
|
|
475
|
+
case 'include':
|
|
476
|
+
return this.parseInclude();
|
|
477
|
+
case 'set':
|
|
478
|
+
return this.parseSet();
|
|
479
|
+
case 'macro':
|
|
480
|
+
return this.parseMacro();
|
|
481
|
+
case 'call':
|
|
482
|
+
return this.parseCall();
|
|
483
|
+
case 'import':
|
|
484
|
+
return this.parseImport();
|
|
485
|
+
case 'from':
|
|
486
|
+
return this.parseFrom();
|
|
487
|
+
case 'filter':
|
|
488
|
+
return this.parseFilterStatement();
|
|
489
|
+
case 'switch':
|
|
490
|
+
return this.parseSwitch();
|
|
491
|
+
default:
|
|
492
|
+
if (this.extensions.length) {
|
|
493
|
+
for (var i = 0; i < this.extensions.length; i++) {
|
|
494
|
+
var ext = this.extensions[i];
|
|
495
|
+
if (lib.indexOf(ext.tags || [], tok.value) !== -1) {
|
|
496
|
+
return ext.parse(this, nodes, lexer);
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
this.fail('unknown block tag: ' + tok.value, tok.lineno, tok.colno);
|
|
501
|
+
}
|
|
502
|
+
return node;
|
|
503
|
+
};
|
|
504
|
+
_proto.parseRaw = function parseRaw(tagName) {
|
|
505
|
+
tagName = tagName || 'raw';
|
|
506
|
+
var endTagName = 'end' + tagName;
|
|
507
|
+
// Look for upcoming raw blocks (ignore all other kinds of blocks)
|
|
508
|
+
var rawBlockRegex = new RegExp('([\\s\\S]*?){%\\s*(' + tagName + '|' + endTagName + ')\\s*(?=%})%}');
|
|
509
|
+
var rawLevel = 1;
|
|
510
|
+
var str = '';
|
|
511
|
+
var matches = null;
|
|
512
|
+
|
|
513
|
+
// Skip opening raw token
|
|
514
|
+
// Keep this token to track line and column numbers
|
|
515
|
+
var begun = this.advanceAfterBlockEnd();
|
|
516
|
+
|
|
517
|
+
// Exit when there's nothing to match
|
|
518
|
+
// or when we've found the matching "endraw" block
|
|
519
|
+
while ((matches = this.tokens._extractRegex(rawBlockRegex)) && rawLevel > 0) {
|
|
520
|
+
var all = matches[0];
|
|
521
|
+
var pre = matches[1];
|
|
522
|
+
var blockName = matches[2];
|
|
523
|
+
|
|
524
|
+
// Adjust rawlevel
|
|
525
|
+
if (blockName === tagName) {
|
|
526
|
+
rawLevel += 1;
|
|
527
|
+
} else if (blockName === endTagName) {
|
|
528
|
+
rawLevel -= 1;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
// Add to str
|
|
532
|
+
if (rawLevel === 0) {
|
|
533
|
+
// We want to exclude the last "endraw"
|
|
534
|
+
str += pre;
|
|
535
|
+
// Move tokenizer to beginning of endraw block
|
|
536
|
+
this.tokens.backN(all.length - pre.length);
|
|
537
|
+
} else {
|
|
538
|
+
str += all;
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
return new nodes.Output(begun.lineno, begun.colno, [new nodes.TemplateData(begun.lineno, begun.colno, str)]);
|
|
542
|
+
};
|
|
543
|
+
_proto.parsePostfix = function parsePostfix(node) {
|
|
544
|
+
var lookup;
|
|
545
|
+
var tok = this.peekToken();
|
|
546
|
+
while (tok) {
|
|
547
|
+
if (tok.type === lexer.TOKEN_LEFT_PAREN) {
|
|
548
|
+
// Function call
|
|
549
|
+
node = new nodes.FunCall(tok.lineno, tok.colno, node, this.parseSignature());
|
|
550
|
+
} else if (tok.type === lexer.TOKEN_LEFT_BRACKET) {
|
|
551
|
+
// Reference
|
|
552
|
+
lookup = this.parseAggregate();
|
|
553
|
+
if (lookup.children.length > 1) {
|
|
554
|
+
this.fail('invalid index');
|
|
555
|
+
}
|
|
556
|
+
node = new nodes.LookupVal(tok.lineno, tok.colno, node, lookup.children[0]);
|
|
557
|
+
} else if (tok.type === lexer.TOKEN_OPERATOR && tok.value === '.') {
|
|
558
|
+
// Reference
|
|
559
|
+
this.nextToken();
|
|
560
|
+
var val = this.nextToken();
|
|
561
|
+
if (val.type !== lexer.TOKEN_SYMBOL) {
|
|
562
|
+
this.fail('expected name as lookup value, got ' + val.value, val.lineno, val.colno);
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
// Make a literal string because it's not a variable
|
|
566
|
+
// reference
|
|
567
|
+
lookup = new nodes.Literal(val.lineno, val.colno, val.value);
|
|
568
|
+
node = new nodes.LookupVal(tok.lineno, tok.colno, node, lookup);
|
|
569
|
+
} else {
|
|
570
|
+
break;
|
|
571
|
+
}
|
|
572
|
+
tok = this.peekToken();
|
|
573
|
+
}
|
|
574
|
+
return node;
|
|
575
|
+
};
|
|
576
|
+
_proto.parseExpression = function parseExpression() {
|
|
577
|
+
var node = this.parseInlineIf();
|
|
578
|
+
return node;
|
|
579
|
+
};
|
|
580
|
+
_proto.parseInlineIf = function parseInlineIf() {
|
|
581
|
+
var node = this.parseOr();
|
|
582
|
+
if (this.skipSymbol('if')) {
|
|
583
|
+
var condNode = this.parseOr();
|
|
584
|
+
var bodyNode = node;
|
|
585
|
+
node = new nodes.InlineIf(node.lineno, node.colno);
|
|
586
|
+
node.body = bodyNode;
|
|
587
|
+
node.cond = condNode;
|
|
588
|
+
if (this.skipSymbol('else')) {
|
|
589
|
+
node.else_ = this.parseOr();
|
|
590
|
+
} else {
|
|
591
|
+
node.else_ = null;
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
return node;
|
|
595
|
+
};
|
|
596
|
+
_proto.parseOr = function parseOr() {
|
|
597
|
+
var node = this.parseAnd();
|
|
598
|
+
while (this.skipSymbol('or')) {
|
|
599
|
+
var node2 = this.parseAnd();
|
|
600
|
+
node = new nodes.Or(node.lineno, node.colno, node, node2);
|
|
601
|
+
}
|
|
602
|
+
return node;
|
|
603
|
+
};
|
|
604
|
+
_proto.parseAnd = function parseAnd() {
|
|
605
|
+
var node = this.parseNot();
|
|
606
|
+
while (this.skipSymbol('and')) {
|
|
607
|
+
var node2 = this.parseNot();
|
|
608
|
+
node = new nodes.And(node.lineno, node.colno, node, node2);
|
|
609
|
+
}
|
|
610
|
+
return node;
|
|
611
|
+
};
|
|
612
|
+
_proto.parseNot = function parseNot() {
|
|
613
|
+
var tok = this.peekToken();
|
|
614
|
+
if (this.skipSymbol('not')) {
|
|
615
|
+
return new nodes.Not(tok.lineno, tok.colno, this.parseNot());
|
|
616
|
+
}
|
|
617
|
+
return this.parseIn();
|
|
618
|
+
};
|
|
619
|
+
_proto.parseIn = function parseIn() {
|
|
620
|
+
var node = this.parseIs();
|
|
621
|
+
while (1) {
|
|
622
|
+
// eslint-disable-line no-constant-condition
|
|
623
|
+
// check if the next token is 'not'
|
|
624
|
+
var tok = this.nextToken();
|
|
625
|
+
if (!tok) {
|
|
626
|
+
break;
|
|
627
|
+
}
|
|
628
|
+
var invert = tok.type === lexer.TOKEN_SYMBOL && tok.value === 'not';
|
|
629
|
+
// if it wasn't 'not', put it back
|
|
630
|
+
if (!invert) {
|
|
631
|
+
this.pushToken(tok);
|
|
632
|
+
}
|
|
633
|
+
if (this.skipSymbol('in')) {
|
|
634
|
+
var node2 = this.parseIs();
|
|
635
|
+
node = new nodes.In(node.lineno, node.colno, node, node2);
|
|
636
|
+
if (invert) {
|
|
637
|
+
node = new nodes.Not(node.lineno, node.colno, node);
|
|
638
|
+
}
|
|
639
|
+
} else {
|
|
640
|
+
// if we'd found a 'not' but this wasn't an 'in', put back the 'not'
|
|
641
|
+
if (invert) {
|
|
642
|
+
this.pushToken(tok);
|
|
643
|
+
}
|
|
644
|
+
break;
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
return node;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
// I put this right after "in" in the operator precedence stack. That can
|
|
651
|
+
// obviously be changed to be closer to Jinja.
|
|
652
|
+
;
|
|
653
|
+
_proto.parseIs = function parseIs() {
|
|
654
|
+
var node = this.parseCompare();
|
|
655
|
+
// look for an is
|
|
656
|
+
if (this.skipSymbol('is')) {
|
|
657
|
+
// look for a not
|
|
658
|
+
var not = this.skipSymbol('not');
|
|
659
|
+
// get the next node
|
|
660
|
+
var node2 = this.parseCompare();
|
|
661
|
+
// create an Is node using the next node and the info from our Is node.
|
|
662
|
+
node = new nodes.Is(node.lineno, node.colno, node, node2);
|
|
663
|
+
// if we have a Not, create a Not node from our Is node.
|
|
664
|
+
if (not) {
|
|
665
|
+
node = new nodes.Not(node.lineno, node.colno, node);
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
// return the node.
|
|
669
|
+
return node;
|
|
670
|
+
};
|
|
671
|
+
_proto.parseCompare = function parseCompare() {
|
|
672
|
+
var compareOps = ['==', '===', '!=', '!==', '<', '>', '<=', '>='];
|
|
673
|
+
var expr = this.parseConcat();
|
|
674
|
+
var ops = [];
|
|
675
|
+
while (1) {
|
|
676
|
+
// eslint-disable-line no-constant-condition
|
|
677
|
+
var tok = this.nextToken();
|
|
678
|
+
if (!tok) {
|
|
679
|
+
break;
|
|
680
|
+
} else if (compareOps.indexOf(tok.value) !== -1) {
|
|
681
|
+
ops.push(new nodes.CompareOperand(tok.lineno, tok.colno, this.parseConcat(), tok.value));
|
|
682
|
+
} else {
|
|
683
|
+
this.pushToken(tok);
|
|
684
|
+
break;
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
if (ops.length) {
|
|
688
|
+
return new nodes.Compare(ops[0].lineno, ops[0].colno, expr, ops);
|
|
689
|
+
} else {
|
|
690
|
+
return expr;
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
// finds the '~' for string concatenation
|
|
695
|
+
;
|
|
696
|
+
_proto.parseConcat = function parseConcat() {
|
|
697
|
+
var node = this.parseAdd();
|
|
698
|
+
while (this.skipValue(lexer.TOKEN_TILDE, '~')) {
|
|
699
|
+
var node2 = this.parseAdd();
|
|
700
|
+
node = new nodes.Concat(node.lineno, node.colno, node, node2);
|
|
701
|
+
}
|
|
702
|
+
return node;
|
|
703
|
+
};
|
|
704
|
+
_proto.parseAdd = function parseAdd() {
|
|
705
|
+
var node = this.parseSub();
|
|
706
|
+
while (this.skipValue(lexer.TOKEN_OPERATOR, '+')) {
|
|
707
|
+
var node2 = this.parseSub();
|
|
708
|
+
node = new nodes.Add(node.lineno, node.colno, node, node2);
|
|
709
|
+
}
|
|
710
|
+
return node;
|
|
711
|
+
};
|
|
712
|
+
_proto.parseSub = function parseSub() {
|
|
713
|
+
var node = this.parseMul();
|
|
714
|
+
while (this.skipValue(lexer.TOKEN_OPERATOR, '-')) {
|
|
715
|
+
var node2 = this.parseMul();
|
|
716
|
+
node = new nodes.Sub(node.lineno, node.colno, node, node2);
|
|
717
|
+
}
|
|
718
|
+
return node;
|
|
719
|
+
};
|
|
720
|
+
_proto.parseMul = function parseMul() {
|
|
721
|
+
var node = this.parseDiv();
|
|
722
|
+
while (this.skipValue(lexer.TOKEN_OPERATOR, '*')) {
|
|
723
|
+
var node2 = this.parseDiv();
|
|
724
|
+
node = new nodes.Mul(node.lineno, node.colno, node, node2);
|
|
725
|
+
}
|
|
726
|
+
return node;
|
|
727
|
+
};
|
|
728
|
+
_proto.parseDiv = function parseDiv() {
|
|
729
|
+
var node = this.parseFloorDiv();
|
|
730
|
+
while (this.skipValue(lexer.TOKEN_OPERATOR, '/')) {
|
|
731
|
+
var node2 = this.parseFloorDiv();
|
|
732
|
+
node = new nodes.Div(node.lineno, node.colno, node, node2);
|
|
733
|
+
}
|
|
734
|
+
return node;
|
|
735
|
+
};
|
|
736
|
+
_proto.parseFloorDiv = function parseFloorDiv() {
|
|
737
|
+
var node = this.parseMod();
|
|
738
|
+
while (this.skipValue(lexer.TOKEN_OPERATOR, '//')) {
|
|
739
|
+
var node2 = this.parseMod();
|
|
740
|
+
node = new nodes.FloorDiv(node.lineno, node.colno, node, node2);
|
|
741
|
+
}
|
|
742
|
+
return node;
|
|
743
|
+
};
|
|
744
|
+
_proto.parseMod = function parseMod() {
|
|
745
|
+
var node = this.parsePow();
|
|
746
|
+
while (this.skipValue(lexer.TOKEN_OPERATOR, '%')) {
|
|
747
|
+
var node2 = this.parsePow();
|
|
748
|
+
node = new nodes.Mod(node.lineno, node.colno, node, node2);
|
|
749
|
+
}
|
|
750
|
+
return node;
|
|
751
|
+
};
|
|
752
|
+
_proto.parsePow = function parsePow() {
|
|
753
|
+
var node = this.parseUnary();
|
|
754
|
+
while (this.skipValue(lexer.TOKEN_OPERATOR, '**')) {
|
|
755
|
+
var node2 = this.parseUnary();
|
|
756
|
+
node = new nodes.Pow(node.lineno, node.colno, node, node2);
|
|
757
|
+
}
|
|
758
|
+
return node;
|
|
759
|
+
};
|
|
760
|
+
_proto.parseUnary = function parseUnary(noFilters) {
|
|
761
|
+
var tok = this.peekToken();
|
|
762
|
+
var node;
|
|
763
|
+
if (this.skipValue(lexer.TOKEN_OPERATOR, '-')) {
|
|
764
|
+
node = new nodes.Neg(tok.lineno, tok.colno, this.parseUnary(true));
|
|
765
|
+
} else if (this.skipValue(lexer.TOKEN_OPERATOR, '+')) {
|
|
766
|
+
node = new nodes.Pos(tok.lineno, tok.colno, this.parseUnary(true));
|
|
767
|
+
} else {
|
|
768
|
+
node = this.parsePrimary();
|
|
769
|
+
}
|
|
770
|
+
if (!noFilters) {
|
|
771
|
+
node = this.parseFilter(node);
|
|
772
|
+
}
|
|
773
|
+
return node;
|
|
774
|
+
};
|
|
775
|
+
_proto.parsePrimary = function parsePrimary(noPostfix) {
|
|
776
|
+
var tok = this.nextToken();
|
|
777
|
+
var val;
|
|
778
|
+
var node = null;
|
|
779
|
+
if (!tok) {
|
|
780
|
+
this.fail('expected expression, got end of file');
|
|
781
|
+
} else if (tok.type === lexer.TOKEN_STRING) {
|
|
782
|
+
val = tok.value;
|
|
783
|
+
} else if (tok.type === lexer.TOKEN_INT) {
|
|
784
|
+
val = parseInt(tok.value, 10);
|
|
785
|
+
} else if (tok.type === lexer.TOKEN_FLOAT) {
|
|
786
|
+
val = parseFloat(tok.value);
|
|
787
|
+
} else if (tok.type === lexer.TOKEN_BOOLEAN) {
|
|
788
|
+
if (tok.value === 'true') {
|
|
789
|
+
val = true;
|
|
790
|
+
} else if (tok.value === 'false') {
|
|
791
|
+
val = false;
|
|
792
|
+
} else {
|
|
793
|
+
this.fail('invalid boolean: ' + tok.value, tok.lineno, tok.colno);
|
|
794
|
+
}
|
|
795
|
+
} else if (tok.type === lexer.TOKEN_NONE) {
|
|
796
|
+
val = null;
|
|
797
|
+
} else if (tok.type === lexer.TOKEN_REGEX) {
|
|
798
|
+
val = new RegExp(tok.value.body, tok.value.flags);
|
|
799
|
+
}
|
|
800
|
+
if (val !== undefined) {
|
|
801
|
+
node = new nodes.Literal(tok.lineno, tok.colno, val);
|
|
802
|
+
} else if (tok.type === lexer.TOKEN_SYMBOL) {
|
|
803
|
+
node = new nodes.Symbol(tok.lineno, tok.colno, tok.value);
|
|
804
|
+
} else {
|
|
805
|
+
// See if it's an aggregate type, we need to push the
|
|
806
|
+
// current delimiter token back on
|
|
807
|
+
this.pushToken(tok);
|
|
808
|
+
node = this.parseAggregate();
|
|
809
|
+
}
|
|
810
|
+
if (!noPostfix) {
|
|
811
|
+
node = this.parsePostfix(node);
|
|
812
|
+
}
|
|
813
|
+
if (node) {
|
|
814
|
+
return node;
|
|
815
|
+
} else {
|
|
816
|
+
throw this.error("unexpected token: " + tok.value, tok.lineno, tok.colno);
|
|
817
|
+
}
|
|
818
|
+
};
|
|
819
|
+
_proto.parseFilterName = function parseFilterName() {
|
|
820
|
+
var tok = this.expect(lexer.TOKEN_SYMBOL);
|
|
821
|
+
var name = tok.value;
|
|
822
|
+
while (this.skipValue(lexer.TOKEN_OPERATOR, '.')) {
|
|
823
|
+
name += '.' + this.expect(lexer.TOKEN_SYMBOL).value;
|
|
824
|
+
}
|
|
825
|
+
return new nodes.Symbol(tok.lineno, tok.colno, name);
|
|
826
|
+
};
|
|
827
|
+
_proto.parseFilterArgs = function parseFilterArgs(node) {
|
|
828
|
+
if (this.peekToken().type === lexer.TOKEN_LEFT_PAREN) {
|
|
829
|
+
// Get a FunCall node and add the parameters to the
|
|
830
|
+
// filter
|
|
831
|
+
var call = this.parsePostfix(node);
|
|
832
|
+
return call.args.children;
|
|
833
|
+
}
|
|
834
|
+
return [];
|
|
835
|
+
};
|
|
836
|
+
_proto.parseFilter = function parseFilter(node) {
|
|
837
|
+
while (this.skip(lexer.TOKEN_PIPE)) {
|
|
838
|
+
var name = this.parseFilterName();
|
|
839
|
+
node = new nodes.Filter(name.lineno, name.colno, name, new nodes.NodeList(name.lineno, name.colno, [node].concat(this.parseFilterArgs(node))));
|
|
840
|
+
}
|
|
841
|
+
return node;
|
|
842
|
+
};
|
|
843
|
+
_proto.parseFilterStatement = function parseFilterStatement() {
|
|
844
|
+
var filterTok = this.peekToken();
|
|
845
|
+
if (!this.skipSymbol('filter')) {
|
|
846
|
+
this.fail('parseFilterStatement: expected filter');
|
|
847
|
+
}
|
|
848
|
+
var name = this.parseFilterName();
|
|
849
|
+
var args = this.parseFilterArgs(name);
|
|
850
|
+
this.advanceAfterBlockEnd(filterTok.value);
|
|
851
|
+
var body = new nodes.Capture(name.lineno, name.colno, this.parseUntilBlocks('endfilter'));
|
|
852
|
+
this.advanceAfterBlockEnd();
|
|
853
|
+
var node = new nodes.Filter(name.lineno, name.colno, name, new nodes.NodeList(name.lineno, name.colno, [body].concat(args)));
|
|
854
|
+
return new nodes.Output(name.lineno, name.colno, [node]);
|
|
855
|
+
};
|
|
856
|
+
_proto.parseAggregate = function parseAggregate() {
|
|
857
|
+
var tok = this.nextToken();
|
|
858
|
+
var node;
|
|
859
|
+
switch (tok.type) {
|
|
860
|
+
case lexer.TOKEN_LEFT_PAREN:
|
|
861
|
+
node = new nodes.Group(tok.lineno, tok.colno);
|
|
862
|
+
break;
|
|
863
|
+
case lexer.TOKEN_LEFT_BRACKET:
|
|
864
|
+
node = new nodes.Array(tok.lineno, tok.colno);
|
|
865
|
+
break;
|
|
866
|
+
case lexer.TOKEN_LEFT_CURLY:
|
|
867
|
+
node = new nodes.Dict(tok.lineno, tok.colno);
|
|
868
|
+
break;
|
|
869
|
+
default:
|
|
870
|
+
return null;
|
|
871
|
+
}
|
|
872
|
+
while (1) {
|
|
873
|
+
// eslint-disable-line no-constant-condition
|
|
874
|
+
var type = this.peekToken().type;
|
|
875
|
+
if (type === lexer.TOKEN_RIGHT_PAREN || type === lexer.TOKEN_RIGHT_BRACKET || type === lexer.TOKEN_RIGHT_CURLY) {
|
|
876
|
+
this.nextToken();
|
|
877
|
+
break;
|
|
878
|
+
}
|
|
879
|
+
if (node.children.length > 0) {
|
|
880
|
+
if (!this.skip(lexer.TOKEN_COMMA)) {
|
|
881
|
+
this.fail('parseAggregate: expected comma after expression', tok.lineno, tok.colno);
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
if (node instanceof nodes.Dict) {
|
|
885
|
+
// TODO: check for errors
|
|
886
|
+
var key = this.parsePrimary();
|
|
887
|
+
|
|
888
|
+
// We expect a key/value pair for dicts, separated by a
|
|
889
|
+
// colon
|
|
890
|
+
if (!this.skip(lexer.TOKEN_COLON)) {
|
|
891
|
+
this.fail('parseAggregate: expected colon after dict key', tok.lineno, tok.colno);
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
// TODO: check for errors
|
|
895
|
+
var value = this.parseExpression();
|
|
896
|
+
node.addChild(new nodes.Pair(key.lineno, key.colno, key, value));
|
|
897
|
+
} else {
|
|
898
|
+
// TODO: check for errors
|
|
899
|
+
var expr = this.parseExpression();
|
|
900
|
+
node.addChild(expr);
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
return node;
|
|
904
|
+
};
|
|
905
|
+
_proto.parseSignature = function parseSignature(tolerant, noParens) {
|
|
906
|
+
var tok = this.peekToken();
|
|
907
|
+
if (!noParens && tok.type !== lexer.TOKEN_LEFT_PAREN) {
|
|
908
|
+
if (tolerant) {
|
|
909
|
+
return null;
|
|
910
|
+
} else {
|
|
911
|
+
this.fail('expected arguments', tok.lineno, tok.colno);
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
if (tok.type === lexer.TOKEN_LEFT_PAREN) {
|
|
915
|
+
tok = this.nextToken();
|
|
916
|
+
}
|
|
917
|
+
var args = new nodes.NodeList(tok.lineno, tok.colno);
|
|
918
|
+
var kwargs = new nodes.KeywordArgs(tok.lineno, tok.colno);
|
|
919
|
+
var checkComma = false;
|
|
920
|
+
while (1) {
|
|
921
|
+
// eslint-disable-line no-constant-condition
|
|
922
|
+
tok = this.peekToken();
|
|
923
|
+
if (!noParens && tok.type === lexer.TOKEN_RIGHT_PAREN) {
|
|
924
|
+
this.nextToken();
|
|
925
|
+
break;
|
|
926
|
+
} else if (noParens && tok.type === lexer.TOKEN_BLOCK_END) {
|
|
927
|
+
break;
|
|
928
|
+
}
|
|
929
|
+
if (checkComma && !this.skip(lexer.TOKEN_COMMA)) {
|
|
930
|
+
this.fail('parseSignature: expected comma after expression', tok.lineno, tok.colno);
|
|
931
|
+
} else {
|
|
932
|
+
var arg = this.parseExpression();
|
|
933
|
+
if (this.skipValue(lexer.TOKEN_OPERATOR, '=')) {
|
|
934
|
+
kwargs.addChild(new nodes.Pair(arg.lineno, arg.colno, arg, this.parseExpression()));
|
|
935
|
+
} else {
|
|
936
|
+
args.addChild(arg);
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
checkComma = true;
|
|
940
|
+
}
|
|
941
|
+
if (kwargs.children.length) {
|
|
942
|
+
args.addChild(kwargs);
|
|
943
|
+
}
|
|
944
|
+
return args;
|
|
945
|
+
};
|
|
946
|
+
_proto.parseUntilBlocks = function parseUntilBlocks() {
|
|
947
|
+
var prev = this.breakOnBlocks;
|
|
948
|
+
for (var _len = arguments.length, blockNames = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
949
|
+
blockNames[_key] = arguments[_key];
|
|
950
|
+
}
|
|
951
|
+
this.breakOnBlocks = blockNames;
|
|
952
|
+
var ret = this.parse();
|
|
953
|
+
this.breakOnBlocks = prev;
|
|
954
|
+
return ret;
|
|
955
|
+
};
|
|
956
|
+
_proto.parseNodes = function parseNodes() {
|
|
957
|
+
var tok;
|
|
958
|
+
var buf = [];
|
|
959
|
+
while (tok = this.nextToken()) {
|
|
960
|
+
if (tok.type === lexer.TOKEN_DATA) {
|
|
961
|
+
var data = tok.value;
|
|
962
|
+
var nextToken = this.peekToken();
|
|
963
|
+
var nextVal = nextToken && nextToken.value;
|
|
964
|
+
|
|
965
|
+
// If the last token has "-" we need to trim the
|
|
966
|
+
// leading whitespace of the data. This is marked with
|
|
967
|
+
// the `dropLeadingWhitespace` variable.
|
|
968
|
+
if (this.dropLeadingWhitespace) {
|
|
969
|
+
// TODO: this could be optimized (don't use regex)
|
|
970
|
+
data = data.replace(/^\s*/, '');
|
|
971
|
+
this.dropLeadingWhitespace = false;
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
// Same for the succeeding block start token
|
|
975
|
+
if (nextToken && (nextToken.type === lexer.TOKEN_BLOCK_START && nextVal.charAt(nextVal.length - 1) === '-' || nextToken.type === lexer.TOKEN_VARIABLE_START && nextVal.charAt(this.tokens.tags.VARIABLE_START.length) === '-' || nextToken.type === lexer.TOKEN_COMMENT && nextVal.charAt(this.tokens.tags.COMMENT_START.length) === '-')) {
|
|
976
|
+
// TODO: this could be optimized (don't use regex)
|
|
977
|
+
data = data.replace(/\s*$/, '');
|
|
978
|
+
}
|
|
979
|
+
buf.push(new nodes.Output(tok.lineno, tok.colno, [new nodes.TemplateData(tok.lineno, tok.colno, data)]));
|
|
980
|
+
} else if (tok.type === lexer.TOKEN_BLOCK_START) {
|
|
981
|
+
this.dropLeadingWhitespace = false;
|
|
982
|
+
var n = this.parseStatement();
|
|
983
|
+
if (!n) {
|
|
984
|
+
break;
|
|
985
|
+
}
|
|
986
|
+
buf.push(n);
|
|
987
|
+
} else if (tok.type === lexer.TOKEN_VARIABLE_START) {
|
|
988
|
+
var e = this.parseExpression();
|
|
989
|
+
this.dropLeadingWhitespace = false;
|
|
990
|
+
this.advanceAfterVariableEnd();
|
|
991
|
+
buf.push(new nodes.Output(tok.lineno, tok.colno, [e]));
|
|
992
|
+
} else if (tok.type === lexer.TOKEN_COMMENT) {
|
|
993
|
+
this.dropLeadingWhitespace = tok.value.charAt(tok.value.length - this.tokens.tags.COMMENT_END.length - 1) === '-';
|
|
994
|
+
} else {
|
|
995
|
+
// Ignore comments, otherwise this should be an error
|
|
996
|
+
this.fail('Unexpected token at top-level: ' + tok.type, tok.lineno, tok.colno);
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
return buf;
|
|
1000
|
+
};
|
|
1001
|
+
_proto.parse = function parse() {
|
|
1002
|
+
return new nodes.NodeList(0, 0, this.parseNodes());
|
|
1003
|
+
};
|
|
1004
|
+
_proto.parseAsRoot = function parseAsRoot() {
|
|
1005
|
+
return new nodes.Root(0, 0, this.parseNodes());
|
|
1006
|
+
};
|
|
1007
|
+
return Parser;
|
|
1008
|
+
}(Obj); // var util = require('util');
|
|
1009
|
+
// var l = lexer.lex('{%- if x -%}\n hello {% endif %}');
|
|
1010
|
+
// var t;
|
|
1011
|
+
// while((t = l.nextToken())) {
|
|
1012
|
+
// console.log(util.inspect(t));
|
|
1013
|
+
// }
|
|
1014
|
+
// var p = new Parser(lexer.lex('hello {% filter title %}' +
|
|
1015
|
+
// 'Hello madam how are you' +
|
|
1016
|
+
// '{% endfilter %}'));
|
|
1017
|
+
// var n = p.parseAsRoot();
|
|
1018
|
+
// nodes.printNodes(n);
|
|
1019
|
+
module.exports = {
|
|
1020
|
+
parse: function parse(src, extensions, opts) {
|
|
1021
|
+
var p = new Parser(lexer.lex(src, opts));
|
|
1022
|
+
if (extensions !== undefined) {
|
|
1023
|
+
p.extensions = extensions;
|
|
1024
|
+
}
|
|
1025
|
+
return p.parseAsRoot();
|
|
1026
|
+
},
|
|
1027
|
+
Parser: Parser
|
|
1028
|
+
};
|