Closed sirpy closed 6 years ago
I'm confused. That's clearly a template and if I plug this piece of wikitext into the parser I get an WtTemplate AST. Are you using the swc-engine and performing expansion? Could you paste the AST you get (only the relevant part)?
i'm using the TextConverter example if i put break points in the different visit() methods it stops at WtTagExtension and not WtTemplate
I'm assuming you are talking about the TextConverter class in sweble-wom3-example-basic version 3.*?
This class has some copy and paste errors (no big problem because it's commented out). The use of type WtTemplate is nonsensical in this context since we are working with WOM nodes and not the AST nodes produced by the parser. The equivalent for WtTemplate in WOM is SwcTransclusion (the tag extension class is SwcTagExtension). If I added the following methods to the TextConverter class:
public void visit(Wom3Node n)
{
// Fallback for all nodes that are not explicitly handled below
/*write("<");
write(n.getNodeName());
write(" />");
*/
iterate(n);
}
public void visit(SwcTransclusion n)
{
System.out.println("template");
}
public void visit(SwcTagExtension n)
{
System.out.println("tagExtension");
}
The output is "template" which is what I would expect and consider correct. Does this fix your problem?
i think it does. i will test
On Fri, Jun 23, 2017 at 2:46 PM, Hannes Dohrn notifications@github.com wrote:
I'm assuming you are talking about the TextConverter class in sweble-wom3-example-basic version 3.*?
This class has some copy and paste errors (no big problem because it's commented out). The use of type WtTemplate is nonsensical in this context since we are working with WOM nodes and not the AST nodes produced by the parser. The equivalent for WtTemplate in WOM is SwcTransclusion (the tag extension class is SwcTagExtension). If I added the following methods to the TextConverter class:
public void visit(Wom3Node n) { // Fallback for all nodes that are not explicitly handled below /write("<"); write(n.getNodeName()); write(" />"); / iterate(n); }
public void visit(SwcTransclusion n) { System.out.println("template"); }
public void visit(SwcTagExtension n) { System.out.println("tagExtension"); }
The output is "template" which is what I would expect and consider correct. Does this fix your problem?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/sweble/sweble-wikitext/issues/60#issuecomment-310645056, or mute the thread https://github.com/notifications/unsubscribe-auth/AAo9d0K59FxcM1d7uaNWDoytF6t9Ey3Qks5sG6V8gaJpZM4N9cW- .
it's parsed as WtTagExtension, is there some parser to convert this template into it's components?