mapres is not tied to a single placeholder style. Instead of hard-codingDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/iFamishedX/mapres/llms.txt
Use this file to discover all available pages before exploring further.
{key} or ${key} into the engine, every DataMap declares its own syntax pattern — a Python regex string with one capture group that tells the resolver how to identify and extract placeholder keys. The syntax class ships four ready-made patterns covering the most common template conventions, and you can supply any custom regex for anything else.
Built-in patterns
Thesyntax class in mapres.datamap defines four class attributes:
| Attribute | Pattern | Matches | Example |
|---|---|---|---|
syntax.braces | r"\{([^{}]+)\}" | {key} | Hello, {name}! |
syntax.dollars | r"\$\{([^{}]+)\}" | ${key} | url = ${base_url}/path |
syntax.angles | r"<([^<>]+)>" | <key> | color = <primary> |
syntax.percents | r"%([^%]+)%" | %key% | title = %app_name% |
[^{}]+) to prevent greedy matching from swallowing adjacent placeholders.
You can import syntax directly from mapres:
Setting syntax on a DataMap
Pass thesyntax parameter to @datamap (or use a shortcut decorator) to declare which placeholder style your map uses:
Custom patterns
Any valid Python regex string containing exactly one capture group works as a syntax pattern. This lets you support proprietary or unusual template formats without any changes to the resolver:Syntax resolution order
When the resolver processes a template string through its layered maps, it collects the__syntax__ value from every DataMap in the stack and builds a de-duplicated list of patterns. Each pattern is applied independently — so a single template string can contain placeholders in multiple styles as long as the maps that own each style are present in the stack:
**ctx kwargs) always uses syntax.braces regardless of which syntax the DataMaps in the stack declare. This is a fixed convention in the resolver’s _apply_ctx() method:
{key} in a template is always eligible for context substitution, even when all your DataMaps use a different pattern.
Quick reference
DataMaps
Learn how
@datamap sets __syntax__ on your dataclass and how as_map() uses it.Resolver
See how
MapResolver collects syntax patterns from the LayerStack and applies them in order.Layers
Understand how multiple DataMaps with different syntax styles coexist in a LayerStack.