Tag Syntax
Translations of this material:
- into Russian: Синтаксис тегов. Translated in draft, editing and proof-reading required.
-
Submitted for translation by elastic 13.11.2009
Published 2 years, 4 months ago.
Text
To simplify parsing logic, improve parsing performance and avoid confusion with many new adopters, all tags are now of a single format, differentiated by a token or a set of tokens which appear before a string which identifies the Content Element or Content Tag to be processed; e.g. [[tokenIdentifier]].
Tag Format Changes for Content Elements and Content Tags
Adopting this simplified format allows the new parser to be fully-recursive, following a source-order mechanism that does not depend on regular expressions.
Previously, each tag set was parsed independently in a specific order, one level at a time, with any embedded tags delayed until the next pass. Now tags are parsed as they are encountered regardless of the element types they represent, and embedded tags are parsed before the outer tag to allow much more complex tags to be composed. Combined with the ability to use the previously reserved ? & and = symbols in tag strings (when escaped by the infamous backtick, e.g. ¶m=`?=&is ok now, wow!?&=`), MODx Content Tags offer a powerful new set of capabilities for mashing up your content.
Properties
All tags - no longer just Snippets - now accept properties, as well, that can be used. For example, let's say we had a Chunk named 'Hello' with the content:
Hello [[+name]]!
You'll note the new placeholder syntax. So, we'll definitely want to parse that Chunk's property. In 096, this was required to be done with a Snippet; no longer. You can simply pass a property for the Chunk:
[[$Hello?name=`George`]]
This would output:
Hello George!
The syntax for properties follows the same syntax as 096/Evolution snippet properties.
