archimatetool / archi

Archi: ArchiMate Modelling Tool
https://www.archimatetool.com
MIT License
927 stars 267 forks source link

Seems like there are still some embedded HTML markup not executed in text fields when using HTML Report #806

Closed ProximaBay closed 2 years ago

ProximaBay commented 2 years ago

Version of Archi

4.9.2 Build 202201131438

Operating System

Windows 10

Expected Behaviour

When generating HTML reports, all words / sentences containing html markups for special/accentued characters (like "é", "è", "à", ...) in elements and views names/documentation/properties/etc. should be executed/translated in all UI's objetcs and panels (treeview, rendered views, element's properties, view's properties...).

Actual Behaviour

Seems like it is not the case for the "view properties" and the "Element properties" panels (please see screenshot below).

Steps to Reproduce the Behaviour

  1. Use some special/accentued characters for elements and views names / documentation / properties...
  2. Generate HTML Report
  3. ...et voilà ! :)

screenshot

Phillipus commented 2 years ago

Thanks for the report. This was working in Archi 4.8.1. Probably something to do with property handling...

Phillipus commented 2 years ago

This is a result of the change made in frame.js:

// Create links in this class
$('.convertlinks').each(function() {
    $(this).html(createLinks($(this).html())); // <------ Was text()
});

If html() is changed to text() these characters display OK.

Phillipus commented 2 years ago

In frame.stg, line 243:

^element.Properties:{p | <tr><td> ^p.Key;format="xml-encode"^ </td><td class="convertlinks"> <xmp class="no-margin" style="white-space:pre-wrap">^p.Value;format="xml-encode"^</xmp> </td></tr>}^

If the last ;format="xml-encode" is removed it renders OK. But I don't know what side effects this might have.

Phillipus commented 2 years ago

Another issue with recent changes is that links in Property values no longer render as links.

Phillipus commented 2 years ago

And I think I have the solution.

Replace xmp tag with div

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/xmp

ProximaBay commented 2 years ago

thanks a lot Phil for having a look on this issue ! :)

Phillipus commented 2 years ago

thanks a lot Phil for having a look on this issue ! :)

No problem.

In the meantime you could manually edit this file at line 243:

<Archi Install>/plugins/com.archimatetool.reports/templates/st/frame.stg

To:

^element.Properties:{p | <tr><td>^p.Key;format="xml-encode"^</td><td class="convertlinks no-margin" style="white-space:pre-wrap">^p.Value;format="xml-encode"^</td></tr>}^

jbsarrodie commented 2 years ago

Jumping on this.

There used to be a rationale for using xmp tag. I think it was used to make sure html markup in documentation was not interpreted, of course this should no more be needed now that we force xml encoding, but I guess I have to check all this a bit more.

Phillipus commented 2 years ago

Jumping on this.

There used to be a rationale for using xmp tag. I think it was used to make sure html markup in documentation was not interpreted, of course this should no more be needed now that we force xml encoding, but I guess I have to check all this a bit more.

Since xml-encode is used xmp is no more needed. I committed to master so I think it should be good.

Phillipus commented 2 years ago

Fixed for next version