Custom tags can have content template and can be nested. This article describes how to implement custom tags that consists of a begin tag, an end tag, and template content between them.
Render Tag Content
We’ll start with a simple tag wrap which wraps its content into a <div class="wrapper"></div> element:
1 | {% wrap %} |
Expected output:
1 | <div class='wrapper'> |
Firstly, [register][register-tags] a tag with name wrap and parse the content into this.tpls. Here in parse(tagToken, remainTokens),
tagTokenis current token `