Mailto stripped when rendered in html/5.0

Hi All,

I’ve just found that rendering a mailto: link with html/5.0 syntax strips the mailto:

The email link works correctly when rendered on the page itself no worries. The value is the string with the correct xwiki 2.1 link syntax.

[[email@doamin.com>>mailto:email@domain.com]]

And when using that value else where in the wiki using the below, work and displays as a mailto: link as expected.

$document.getObject('Main.Contacts.Code.ContactsClass').getProperty('email').value

When rendering the same value as html/5.0 the mailto is stripped and xwiki treats it as an wikiexternallink url.

$services.rendering.render($services.rendering.parse($document.getObject('Main.Contacts.Code.ContactsClass').getProperty('email').value, 'xwiki/2.1'), 'html/5.0')

The resulting html is

<p><span class="wikiexternallink"><a href="email@domain.com">email@domain.com</a></span></p>

I found this jira issue which was fixed in 14.0-rc-1 but was for html/4.01. We’re running 14.10.1 and obviously using html/5.0.

html/5.0 is the renderer used by XWiki in your first example, so that’s not where the problem is coming from.

What exactly is your code ?

The following is working as expected for me:

{{velocity wiki="false"}}
$services.rendering.render($services.rendering.parse('[[mailto:toto@gmail.com]]', 'xwiki/2.1'), 'html/5.0')
{{/velocity}}

{{velocity}}
{{html}}
$services.rendering.render($services.rendering.parse('[[mailto:toto@gmail.com]]', 'xwiki/2.1'), 'html/5.0')
{{/html}}
{{/velocity}}

I can reproduce your problem if I do:

{{velocity}}
$services.rendering.render($services.rendering.parse('[[mailto:toto@gmail.com]]', 'xwiki/2.1'), 'html/5.0')
{{/velocity}}

but that’s because anything that looks like wiki syntax is interpreted as the result of the velocity execution, which is really not what you want.

1 Like

Thanks @tmortagne,

I did try the {{html}} macro at one point when adding the the data to the row, but I think I probably just put it in at the wrong place.

The wiki=“false” was the winner. To be honest I thought I’d set that but obviously must have been on a different script.

The code is sort of mimicking the WikiManager page but instead using Solr to retrieve all pages of a class from all subwikis to display in a LiveData table on the main wiki. E.g., to show all Internet services that have been created for all customers along with all relevant property values shown, plus the details for site and contact assigned for the service. It’s pretty crude but works well enough.