Hi Marc,
On 18 Feb 2015 at 09:57:53, Marc AUDEFROY
(audefroy.marc@gmail.com(mailto:audefroy.marc@gmail.com)) wrote:
Hi all!
I would fix this issues :
http://jira.xwiki.org/browse/XRENDERING-362
http://jira.xwiki.org/browse/XRENDERING-354 .
For this, I'll have to play with this classes :
- AbstractLinkAndImagePegdownVisitor :
http://grepcode.com/file/repo1.maven.org/maven2/org.xwiki.rendering/xwiki-r…
- AbstractPluginsPegdownVisitor :
https://github.com/xwiki/xwiki-rendering/blob/master/xwiki-rendering-syntax…
- XDOMGeneratorListener :
http://grepcode.com/file/repo1.maven.org/maven2/org.xwiki.rendering/xwiki-r…
For resume, Pegdown, the parser engine accept the plugins in order to override the
behaviour.
XWiki has already added three plugins. For that, They created
AbstractPluginsPegdownVisitor which inherits AbstractLinkAndImagePegdownVisitor.
For issue concerning the WikiLinks, I need override “visit(WikiLinkNode wikiLinkNode)”
(into AbstractPluginsPegdownVisitor). In this method, I have to call the instance of
XDOMGeneratorListener in order to create a XDOM link.
Are you sure it’s not too late in the processing? When visit(WikiLinkNode) is called the
parser has already found it was a link. Is it called if you have, for example:
![MyAttachment]("Getting Started.WebHome(a)attachment1.xn--png-9o0a)
?
If not, then you’ll need to write a plugin that will parse this type of links before the
standard MD parser parses it.
And this is where I have a problem.
I understand I have to call beginLinks and endLink but I don’t understand how to sent the
link and the title? It’s a bit hard to understand XDOMGeneratorListener.
The code is here actually:
getListener().beginLink(reference, false, parameters);
visitChildren(expLinkNode);
getListener().endLink(reference, false, parameters);
So in XWiki’s XDOM events it works like this:
- send a begin link event
- send the label of the link as events (the label can contain any markup!).
- send an end link event
Hope it helps!
-Vincent
I hope you can help me.
Thanks,
Marc