-
Notifications
You must be signed in to change notification settings - Fork 34
Correct HTML
Documention of Modelica code can be exported to HTML. Still, it is necessary to use correct syntax such that the documentation can be interpreted in the right way.
The following rules should help to avoid the most common syntax errors/warnings:
Never use | Always use | Comment |
---|---|---|
<br> |
<br/> |
tags must be closed |
<HTML> or "
|
<html> or "
|
tags must be lowercase |
size=5 or cellspacing=0
|
size=\"5\" and cellspacing=\"0\"
|
double quotes around values, double quotes must be escaped |
y > 2 or x<3
|
y > 2 or x<3
|
< and > are special characters |
-> or <-
|
→ or ←
|
< and > are special characters |
<p><h4>Title</h4></p> |
<h4>Title</h4> |
headers and lists already create paragraphs |
There exist several tools to check the HTML syntax for errors.
Buildings.py with HTML-tidy
BuildingsPy can validate the HTML documentation.
To install it, run pip install -U buildingspy
.
You will also need the tidy.dll
from http://www.html-tidy.org/.
Then you can run the following Python script (remember to change the path):
import os
import buildingspy.development.validator as v
moLibPath = '[PATH TO THE MODELICA LIBRARY ON YOUR MACHINE]'
val = v.Validator()
errStr = val.validateHTMLInPackage(moLibPath)
print(errStr)
Other validators
Experience shows, that BuildingsPy and HTML tidy did not find all the warnigns/errors!
In addition, one can use Dymola or any other Modelica tool to export the HTML documentation.
That HTML documentation can then be checked by any HTML checker, e.g. htmlhint.