Hi Vincent,

Thank you for your reply.

So the plugin just needs to fetch the image map from the plantUML Server?
And I guess I'm using an external plantuml server?! 


Kind regards,
Timo
-IT-


Note that another option is to return the result as SVG and let the browser 
display it:

http://www.plantuml.com/plantuml/svg/SyfFKj2rKt3CoKnELR1IoC_cAYtAKSXFKt02IcGMAqH7PvIK55ZfwvUNb-kbv-UdvwJg9UVdniO20000

Notice the “svg/” part in the url instead of “img/“.

For this you’d just need to replace:

 println "[[image:"+serverurl+"img/"+encoded+"||style=\"max-width:100%\"]]”

With:

def svg = “${serverurl}/svg/${encoded}||style=\"max-width:100%\”".toURL().text
println “{{html clean=false}}${svg}{{/html}}"

Ofc the browser needs to be able to render svg.

Thanks
-Vincent

> On 27 Feb 2017, at 09:32, Vincent Massol <vinc...@massol.net> wrote:
> 
> Hi Timo,
> 
>> On 22 Feb 2017, at 14:19, Timo Dachs-Wegmann <t.wegm...@procitec.de> wrote:
>> 
>> Hello,
>> 
>> I want to draw a UML Diagram with the XWiki Plugin "PlantUML". As I tested 
>> it, I found a problem with the feature of including links in the diagram.
>> I can't connect an URL to an object, because XWiki seems to import the Macro 
>> as a picture (something like jpeg or gif). 
>> 
>> There is a good Manual on how to insert links on the HowTo Page of 
>> PlantUML.com ( http://plantuml.com/incubation ). The one I tried was a very 
>> basic test:
>>      @startuml
>>      Bob -> Alice : ok
>>      url of Bob is [[http://www.google.com]]
>>      @enduml
>> 
>> The problem with this is, that you can't click on "Bob" as a link because 
>> the link is not passed through to the XWiki page. 
>> Maybe you have an idea how to solve it or could tell me if there is a way to 
>> work around this.
> 
> I’ve not used this extension but its source code is at 
> https://github.com/xwiki-contrib/macro-plantuml
> 
> For example looking at:
> https://github.com/xwiki-contrib/macro-plantuml/blob/master/src/main/resources/XWiki/PlantUMLMacro.xml#L278
> 
> I see (for an externally configured plantuml server):
> 
>  println "[[image:"+serverurl+"img/"+encoded+"||style=\"max-width:100%\"]]"
> 
> This means this will call a URL to the plantuml server and that it returns an 
> image which xwiki only displays.
> 
> I’ve used your example here:
> http://www.plantuml.com/plantuml/uml/SoWkIImgAStDuNBAJrBGjLDmpCbCJbMmKiZFvYejob78JrC0IMGMAqH7PvIK55ZfwvUNb-kbv-UdvwJg9UVdniPoEQJcfG1D0000
>  and it works for the link (because it’s an image + an image map).
> 
> So AFAICS the reason it won’t work as is with xwiki is that the url used by 
> xwiki to get the image is 
> http://www.plantuml.com/plantuml/png/SyfFKj2rKt3CoKnELR1IoC_cAYtAKSXFKt02IcGMAqH7PvIK55ZfwvUNb-kbv-UdvwJg9UVdniO20000
>  which returns only the image and not the image map.
> 
> Haha… found something. There’s another url to call to get the map:
> http://www.plantuml.com/plantuml/map/SyfFKj2rKt3CoKnELR1IoC_cAYtAKSXFKt02IcGMAqH7PvIK55ZfwvUNb-kbv-UdvwJg9UVdniO20000
> 
> So it’s very easy to add support for this. The code needs to be modified with 
> something like this:
> 
> def htmlMap = “${serverurl}/map/${encoded}”.toURL().text
> println “{{html clean=false}}${htmlMap}{{/html}}"
> 
> And that should work! :)
> 
> You should create a jira issue at http://jira.xwiki.org/browse/PLANTUML for 
> this.
> 
> Thanks
> -Vincent
> 
>> 
>> Thank you in advance
>> 
>> Kind regards,
>> 
>> Timo Dachs-Wegmann
>> -IT-




Reply via email to