You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Params <pa...@gmail.com> on 2011/09/22 23:19:51 UTC
APT: Issue with adding xml code snippets as Verbatim
Hi,
I am using the APT documentation tool to add a page for my project.
I tried to add the following snippet of xml into my .apt source file inside
a 'verbatim' block.
--------------------------------------------------------------------------------------------
<configuration>
<property>
<name>mapred.job.queue.name</name>
<value>${queueName}</value>
</property>
<property>
<name>error.message</name>
<value>Something went wrong:
${wf:errorCode('wordcount')}</value>
</property>
</configuration>
--------------------------------------------------------------------------------------------
On trying to build the maven project for the site documentation,
$ mvn site
I get the following error:
[ERROR] org.apache.velocity.runtime.parser.ParseException: Encountered
":errorCode(\'wordcount\')}</message>\n </kill/>\n <end
name=\'end\'/>\n</workflow-app>\n----------------------------------------------------------------------------------\n\n
<<Notes:>>\n\n <<" at line 134, column 44.
Was expecting one of:
"}" ...
<DOT> ...
Observations:
1) It appears that whenever I use any text of the format:
${wf:errorCode('wordcount')}
APT throws a parse exception (even if its contained in the verbatim block).
2) Other text like ${queueName} seems to work well.
3) I tried escaping the characters - {, $, :, etc.. but it doesnt work
either.
4) I tried using the APT Editor (Eclipse plugin). It does not give any
errors on preview, but publishing the .apt using a 'mvn site' still fails.
Any help with this will be greatly appreciated.
--
Thanks,
Params
--
View this message in context: http://maven.40175.n5.nabble.com/APT-Issue-with-adding-xml-code-snippets-as-Verbatim-tp4831524p4831524.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: APT: Issue with adding xml code snippets as Verbatim
Posted by Lukas Theussl <lt...@apache.org>.
Try to only escape the '$' character, see
http://velocity.apache.org/engine/devel/user-guide.html#escapinginvalidvtlreferences
HTH,
-Lukas
On 09/23/2011 12:12 AM, Params wrote:
> Thanks Robert, I tried couple of combinations and found this to work:
> <value>#set($varline = '${wf:errorCode("wordcount")}') ${varline}</value>
>
> However, the display text I now get as html is:
> <value> ${wf:errorCode("wordcount")}</value>
>
> Is there a way, I can get the wordcount inside single quotes?
>
> Following three combinations don't work:
> <value>#set($varline = '${wf:errorCode(\'wordcount\')}') ${varline}</value>
> <value>#set($varline = "${wf:errorCode('wordcount')}") ${varline}</value>
> <value>#set($varline = "${wf:errorCode(\'wordcount\')}") ${varline}</value>
>
> --
> Thanks,
> Params
>
> --
> View this message in context: http://maven.40175.n5.nabble.com/APT-Issue-with-adding-xml-code-snippets-as-Verbatim-tp4831524p4831674.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
RE: APT: Issue with adding xml code snippets as Verbatim
Posted by Params <pa...@gmail.com>.
Thanks Robert, I tried couple of combinations and found this to work:
<value>#set($varline = '${wf:errorCode("wordcount")}') ${varline}</value>
However, the display text I now get as html is:
<value> ${wf:errorCode("wordcount")}</value>
Is there a way, I can get the wordcount inside single quotes?
Following three combinations don't work:
<value>#set($varline = '${wf:errorCode(\'wordcount\')}') ${varline}</value>
<value>#set($varline = "${wf:errorCode('wordcount')}") ${varline}</value>
<value>#set($varline = "${wf:errorCode(\'wordcount\')}") ${varline}</value>
--
Thanks,
Params
--
View this message in context: http://maven.40175.n5.nabble.com/APT-Issue-with-adding-xml-code-snippets-as-Verbatim-tp4831524p4831674.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
RE: APT: Issue with adding xml code snippets as Verbatim
Posted by Robert Scholte <rf...@codehaus.org>.
The inner or outer single quotes should be double quotes or escape the inner ones.Now it's $varline = '${wf:errorCode('followed by noise -Robert > Date: Thu, 22 Sep 2011 14:53:55 -0700
> From: parameshr@gmail.com
> To: users@maven.apache.org
> Subject: RE: APT: Issue with adding xml code snippets as Verbatim
>
> Hi Robert,
>
> I tried storing the value of the function into a variable and print it
> (following the example diff file you had posted). Below is my .apt snippet.
>
> --------------------------------------------------------------------------------------
> <configuration>
> <property>
> <name>mapred.job.queue.name</name>
> <value>${queueName}</value>
> </property>
> <property>
> <name>error.message</name>
> <value>#set($varline = '${wf:errorCode('wordcount')}')
> ${varline}</value>
> </property>
> </configuration>
> --------------------------------------------------------------------------------------
>
>
>
> I still get the parse exception, this time it says:
>
> [ERROR] org.apache.velocity.runtime.parser.ParseException: Encountered
> "wordcount" at line 11, column 53.
> Was expecting one of:
> <RPAREN> ...
> <WHITESPACE> ...
> "-" ...
> "+" ...
> "*" ...
> "/" ...
> "%" ...
> <LOGICAL_AND> ...
> <LOGICAL_OR> ...
> <LOGICAL_LT> ...
> <LOGICAL_LE> ...
> <LOGICAL_GT> ...
> <LOGICAL_GE> ...
> <LOGICAL_EQUALS> ...
> <LOGICAL_NOT_EQUALS> ...
>
> Thanks,
> Params
>
> --
> View this message in context: http://maven.40175.n5.nabble.com/APT-Issue-with-adding-xml-code-snippets-as-Verbatim-tp4831524p4831623.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
RE: APT: Issue with adding xml code snippets as Verbatim
Posted by Params <pa...@gmail.com>.
Hi Robert,
I tried storing the value of the function into a variable and print it
(following the example diff file you had posted). Below is my .apt snippet.
--------------------------------------------------------------------------------------
<configuration>
<property>
<name>mapred.job.queue.name</name>
<value>${queueName}</value>
</property>
<property>
<name>error.message</name>
<value>#set($varline = '${wf:errorCode('wordcount')}')
${varline}</value>
</property>
</configuration>
--------------------------------------------------------------------------------------
I still get the parse exception, this time it says:
[ERROR] org.apache.velocity.runtime.parser.ParseException: Encountered
"wordcount" at line 11, column 53.
Was expecting one of:
<RPAREN> ...
<WHITESPACE> ...
"-" ...
"+" ...
"*" ...
"/" ...
"%" ...
<LOGICAL_AND> ...
<LOGICAL_OR> ...
<LOGICAL_LT> ...
<LOGICAL_LE> ...
<LOGICAL_GT> ...
<LOGICAL_GE> ...
<LOGICAL_EQUALS> ...
<LOGICAL_NOT_EQUALS> ...
Thanks,
Params
--
View this message in context: http://maven.40175.n5.nabble.com/APT-Issue-with-adding-xml-code-snippets-as-Verbatim-tp4831524p4831623.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
RE: APT: Issue with adding xml code snippets as Verbatim
Posted by Robert Scholte <rf...@codehaus.org>.
Hi, I had to do a trick to resolve this for the maven-eclipse-plugin documentation [1]It's related to VELOCITY-743 The idea is to assign the "complex" value to a variable, next print that variable. -Robert [1] http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/site/apt/examples/multi-module-projects.apt.vm?r1=1029885&r2=1151994
> Date: Thu, 22 Sep 2011 14:19:51 -0700
> From: parameshr@gmail.com
> To: users@maven.apache.org
> Subject: APT: Issue with adding xml code snippets as Verbatim
>
> Hi,
>
> I am using the APT documentation tool to add a page for my project.
> I tried to add the following snippet of xml into my .apt source file inside
> a 'verbatim' block.
>
> --------------------------------------------------------------------------------------------
> <configuration>
> <property>
> <name>mapred.job.queue.name</name>
> <value>${queueName}</value>
> </property>
> <property>
> <name>error.message</name>
> <value>Something went wrong:
> ${wf:errorCode('wordcount')}</value>
> </property>
> </configuration>
> --------------------------------------------------------------------------------------------
>
> On trying to build the maven project for the site documentation,
> $ mvn site
>
> I get the following error:
>
> [ERROR] org.apache.velocity.runtime.parser.ParseException: Encountered
> ":errorCode(\'wordcount\')}</message>\n </kill/>\n <end
> name=\'end\'/>\n</workflow-app>\n----------------------------------------------------------------------------------\n\n
> <<Notes:>>\n\n <<" at line 134, column 44.
> Was expecting one of:
> "}" ...
> <DOT> ...
>
>
> Observations:
> 1) It appears that whenever I use any text of the format:
> ${wf:errorCode('wordcount')}
> APT throws a parse exception (even if its contained in the verbatim block).
>
> 2) Other text like ${queueName} seems to work well.
>
> 3) I tried escaping the characters - {, $, :, etc.. but it doesnt work
> either.
>
> 4) I tried using the APT Editor (Eclipse plugin). It does not give any
> errors on preview, but publishing the .apt using a 'mvn site' still fails.
>
> Any help with this will be greatly appreciated.
>
> --
> Thanks,
> Params
>
> --
> View this message in context: http://maven.40175.n5.nabble.com/APT-Issue-with-adding-xml-code-snippets-as-Verbatim-tp4831524p4831524.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>