https://github.com/jdf2e/jdf-template-transform
velocity->smarty/trimpath模板转换包
https://github.com/jdf2e/jdf-template-transform
Last synced: about 1 year ago
JSON representation
velocity->smarty/trimpath模板转换包
- Host: GitHub
- URL: https://github.com/jdf2e/jdf-template-transform
- Owner: jdf2e
- Created: 2017-12-01T09:39:03.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-12-06T10:22:34.000Z (over 8 years ago)
- Last Synced: 2025-03-21T18:02:08.534Z (about 1 year ago)
- Language: JavaScript
- Homepage: http://jiadi0801.github.io/vmconvert.html
- Size: 46.9 KB
- Stars: 3
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# jdf-template-transform
velocity template transform to smarty or trimpath template
velocity模板 转 smarty模板或者trimpath模板
## 安装
```
npm install jdf-template-transform --save
```
## api
```
const c2tpl = require('jdf-template-transform');
let content = '
$foo'
c2tpl.convert(content); //
{$foo}
c2tpl.convert(content, 'trimpath'); // ${foo}
```
## 转换的特性有:
* 变量:支持纯变量,点连接,方括号连接,变量嵌套
* 赋值:支持数字,字符串,数组,变量、比较表达式等赋值方式
* 运算:+ - * / (),其他暂未实现
* 比较:> < >= <= == == != !,不支持三目运算符
* 判断:与或非
* if/elseif/else
* foreach, 不支持foreachelse
* $velocityCount or $foreach.count
## 不支持特性
* filter
* method调用
* null、undefined定义
* 对象定义(支持对象调用)
* 宏定义