[
https://issues.apache.org/jira/browse/VELOCITY-919?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Rob van Dalen updated VELOCITY-919:
-----------------------------------
Description:
We have a recognition application of recognizing text and decorating the text.
When we putting the below input text to the application:
*Input for the application:*
{code:none}
see art. 1 of the WW and then some other text
{code}
_Just before the text *art. 1* there is a Zero-Width space._
The application will make the text like this:
*Input for the VelocityEngine:*
{code:none}
see ${annotationsMap[0]} and then some other text
{code}
_Just before the text *$\{annotationsMap[0]}* there still is a Zero-Width
space. because our application only changed *art.1 of the WW* into
*$\{annotationsMap[0]}*_
When we put this text to the VelocityEngine together with the decoration
template and a list of laws in the context, the engine is changing my text.
It's removing the Zero-Width Space.
Just before the VelocityEngine is using the text and the template,
VelocityEngine is removing the Zer0-Width Space
Velocity should only do some markup and not change the original input text.
This is a pace of Java code:
{code:java}
VelocityEngine velocityEngine = new VelocityEngine();
Path pathName = pipelineRoot.resolve(templateFile.getParent());
velocityEngine.setProperty(FILE_RESOURCE_LOADER_PATH,
pathName.toFile().getAbsolutePath());
if (exists(pathName.resolve(GLOBAL_MACRO_FILENAME))) {
velocityEngine.setProperty(VM_LIBRARY, GLOBAL_MACRO_FILENAME);
}
velocityEngine.init();
VelocityContext context = new VelocityContext();
context.put("escape", new EscapeTool());
// annotatiosMap is put in context as a whole, so that template script can
descide what to do with different CitationTypes
context.put("annotationsMap", annotationsMap);
StringWriter writer = new StringWriter();
velocityEngine.evaluate(context, writer, templateFile.getFileName().toString(),
"see ${annotationsMap[0]} and then some other text");
{code}
was:
We have a recognition application of recognizing text and decorating the text.
When we putting the below input text to the application:
*Input for the application:*
{code:none}
see art. 1 of the WW and then some other text
{code}
_Just before the text *art. 1* there is a Zero-Width space._
The application will make the text like this:
*Input for the VelocityEngine:*
{code:none}
see ${annotationsMap[0]} and then some other text
{code}
_Just before the text *$\{annotationsMap[0]}* there still is a Zero-Width
space. because our application only changed *art.1 of the WW* into
*$\{annotationsMap[0]}*_
When we put this text to the VelocityEngine together with the decoration
template and a list of laws in the context, the engine is changing my text.
It's removing the Zero-Width Space.
Just before the VelocityEngine is using the text and the template,
VelocityEngine is removing the Zer0-Width Space
Velocity should only do some markup and not change the original input text.
This is a pace of Java code:
{code:java}
VelocityContext context = new VelocityContext();
context.put("escape", new EscapeTool());
context.put("IdentifierUtil", identifierUtil);
context.put("origin", "crux");
// annotatiosMap is put in context as a whole, so that template
script can descide what to do with
// different CitationTypes
context.put("annotationsMap", annotationsMap);
StringWriter writer = new StringWriter();
log.debug("Process Crux against the Velocity template");
velocityEngine.evaluate(context, writer,
templateFile.getFileName().toString(), templateStringBuilder.toString());
{code}
> Velocity is removing the Zero-Width space from the text
> -------------------------------------------------------
>
> Key: VELOCITY-919
> URL: https://issues.apache.org/jira/browse/VELOCITY-919
> Project: Velocity
> Issue Type: Bug
> Components: Engine
> Affects Versions: 2.1
> Reporter: Rob van Dalen
> Priority: Major
>
> We have a recognition application of recognizing text and decorating the text.
> When we putting the below input text to the application:
> *Input for the application:*
> {code:none}
> see art. 1 of the WW and then some other text
> {code}
> _Just before the text *art. 1* there is a Zero-Width space._
> The application will make the text like this:
> *Input for the VelocityEngine:*
> {code:none}
> see ${annotationsMap[0]} and then some other text
> {code}
> _Just before the text *$\{annotationsMap[0]}* there still is a Zero-Width
> space. because our application only changed *art.1 of the WW* into
> *$\{annotationsMap[0]}*_
> When we put this text to the VelocityEngine together with the decoration
> template and a list of laws in the context, the engine is changing my text.
> It's removing the Zero-Width Space.
> Just before the VelocityEngine is using the text and the template,
> VelocityEngine is removing the Zer0-Width Space
> Velocity should only do some markup and not change the original input text.
>
> This is a pace of Java code:
> {code:java}
> VelocityEngine velocityEngine = new VelocityEngine();
> Path pathName = pipelineRoot.resolve(templateFile.getParent());
> velocityEngine.setProperty(FILE_RESOURCE_LOADER_PATH,
> pathName.toFile().getAbsolutePath());
> if (exists(pathName.resolve(GLOBAL_MACRO_FILENAME))) {
> velocityEngine.setProperty(VM_LIBRARY, GLOBAL_MACRO_FILENAME);
> }
> velocityEngine.init();
> VelocityContext context = new VelocityContext();
> context.put("escape", new EscapeTool());
> // annotatiosMap is put in context as a whole, so that template script can
> descide what to do with different CitationTypes
> context.put("annotationsMap", annotationsMap);
> StringWriter writer = new StringWriter();
> velocityEngine.evaluate(context, writer,
> templateFile.getFileName().toString(), "see ${annotationsMap[0]} and then
> some other text");
> {code}
--
This message was sent by Atlassian Jira
(v8.3.2#803003)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]