Text Processing
Text Processing Overview
When processing a file, all patterns that match the filename via wildcard are combined and categorized into three main groups: path
, name
, and content
. Mappings defined under the default
property are copied across all of these categories. During the processing phase for any file’s path, filename, or content, the combined mappings are sorted by length and sequentially applied to the text.
This approach ensures that transformations are applied consistently across all aspects of the file structure, leading to predictable and standardized outputs.
Regex Support
Text processing in Sombra Templates also supports RE2 regex pattern matching, enabling advanced group matching and replacements as defined by Go’s regex implementation.
For example, the following YAML snippet shows how regex can be used for content manipulation:
"re:description = .*\n": ""
In this case, the regex pattern matches lines starting with description
and removes them from the generated output.