That would be changing the Velocity template language. You would need
to check out the source code, alter the parser generating grammar,
re-run the 'ant javacc' target, (perhaps correct a file that javacc
currently forgets on import statement in on my system, at least), and
then build your own Velocity jar ('ant jar').
If you do want to undertake that, then feel free to ask for help if
you get stuck.
2010/1/12 Evgeny Ryabitskiy <[email protected]>:
> Thx... but is not better...
>
> Varian #MY_DIR('gsgffgf') is much closer to #MY_DIR(gsgffgf) then
> setting up one more variable...
>
> Question was if Velocity can be tunned to be able parse
> #MY_DIR(gsgffgf) without any additional spec-symbols like quotes or
> '$'
>
> Evgeny.
>
>
>
> 2010/1/12 bluejoe2008 <[email protected]>:
>> #set($msg='gsgffgf')
>> #MY_DIR($msg)
>>
>> 2010-01-12
>>
>>
>>
>> bluejoe2008
>>
>>
>>
>> 发件人: Evgeny Ryabitskiy
>> 发送时间: 2010-01-12 18:59:40
>> 收件人: user
>> 抄送:
>> 主题: Custom directive parameters without quotes
>>
>> Hello 2 everyone!
>> I have wrote own custom directive for Velocity template engine.
>> And try to put parameters without quotes: like #MY_DIR(gsgffgf) and
>> got an exception, while #MY_DIR( 'gsgffgf' ) works well.
>> Is there any way to handle it? Need same behavior without quotes.
>> Evgeny.
>> Here is exception I got:
>> org.apache.velocity.runtime.directive.MacroParseException: Invalid arg
>> #0 in directive #MY_DIR
>> at org.apache.velocity.runtime.parser.Parser.Directive(Parser.java:802)
>> at org.apache.velocity.runtime.parser.Parser.Statement(Parser.java:373)
>> at org.apache.velocity.runtime.parser.Parser.process(Parser.java:311)
>> at org.apache.velocity.runtime.parser.Parser.parse(Parser.java:105)
>> at
>> org.apache.velocity.runtime.RuntimeInstance.parse(RuntimeInstance.java:1131)
>> at
>> org.apache.velocity.runtime.RuntimeInstance.parse(RuntimeInstance.java:1086)
>> at
>> ru.diasoft.fa.dsutils.macro.MacrosProcessor.processTemplate(MacrosProcessor.java:53)
>> at
>> ru.diasoft.fa.dsutils.macro.MacrosProcessorTest.testNoLockDirective3(MacrosProcessorTest.java:30)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> at java.lang.reflect.Method.invoke(Method.java:597)
>> at junit.framework.TestCase.runTest(TestCase.java:168)
>> at junit.framework.TestCase.runBare(TestCase.java:134)
>> at junit.framework.TestResult$1.protect(TestResult.java:110)
>> at junit.framework.TestResult.runProtected(TestResult.java:128)
>> at junit.framework.TestResult.run(TestResult.java:113)
>> at junit.framework.TestCase.run(TestCase.java:124)
>> at junit.framework.TestSuite.runTest(TestSuite.java:232)
>> at junit.framework.TestSuite.run(TestSuite.java:227)
>> at
>> org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
>> at
>> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
>> at
>> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>> at
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
>> at
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
>> at
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
>> at
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]