Hi Daniel,
I tried to add a new built in & of course it DIDN'T work 😢.
I did the following.
1. added putBI("previousSibling", new previousSiblingBI()); in BuiltIn.java2.
added a static class in BuiltInForNodes.java static class previousSiblingBI
extends BuiltInForNode {
@Override
TemplateModel calculateResult(TemplateNodeModel nodeModel, Environment
env) throws TemplateModelException {
return nodeModel.getPreviousSibling();
}
}
3. added a method in Interface TemplateNodeModel.java
TemplateNodeModel getPreviousSibling() throws TemplateModelException;
4. In package freemarker.ext.dom's NodeModel added the following method
public TemplateNodeModel getPreviousSibling() { Node previousSibling =
node.getPreviousSibling();
return wrap(previousSibling);}
Once this is done I tried to access it as .node?previousSibling from template
and it reached till the NodeModel class i defined in the 4th step. But the
returned previousSibling is not proper. It's not returning the
programListingNode with formDataModel instead returns someother node.
I tried to log the node returned and I got the following o/p
[docgen:transform] [#text:
[docgen:transform] ]
I clearly understand the implementation of getPreviousSibling is not proper,
but I couldn't figure out where we have implemented the same.
Please advise.
Pradeep.