Hi Marc,

On 18 Feb 2015 at 09:57:53, Marc AUDEFROY 
([email protected](mailto:[email protected])) 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-rendering-syntax-markdown10/5.4.3/org/xwiki/rendering/internal/parser/markdown/AbstractLinkAndImagePegdownVisitor.java#AbstractLinkAndImagePegdownVisitor.0linkResourceReferenceParser
>   
>  
> - AbstractPluginsPegdownVisitor : 
> https://github.com/xwiki/xwiki-rendering/blob/master/xwiki-rendering-syntaxes/xwiki-rendering-syntax-markdown11/src/main/java/org/xwiki/rendering/internal/parser/markdown11/AbstractPluginsPegdownVisitor.java
>   
>  
>  
> - XDOMGeneratorListener : 
> http://grepcode.com/file/repo1.maven.org/maven2/org.xwiki.rendering/xwiki-rendering-api/6.2/org/xwiki/rendering/internal/parser/XDOMGeneratorListener.java#XDOMGeneratorListener.beginLink%28org.xwiki.rendering.listener.reference.ResourceReference%2Cboolean%2Cjava.util.Map%29
>   
>  
>  
>  
> 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 [email protected]”)

?

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




_______________________________________________
users mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to