Comments (15)
刚刚尝试了把你的代码格式化一下,就没有问题了,这个问题基本形式是
$bar.foo()#if(1>0)...#end
正常情况下,#if(1>0)
当括号结束的时候,语法应该结束了,不过因为前面有一个$
导致,判断错误。修复代码位置。
测试用例更新
from velocity.js.
这个bug比较隐蔽,发现得非常给力。
from velocity.js.
哈,业务的代码千奇百怪,容易发现问题 😄
from velocity.js.
这个东东,我自己还没有在实际情况中用过呢,一直是别人给我提各种bug。如果你用来解析vm的话,我这边还提供了Helper,用于解决数据同步,这个正在完善中,马上ok了,最终我的方案是jsonify
这个helper,原理是把一个vm编译成一个数据结构化的vm,让后端去解析这个vm,然后前端获取到数据。
from velocity.js.
意思是说把 vm 上需要的数据提取出来,然后后端根据这个格式取填充数据,最后返回么?
from velocity.js.
补充,小于等于的问题
#if($!consumeRecordVO.oppositeNickName.length()<=3)
Error: Parse error on line 420:
...teNickName.length()<=3) $
-----------------------^
Expecting 'PARENTHESIS', 'DOLLAR', '-', '!', 'BOOL', 'INTEGER', 'STRING', 'EVAL_STRING', got 'EQUAL'
from velocity.js.
补充 ,宏的参数
#showInOutSymbol($!consumeRecordVO.consumeFundingDirection,$!consumeRecordVO.consumeBizStatus,$!consumeRecordVO.consumeFee)
Error: Parse error on line 492:
...sumeFundingDirection, $!consumeRecordVO.
-----------------------^
Expecting 'CLOSE_PARENTHESIS', 'DOLLAR', '-', 'BOOL', 'INTEGER', 'STRING', 'EVAL_STRING', got 'COMMA'
from velocity.js.
each 为变量
#foreach($termNo in [1..$!consumeRecordVO.maxTerms])
Error: Parse error on line 518:
...each($termNo in [1..$!consumeRecordVO.ma
-----------------------^
Expecting '-', 'INTEGER', got 'DOLLAR'
from velocity.js.
parse 样式报错,没见过 #
开头的,不过最好容错下
margin-top:27px;
#margin-top:2px;
*margin-top:2px;
Error: Parse error on line 88:
...:27px*margin-top:2px;
----------------------^
Expecting 'EOF', 'PARENTHESIS', 'CONTENT', got 'MAP_SPLIT'
from velocity.js.
嗯,让后端把数据打出来,以注释的形式放在html中,我们就可以拿到数据了。
<= >=
这两个运算我再加一下,不知道还有没有遗漏的了,比如++, --
这样的运算,似乎java支持的所有运算,vm都支持。有些多啊。
foreach那个,是Range Operator,[1..3] => [1, 2, 3]
,不过没有支持变量,官方文档没说明。
#margin-top: 7px
这样的问题,比较麻烦,很多无法预知的情况,现在只能见招拆招了。
from velocity.js.
根据velocity官方文档,#macro的参数之间应该是空格分割的吧,http://velocity.apache.org/engine/devel/user-guide.html#Velocimacros 我明天问下,是否你这种写法是vm版本不一致还是其他什么原因。
在 2012-12-20,下午10:56,Haoliang Gao [email protected] 写道:
补充 ,宏的参数
#showInOutSymbol(
$!consumeRecordVO.consumeFundingDirection,$ !consumeRecordVO.consumeBizStatus,$!consumeRecordVO.consumeFee)
Error: Parse error on line 492:
...sumeFundingDirection, $!consumeRecordVO.
-----------------------^
Expecting 'CLOSE_PARENTHESIS', 'DOLLAR', '-', 'BOOL', 'INTEGER', 'STRING', 'EVAL_STRING', got 'COMMA'
—
Reply to this email directly or view it on GitHub.
from velocity.js.
from velocity.js.
上面是那个问题,>= <=
支持,#margin-top: 12px
语法错误,Range支持变量,已经修复,查看用例。
from velocity.js.
macro调用支持逗号了,测试
from velocity.js.
这个 ok 了
from velocity.js.
Related Issues (20)
- Dashes in Identifiers HOT 1
- Support format quiet syntax $!{reference}
- String.replace() is not global HOT 2
- Map.remove() is not implemented HOT 2
- String pipe symbol not implemented HOT 1
- Support the $util.qr directive HOT 1
- IE or older browsers not supported!!! HOT 1
- Bug with #set inside #foreach: setting properties on loop variable from foreach doesn't work HOT 1
- TypeError: Cannot read property 'charCodeAt' of undefined HOT 1
- 如何实现webpack的热更新? HOT 2
- String matches does not work HOT 2
- 变量名称是null时报错 HOT 1
- Bug with rendering #foreach and $util.map.copyAndRemoveAllKeys HOT 13
- How to figure out which references in AST are able to be set in context HOT 2
- Support method with arguments HOT 2
- Parse String to Int HOT 2
- ESM module build? HOT 10
- #set with array fails for unknown reason HOT 1
- 无法解析vue中使用element-ui的$message语法 HOT 1
- Date functions not working HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from velocity.js.