CTS2/doc/Howto ea html
How To Generate HTML in Enterprise Architect
The Generator Itself
The HTML generated by Enterprise Architect (EA) version 9.3.934 does not work with Firefox. There are two unrelated issues that are causing this problem:
- EA creates little maplets between the EA GUIDs and the diagram names as ".xml" files. These files, however, contain JSON fragments, not XML. Any web server worth its salt returns ".xml" files with the mime type "application/xml". Firefox attempts to parse these as XML and complains bitterly when it cannot.
- The JavaScript that is generated in the displayTOC.js file contains multiple references to a variable named cont. This variable is never formally declared and the "window" attribute is not correctly initialized.
Both of these issues require changes to the EA code generator. To make these changes, you need to go to the "Resources" tab (View / More Project Tools / Project Resources) and select "Templates/Web Style Templates". One can then create a new template (say, "CTS2") and edit the following resources:
- Javascript (This generates the displayTOC.js" output)
- Everywhere you find the string '.xml', replace it with '.js'
- Replace every occurrence of the string cont.document with contDoc
- Add the declaration "var contDoc = top.frames[1].document;" as the first line in
- function initItem(item)
- function initPage(src)
- function toggleDiv(iDiv, idImage)
- function toggleData(src)
- function toggleItem(item, type)
- Everywhere you find the string '.xml', replace it with '.js'
Once this is done, you need to generate the HTML. (Note: make sure you set "hide" on on the diagram filters "noconstraints"). You then need to execute the following command in the root output directory:
for i in `find . -name "*.xml"` ; do mv "$i" "${i%.xml}.js" ; done
Adjusting the LaTeX Annotations
The native UML CTS2 documentation uses a combination of HTML markup and LaTeX. The EA documentation generator does not recognize either of these, so a secondary transformation is needed. A python script can be downloaded from CTS2/doc/http://informatics.mayo.edu/svn/trunk/cts2/supp/HTMLLayout/ea/ here that does a pretty good job of transforming the content into a more readable format. The conversion can be validated by:
> cd supp/HTMLLayout/ea > python -m unittest fixEANotes <-- this should run without errors > find [base directory of EA export] -name "*.htm" -exec python {} \;