Copyright | (c) Ivan Lazar Miljenovic |
---|---|
License | 3-Clause BSD-style |
Maintainer | Ivan.Miljenovic@gmail.com |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Data.GraphViz.Attributes.HTML
Description
This module is written to be imported qualified. It 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.
Synopsis
- data Label
- type Text = [TextItem]
- data TextItem
- data Format
- data Table = HTable {}
- data Row
- = Cells [Cell]
- | HorizontalRule
- data Cell
- newtype Img = Img Attributes
- type Attributes = [Attribute]
- data Attribute
- = Align Align
- | BAlign Align
- | BGColor Color
- | Border Word8
- | CellBorder Word8
- | CellPadding Word8
- | CellSpacing Word8
- | Color Color
- | ColSpan Word16
- | Columns CellFormat
- | Face Text
- | FixedSize Bool
- | GradientAngle Int
- | Height Word16
- | HRef Text
- | ID Text
- | PointSize Double
- | Port PortName
- | Rows CellFormat
- | RowSpan Word16
- | Scale Scale
- | Sides [Side]
- | Src FilePath
- | Style Style
- | Target Text
- | Title Text
- | VAlign VAlign
- | Width Word16
- data Align
- data VAlign
- data CellFormat = RuleBetween
- data Scale
- data Side
- data Style
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 Label
values can be
nested via LabelCell
.
type Text = [TextItem] Source #
Represents a textual component of an HTML-like label. It is
assumed that a Text
list is non-empty. It is preferable
to "group" Str
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 a Str
: that is,
something like "<BR/> <BR/>
" is parsed as:
[Newline [], Str " ", Newline []]
Textual items in HTML-like labels.
Constructors
Str Text | |
Newline Attributes | Only accepts an optional |
Font Attributes Text | |
Format Format Text | Only available in Graphviz >= 2.28.0. |
Instances
Read TextItem Source # | |
Show TextItem Source # | |
Eq TextItem Source # | |
Ord TextItem Source # | |
Defined in Data.GraphViz.Attributes.HTML | |
Labellable Text Source # | |
Defined in Data.GraphViz.Attributes Methods toLabelValue :: Text -> Label Source # | |
ParseDot TextItem Source # | |
PrintDot TextItem Source # | |
Instances
Bounded Format Source # | |
Enum Format Source # | |
Defined in Data.GraphViz.Attributes.HTML Methods succ :: Format -> Format Source # pred :: Format -> Format Source # toEnum :: Int -> Format Source # fromEnum :: Format -> Int Source # enumFrom :: Format -> [Format] Source # enumFromThen :: Format -> Format -> [Format] Source # enumFromTo :: Format -> Format -> [Format] Source # enumFromThenTo :: Format -> Format -> Format -> [Format] Source # | |
Read Format Source # | |
Show Format Source # | |
Eq Format Source # | |
Ord Format Source # | |
Defined in Data.GraphViz.Attributes.HTML | |
ParseDot Format Source # | |
PrintDot Format Source # | |
A table in HTML-like labels. Tables are optionally wrapped in
overall FONT
tags.
Constructors
HTable | |
Fields
|
Constructors
Cells [Cell] | |
HorizontalRule | Should be between |
Cells either recursively contain another Label
or else a
path to an image file.
Constructors
LabelCell Attributes Label | |
ImgCell Attributes Img | |
VerticalRule | Should be between |
The path to an image; accepted Attributes
are Scale
and Src
.
Constructors
Img Attributes |
type Attributes = [Attribute] Source #
The various HTML-like label-specific attributes being used.
Note that not all Attribute
values are valid everywhere:
see the comments for each one on where it is valid.
Constructors
Align Align | |
BAlign Align | Valid for: |
BGColor Color | Valid for: |
Border Word8 | Valid for: |
CellBorder Word8 | Valid for: |
CellPadding Word8 | |
CellSpacing Word8 | |
Color Color | |
ColSpan Word16 | Valid for: |
Columns CellFormat | Valid for: |
Face Text | Valid for: |
FixedSize Bool | |
GradientAngle Int | Valid for: |
Height Word16 | |
HRef Text | |
ID Text | |
PointSize Double | Valid for: |
Port PortName | |
Rows CellFormat | Valid for: |
RowSpan Word16 | Valid for: |
Scale Scale | Valid for: |
Sides [Side] | Valid for: |
Src FilePath | Valid for: |
Style Style | |
Target Text | |
Title Text | |
VAlign VAlign | |
Width Word16 |
Instances
Read Attribute Source # | |
Show Attribute Source # | |
Eq Attribute Source # | |
Ord Attribute Source # | |
Defined in Data.GraphViz.Attributes.HTML | |
ParseDot Attribute Source # | |
PrintDot Attribute Source # | |
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.
Constructors
HLeft | |
HCenter | Default value. |
HRight | |
HText |
|
Instances
Bounded Align Source # | |
Enum Align Source # | |
Defined in Data.GraphViz.Attributes.HTML Methods succ :: Align -> Align Source # pred :: Align -> Align Source # toEnum :: Int -> Align Source # fromEnum :: Align -> Int Source # enumFrom :: Align -> [Align] Source # enumFromThen :: Align -> Align -> [Align] Source # enumFromTo :: Align -> Align -> [Align] Source # enumFromThenTo :: Align -> Align -> Align -> [Align] Source # | |
Read Align Source # | |
Show Align Source # | |
Eq Align Source # | |
Ord Align Source # | |
Defined in Data.GraphViz.Attributes.HTML | |
ParseDot Align Source # | |
PrintDot Align 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.
Instances
Bounded VAlign Source # | |
Enum VAlign Source # | |
Defined in Data.GraphViz.Attributes.HTML Methods succ :: VAlign -> VAlign Source # pred :: VAlign -> VAlign Source # toEnum :: Int -> VAlign Source # fromEnum :: VAlign -> Int Source # enumFrom :: VAlign -> [VAlign] Source # enumFromThen :: VAlign -> VAlign -> [VAlign] Source # enumFromTo :: VAlign -> VAlign -> [VAlign] Source # enumFromThenTo :: VAlign -> VAlign -> VAlign -> [VAlign] Source # | |
Read VAlign Source # | |
Show VAlign Source # | |
Eq VAlign Source # | |
Ord VAlign Source # | |
Defined in Data.GraphViz.Attributes.HTML | |
ParseDot VAlign Source # | |
PrintDot VAlign Source # | |
data CellFormat Source #
Constructors
RuleBetween |
Instances
Specifies how an image will use any extra space available in its
cell. If undefined, the image inherits the value of the
ImageScale
attribute.
Constructors
NaturalSize | Default value. |
ScaleUniformly | |
ExpandWidth | |
ExpandHeight | |
ExpandBoth |
Instances
Bounded Scale Source # | |
Enum Scale Source # | |
Defined in Data.GraphViz.Attributes.HTML Methods succ :: Scale -> Scale Source # pred :: Scale -> Scale Source # toEnum :: Int -> Scale Source # fromEnum :: Scale -> Int Source # enumFrom :: Scale -> [Scale] Source # enumFromThen :: Scale -> Scale -> [Scale] Source # enumFromTo :: Scale -> Scale -> [Scale] Source # enumFromThenTo :: Scale -> Scale -> Scale -> [Scale] Source # | |
Read Scale Source # | |
Show Scale Source # | |
Eq Scale Source # | |
Ord Scale Source # | |
Defined in Data.GraphViz.Attributes.HTML | |
ParseDot Scale Source # | |
PrintDot Scale Source # | |
Which sides of a border in a cell or table should be drawn, if a border is drawn.
Constructors
LeftSide | |
RightSide | |
TopSide | |
BottomSide |
Instances
Bounded Side Source # | |
Enum Side Source # | |
Read Side Source # | |
Show Side Source # | |
Eq Side Source # | |
Ord Side Source # | |
Defined in Data.GraphViz.Attributes.HTML | |
ParseDot Side Source # | |
PrintDot Side Source # | |
Instances
Bounded Style Source # | |
Enum Style Source # | |
Defined in Data.GraphViz.Attributes.HTML Methods succ :: Style -> Style Source # pred :: Style -> Style Source # toEnum :: Int -> Style Source # fromEnum :: Style -> Int Source # enumFrom :: Style -> [Style] Source # enumFromThen :: Style -> Style -> [Style] Source # enumFromTo :: Style -> Style -> [Style] Source # enumFromThenTo :: Style -> Style -> Style -> [Style] Source # | |
Read Style Source # | |
Show Style Source # | |
Eq Style Source # | |
Ord Style Source # | |
Defined in Data.GraphViz.Attributes.HTML | |
ParseDot Style Source # | |
PrintDot Style Source # | |