Maintainer | Ivan.Miljenovic@gmail.com |
---|
This module defines the syntax for HTML-like values for use in Graphviz. Please note that these values are not really HTML, but the term "HTML" is used throughout as it is less cumbersome than "HTML-like". To be able to use this, the version of Graphviz must be at least 1.10. For more information, please see: http://graphviz.org/doc/info/shapes.html#html
The actual definition of the syntax specifies that these types must
be valid XML syntax. As such, this assumed when printing and parsing,
though the correct escape/descaping for "
, &
, <
and >
are
automatically done when printing and parsing.
Differences from how Graphviz treats HTML-like values:
- Graphviz only specifies the above-listed characters must be
escaped; however, internally it also escapes
-
,'
and multiple sequences of spaces. This library attempts to match this behaviour. Please let me know if this behaviour (especially about escaping multiple spaces) is unwanted. - When parsing escaped HTML characters, numeric escapes are converted to the corresponding character as are the various characters listed above; all other escaped characters (apart from those listed above) are silently ignored and removed from the input (since technically these must be valid XML, which doesn't recognise as many named escape characters as does HTML).
- All whitespace read in is kept (even if Graphviz would ignore multiple whitespace characters); when printing them, however, they are replaced with non-breaking spaces. As such, if multiple literal whitespace characters are used in a sequence, then the result of parsing and then printing some Dot code will not be the same as the initial Dot code. Furthermore, all whitespace characters are printed as spaces.
- It is assumed that all parsed
&
values are the beginning of an XML escape sequence (which must finish with a;
character). - There should be no pre-escaped characters in values; when
printing, the
&
will get escaped without considering if that is an escaped character.
- data HtmlLabel
- type HtmlText = [HtmlTextItem]
- data HtmlTextItem
- data HtmlTable = HTable {}
- newtype HtmlRow = HtmlRow [HtmlCell]
- data HtmlCell
- newtype HtmlImg = HtmlImg HtmlAttributes
- type HtmlAttributes = [HtmlAttribute]
- data HtmlAttribute
- = HtmlAlign HtmlAlign
- | HtmlBAlign HtmlAlign
- | HtmlBGColor Color
- | HtmlBorder Word8
- | HtmlCellBorder Word8
- | HtmlCellPadding Word8
- | HtmlCellSpacing Word8
- | HtmlColor Color
- | HtmlColSpan Word16
- | HtmlFace Text
- | HtmlFixedSize Bool
- | HtmlHeight Word16
- | HtmlHRef Text
- | HtmlPointSize Double
- | HtmlPort PortName
- | HtmlRowSpan Word16
- | HtmlScale HtmlScale
- | HtmlSrc FilePath
- | HtmlTarget Text
- | HtmlTitle Text
- | HtmlVAlign HtmlVAlign
- | HtmlWidth Word16
- data HtmlAlign
- data HtmlVAlign
- data HtmlScale
Documentation
The overall type for HTML-like labels. Fundamentally, HTML-like
values in Graphviz are either textual (i.e. a single element with
formatting) or a table. Note that HtmlLabel
values can be
nested via HtmlLabelCell
.
type HtmlText = [HtmlTextItem]Source
Represents a textual component of an HTML-like label. It is
assumed that an HtmlText
list is non-empty. It is preferable
to "group" HtmlStr
values together rather than have
individual ones. Note that when printing, the individual values
are concatenated together without spaces, and when parsing
anything that isn't a tag is assumed to be an HtmlStr
: that is,
something like "<BR/> <BR/>
" is parsed as:
[HtmlNewline [], HtmlStr " ", HtmlNewline []]
data HtmlTextItem Source
Textual items in HTML-like labels.
HtmlStr Text | |
HtmlNewline HtmlAttributes | Only accepts an optional |
HtmlFont HtmlAttributes HtmlText |
A table in HTML-like labels. Tables are optionally wrapped in
overall FONT
tags.
HTable | |
|
Cells either recursively contain another HtmlLabel
or else a
path to an image file.
The path to an image; accepted HtmlAttributes
are HtmlScale
and HtmlSrc
.
type HtmlAttributes = [HtmlAttribute]Source
The various HTML-like label-specific attributes being used.
data HtmlAttribute Source
Note that not all HtmlAttribute
values are valid everywhere:
see the comments for each one on where it is valid.
HtmlAlign HtmlAlign | Valid for: |
HtmlBAlign HtmlAlign | Valid for: |
HtmlBGColor Color | Valid for: |
HtmlBorder Word8 | Valid for: |
HtmlCellBorder Word8 | Valid for: |
HtmlCellPadding Word8 | |
HtmlCellSpacing Word8 | Valid for: |
HtmlColor Color | |
HtmlColSpan Word16 | Valid for: |
HtmlFace Text | Valid for: |
HtmlFixedSize Bool | |
HtmlHeight Word16 | |
HtmlHRef Text | |
HtmlPointSize Double | Valid for: |
HtmlPort PortName | |
HtmlRowSpan Word16 | Valid for: |
HtmlScale HtmlScale | Valid for: |
HtmlSrc FilePath | Valid for: |
HtmlTarget Text | |
HtmlTitle Text | |
HtmlVAlign HtmlVAlign | |
HtmlWidth Word16 |
Specifies horizontal placement. When an object is allocated more space than required, this value determines where the extra space is placed left and right of the object.
HLeft | |
HCenter | Default value. |
HRight | |
HText |
|
data HtmlVAlign Source
Specifies vertical placement. When an object is allocated more space than required, this value determines where the extra space is placed above and below the object.
Specifies how an image will use any extra space available in its
cell. If undefined, the image inherits the value of the
ImageScale
attribute.