Last 12 weeks · 0 commits
4 of 6 standards met
If a text has placeholders, but also substrings that match the placeholder pattern (e.g. ) but should not be substituted but remain as literals, how do I escape them so that they're not interpreted as placeholders? Is the only way to actually perform substitution with the literal itself, i.e. or is there a way to escape placeholder tokens?
Many templating languages support filtering individual interpolated values: supports transforming all values, but not individual ones. The regex to match items could be modified to: This would match an arbitrary number of filters separated by . (regex101) Filters would just be an object of functions passed to and would be applied in order from left to right. Filters in the template without a match could have the same semantics as a missing value (either get ignored or throw, perhaps with a new ). Related, some further improvements to the regex could be supporting arbitrary whitespace and characters:
Repository: sindresorhus/pupa. Description: Simple micro templating Stars: 372, Forks: 21. Primary language: JavaScript. Languages: JavaScript (97.3%), TypeScript (2.7%). License: MIT. Topics: interpolation, npm-package, placeholder, string, template-, template-engine, template-library, templating. Latest release: v3.3.0 (11mo ago). Open PRs: 0, open issues: 0. Last activity: 11mo ago. Community health: 85%. Top contributors: sindresorhus, apsknight, BendingBender, peteruithoven, Richienb, yuhr.