Git Product home page Git Product logo

Comments (15)

shepherdwind avatar shepherdwind commented on July 2, 2024

刚刚尝试了把你的代码格式化一下,就没有问题了,这个问题基本形式是

$bar.foo()#if(1>0)...#end

正常情况下,#if(1>0)当括号结束的时候,语法应该结束了,不过因为前面有一个$导致,判断错误。修复代码位置

测试用例更新

from velocity.js.

shepherdwind avatar shepherdwind commented on July 2, 2024

这个bug比较隐蔽,发现得非常给力。

from velocity.js.

popomore avatar popomore commented on July 2, 2024

哈,业务的代码千奇百怪,容易发现问题 😄

from velocity.js.

shepherdwind avatar shepherdwind commented on July 2, 2024

这个东东,我自己还没有在实际情况中用过呢,一直是别人给我提各种bug。如果你用来解析vm的话,我这边还提供了Helper,用于解决数据同步,这个正在完善中,马上ok了,最终我的方案是jsonify这个helper,原理是把一个vm编译成一个数据结构化的vm,让后端去解析这个vm,然后前端获取到数据。

from velocity.js.

popomore avatar popomore commented on July 2, 2024

意思是说把 vm 上需要的数据提取出来,然后后端根据这个格式取填充数据,最后返回么?

from velocity.js.

popomore avatar popomore commented on July 2, 2024

补充,小于等于的问题

#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.

popomore avatar popomore commented on July 2, 2024

补充 ,宏的参数

#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.

popomore avatar popomore commented on July 2, 2024

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.

popomore avatar popomore commented on July 2, 2024

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.

shepherdwind avatar shepherdwind commented on July 2, 2024

嗯,让后端把数据打出来,以注释的形式放在html中,我们就可以拿到数据了。

<= >=这两个运算我再加一下,不知道还有没有遗漏的了,比如++, --这样的运算,似乎java支持的所有运算,vm都支持。有些多啊。

foreach那个,是Range Operator,[1..3] => [1, 2, 3],不过没有支持变量,官方文档没说明。

#margin-top: 7px这样的问题,比较麻烦,很多无法预知的情况,现在只能见招拆招了。

from velocity.js.

shepherdwind avatar shepherdwind commented on July 2, 2024

根据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.

popomore avatar popomore commented on July 2, 2024

from velocity.js.

shepherdwind avatar shepherdwind commented on July 2, 2024

上面是那个问题,>= <=支持,#margin-top: 12px语法错误,Range支持变量,已经修复,查看用例

from velocity.js.

shepherdwind avatar shepherdwind commented on July 2, 2024

macro调用支持逗号了,测试

from velocity.js.

popomore avatar popomore commented on July 2, 2024

这个 ok 了

from velocity.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.