Forum How do I...?

Enterprise Architect Notes field (pseudo HTML) format

Johann
For our documentation we extract information from Notes fields of our UML tool Enterprise Architect (from Sparx Systems).

They have invented a crappy format that is somewhere between plain text and HTML. That is

  • white space characters (space and newline) are significant
  • some HTML tags, like <b> or <ul> for lists are supported

- - -
Johann

Johann
sorry, the description was not complete when I hit the post button...

An example for the Notes field HTML is:

<!DOCTYPE html>
<html>
  <head>
    <title>Title</title>
    <style>
      div.note { white-space:pre-wrap }
      div.note ul {
        white-space: normal;
        margin: 0;
      }
      div.note li { white-space: pre-wrap }
    </style>
  </head>
  <body>
    <div class="note" title="Note">This document describes all relevant information for the
 
<ul>
	<li>Use Cases</li>
	<li>Software Architecture</li>
	<li>Software Design</li>
	<li>Test Specification *)</li>
	<li>Requirements Matrix</li>
	<li>List of all project documents specifying the referenced release versions.</li>
</ul>

*) For technical reasons, the release test results cannot be included in this document.</div>
  </body>
</html>


With the release versions of Prince (e.g. 14.2), the HTML rendered fine with the CSS styles in the <style> field. Below the list there was one blank line.

With the latest build versions of Prince (e.g. Prince 20220808) there is an extra blank line below the list - and two blank lines altogether!

I know that this is compatible with rendering of current browsers, and I it also correct as there are actually two newline characters!

But I still require the old behavior - is there any chance to revert to the old rendering?

- - -
Johann

mikeday
I think we have to stick with the new behaviour for consistency with browsers, but what about applying "margin-bottom: -1.14em" to the list? Or alternatively using JavaScript to chop one newline?
Johann
OK - I understand this!

Applying margins in this way sounds like a good idea, I will try it.
Else, we could remove the newline in our XSLT code (should be a little bit faster than Javascript).

- - -
Johann

Johann
For a CSS-only solution we must handle the lists at the end of the container:

div.note ul:last-child { margin-bottom:0; }


The only problem comes from plain text nodes that follow the list! This is a situation where we would require the :last-node selector - but it is still not standardized :-(

Mozilla implemented this long ago: see :-moz-last-node

- - -
Johann