Copyright | (c) Ivan Lazar Miljenovic 2009 |
---|---|
License | 2-Clause BSD |
Maintainer | Ivan.Miljenovic@gmail.com |
Safe Haskell | None |
Language | Haskell98 |
This module defines the report framework used.
- data Document = Doc {}
- class DocumentGenerator dg where
- data Location
- data DocElement
- = Section DocInline [DocElement]
- | Paragraph [DocInline]
- | Enumeration [DocElement]
- | Itemized [DocElement]
- | Definitions [(DocInline, DocInline)]
- | GraphImage DocGraph
- data DocInline
- data GraphSize
- data DocGraph = DG {}
- data VisParams = VParams {}
- data VisProperties = VProps {}
- addLegend :: FilePath -> FilePath -> VisProperties -> Document -> IO Document
- today :: IO String
- tryCreateDirectory :: FilePath -> IO Bool
- createGraph :: VisParams -> DocGraph -> IO DocElement
- createSize :: Double -> GraphSize
- unDotPath :: FilePath -> FilePath
Document representation
Document
is the simplified representation of a document. Note
that this just specifies a document layout, and not an
implementation. To actually create a "physical" document,
you must use an instance of DocumentGenerator
.
Representation of a document. The document is to be stored in
the directory rootDirectory
, and the main file is to have a
filename of
, where fileFront
<.>
(docExtension
dg)dg
is an
instance of DocumentGenerator
.
Doc | |
|
class DocumentGenerator dg where Source #
Represents the class of document generators.
createDocument :: dg -> Document -> IO (Maybe FilePath) Source #
Convert idealised Document
values into actual documents,
returning the document file created.
docExtension :: dg -> String Source #
The extension of all document-style files created. Note that this doesn't preclude the creation of other files, e.g. images.
Representation of a location, either on the internet or locally.
data DocElement Source #
Elements of a document.
Inline elements of a document.
Specify the size the DotGraph
should be at.
GivenSize GraphSize | Specify the maximum size to use. |
DefaultSize | Let GraphViz choose an appropriate size. |
Specify the DotGraph
to turn into an image, its filename (sans
extension) and its caption. The DotGraph
should not have a
Size
set.
Defines the parameters used for creating visualisations of graphs.
VParams | |
|
data VisProperties Source #
A specification on how to visualise a DocGraph
.
Helper functions
Utility functions to help with document creation.
addLegend :: FilePath -> FilePath -> VisProperties -> Document -> IO Document Source #
Create the legend section and add it to the document proper.
Return today's date as a string, e.g. "Monday 1 January, 2000". This arbitrary format is chosen as there doesn't seem to be a way of determining the correct format as per the user's locale settings.
tryCreateDirectory :: FilePath -> IO Bool Source #
Attempts to create the specified directly, returning True
if successful (or if the directory already exists), False
if an error occurred.
:: VisParams | Visualisation parameters. |
-> DocGraph | |
-> IO DocElement |
Attempts to create image files (with the given filename in the
given directory) from the graph. If the second VisProperties
not Nothing
, then the first image links to the second. The
whole result is wrapped in a Paragraph
. unDotPath
is applied
to the filename in the DocGraph
.
If saveDot
is true, then it is assumed that the format
isn't
Canon
, DotOutput
or XDot
(because of filename clashes).
createSize :: Double -> GraphSize Source #
Using a 6:4 ratio, create the given Point
representing
width,height from the width.