David Bruant 0bbc57afb7
Formatted markers (#5)
* Adding failing test case

* test runs and fails

* passing formatting test

* passing test

* refactoring moving different parts to their own files

* Refactoring - doc in prepareTemplateDOMTree

* Test of 2 formatted markers within same Text node passes

* passing test with {#each ...} and text before partially formatted

* Test with {/each} and text after partially formatted passing

* woops with proper test case

* test with partially formatted variable passes
2025-05-08 17:13:51 +02:00

9 lines
375 B
JavaScript

// the regexps below are shared, so they shoudn't have state (no 'g' flag)
export const variableRegex = /\{([^{#\/]+?)\}/
export const ifStartMarkerRegex = /{#if\s+([^}]+?)\s*}/;
export const elseMarker = '{:else}'
export const closingIfMarker = '{/if}'
export const eachStartMarkerRegex = /{#each\s+([^}]+?)\s+as\s+([^}]+?)\s*}/;
export const eachClosingMarker = '{/each}'