eclipse-capella / capella-requirements-vp

This add-on allows importing a set of requirements from a ReqIF file
Eclipse Public License 2.0
19 stars 17 forks source link

#180 Display requirements informations in several lines #193

Open GlennPlou opened 3 months ago

sonarcloud[bot] commented 3 months ago

Quality Gate Passed Quality Gate passed

Issues
1 New issue
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud

GlennPlou commented 3 months ago

Indeed, this can have an impact on the importer. The idea behind the second commit in this PR is to have a consistent behavior for the method transformHTMLToText(String, String). I am not sure whether we want to transform only the quotes, or if only the angle brackets should not be transformed, or if it is an error and all special characters should be transformed. I don't know how to use the importer to check what is displayed to the user. image

In fact, when I wanted to add a unit test for LabelHelper.transformHTMLToText with RequirementsPreferencesConstants.REQUIREMENT_KEEP_XHTML_TAGS set to true, the string "<xhtml:div>Capella &quot;&lt;is&gt;&quot; great <xhtml:a href=\"to%20.pdf\">here</xhtml:a></xhtml:div>" is transformed into "<div>Capella &quot;&lt;is&gt;&quot; great <a href=\"to%20.pdf\">here</a></div>", while with the preference set to false, the result is "Capella \"<is>\" great here". Given the naming, the method transformHTMLToTextshould transform the special characters, regardless of the preference value.

pdulth commented 3 months ago

After tests, it's ok for the previous comment. The import when we keep tags is working as originally expected, the display was not relevant for the user using the preference. Now the display is improved so it looks better than before.

If it's all good/finished for you, can we merge it ?

GlennPlou commented 3 months ago

No go to merge yet. We need to discuss with our team. We're afraid of the impact it could have on M2Doc or DocGen, for example. In addition, we think that the aql expressions used for the label and content of Requirements could be moved into a service, and include the “transformHTMLToText” process, rather than using it in a post-process. image Also, I finally understood the impact this could have on the importer and dialog invoked by the palette's Requirements tool. See this comment.

pdulth commented 3 months ago

A sample reqif with custom attribute xhtml multiline reqif.zip preferences