88{{ #if condition }}Content{{ elif other }}Content{{ else }}Content{{ /if }}
99```
1010
11- ### ** for / else ** : Looping
11+ ### ** for** : Looping
1212
1313``` jianjia
14- {{ #for item in items }}{{ item }}{{ else }}No data {{ /for }}
14+ {{ #for item in items }}{{= item }}{{ /for }}
1515```
1616
1717### ** assign** : Variable Assignment
4848{{ continue }}
4949```
5050
51- ### ** with** : Contextual Variable Assignment
52-
53- ``` jianjia
54- {{ #with obj }}
55- {{= key }}
56- {{ /with }}
57- ```
58-
5951### ** comment** : Comments
6052
6153``` jianjia
6254{{! This is a comment }}
6355{{ #comment }}Multi-line comment{{ /comment }}
6456```
6557
66- ### ** raw** : Raw Output (No Parsing)
67-
68- ``` jianjia
69- {{ #raw }}{{ #if x }}foo{{ /if }}{{ /raw }}
70- ```
71-
7258### ** expression (=)** : Expression Output
7359
7460``` jianjia
@@ -99,14 +85,15 @@ const myTag = {
9985 parse ({ ast, base }) {
10086 // Parsing logic
10187 ast .start ({ ... base, name: ' my_tag' })
102- ast .end ({ ... base, startIndex : base .endIndex , name: ' end_my_tag' })
88+ ast .end ({ ... base, start : base .end , name: ' end_my_tag' })
10389 },
10490 async compile ({ template, tag, context, out }, compileContent ) {
10591 // Compilation logic
10692 out .pushStr (' Custom tag content' )
107- }
93+ },
10894}
10995const engine = new Engine ()
96+
11097engine .registerTags ([myTag])
11198```
11299
@@ -120,10 +107,11 @@ Usage in template:
120107
121108``` javascript
122109const engine = new Engine ()
110+
123111engine .registerFilters ({
124112 my_filter (value ) {
125113 return ` Custom: ${ value} `
126- }
114+ },
127115})
128116```
129117
0 commit comments