A bidirectional template engine that supports modifying templates by modifying output directly.
npm install bit2keywords: var, if, endif, elseif, for, in, endfor, separator, front, rear.
```
Fragment := Literal | Directive | Fragment Fragment
Directive := «var Name = Expr» | «Name = Expr» | «Expr»
| «if Expr» Fragment ElseBranch «endif»
| «for Name in Expr ForLitList» Fragment «endfor»
ElseBranch := «elseif Expr» Fragment ElseBranch
| «else» Fragment
ForLit := separator string | front string | rear string
Expr := basic arithmetic, relational, and boolean expressions
| Expr . Name | Value
Name := identifiers
Value := record, list, tuple, string, integer, and boolean values
Literal := any char sequence that does not contain «LiveTUsage
Please install plugin in VSCode, and use it.
1. load LiveT plugin. forward
2. write template in text editor using bit2 syntax.
2. click button to evaluates to text.backward
3. update output text through deletion, insertion, replacement (select text and right click, a popup shows a list of actions).
4. click button to reflect changes back to template
«var no = 0»
Before: «no»
«no = no + 1»
After: «no»
`$3
`
«var age=19»
«var count=1»
«if age>=18»
Wow! An adult! «count»
«else»
Hi! A little boy! «count»
«endif»
«count»
`$3
`
«var lst=[{head:"Modeling", text:"UML"},{head:"Programming", text:"Java"}]»
«for p in lst»
«p.head»
«endfor»
`$3
`
«var paragraphs =[{head:"Hello", text:"Hello!"}, {head:"Farewell", text:"Good Bye!"}] »
«var no = 0»«for p in paragraphs»
«if p.head != ""»«no = no + 1»«no».«p.head»
«endif»
«p.text»
«endfor»
``