An open API service indexing awesome lists of open source software.

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模板转换包

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定义
* 对象定义(支持对象调用)
* 宏定义