Graphalyze-0.8.0.0: Graph-Theoretic Analysis library.Source codeContentsIndex
Data.Graph.Analysis.Reporting
MaintainerIvan.Miljenovic@gmail.com
Contents
Document representation
Helper functions
Description
This module defines the report framework used.
Synopsis
data Document = Doc {
rootDirectory :: FilePath
fileFront :: String
graphDirectory :: FilePath
title :: DocInline
author :: String
date :: String
legend :: [(DocGraph, DocInline)]
content :: [DocElement]
}
class DocumentGenerator dg where
createDocument :: dg -> Document -> IO (Maybe FilePath)
docExtension :: dg -> String
data Location
= Web String
| File FilePath
data DocElement
= Section DocInline [DocElement]
| Paragraph [DocInline]
| Enumeration [DocElement]
| Itemized [DocElement]
| Definitions [(DocInline, DocInline)]
| GraphImage DocGraph
data DocInline
= Text String
| BlankSpace
| Grouping [DocInline]
| Bold DocInline
| Emphasis DocInline
| DocLink DocInline Location
| DocImage DocInline Location
data GraphSize
= GivenSize Point
| DefaultSize
type DocGraph = (FilePath, DocInline, DotGraph Node)
addLegend :: FilePath -> FilePath -> Document -> IO Document
today :: IO String
tryCreateDirectory :: FilePath -> IO Bool
createGraph :: FilePath -> FilePath -> GraphSize -> Maybe GraphSize -> DocGraph -> IO (Maybe 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.
data Document Source
Representation of a document. The document is to be stored in the directory rootDirectory, and the main file is to have a filename of fileFront <.> (docExtension dg), where dg is an instance of DocumentGenerator.
Constructors
Doc
rootDirectory :: FilePathDocument location
fileFront :: String
graphDirectory :: FilePathThe sub-directory of rootDirectory, where graphs are to be created.
title :: DocInlinePre-matter
author :: String
date :: String
legend :: [(DocGraph, DocInline)]Main-matter
content :: [DocElement]
class DocumentGenerator dg whereSource
Represents the class of document generators.
Methods
createDocument :: dg -> Document -> IO (Maybe FilePath)Source
Convert idealised Document values into actual documents, returning the document file created.
docExtension :: dg -> StringSource
The extension of all document-style files created. Note that this doesn't preclude the creation of other files, e.g. images.
show/hide Instances
data Location Source
Representation of a location, either on the internet or locally.
Constructors
Web String
File FilePath
show/hide Instances
data DocElement Source
Elements of a document.
Constructors
Section DocInline [DocElement]
Paragraph [DocInline]
Enumeration [DocElement]
Itemized [DocElement]
Definitions [(DocInline, DocInline)]
GraphImage DocGraph
data DocInline Source
Inline elements of a document.
Constructors
Text String
BlankSpace
Grouping [DocInline]
Bold DocInline
Emphasis DocInline
DocLink DocInline Location
DocImage DocInline Location
data GraphSize Source
Specify the size the DotGraph should be at.
Constructors
GivenSize PointSpecify the size to use.
DefaultSizeLet GraphViz choose an appropriate size.
type DocGraph = (FilePath, DocInline, DotGraph Node)Source
Specify the DotGraph to turn into an image, its filename (sans extension) and its caption. The DotGraph should not have a Size set.
Helper functions
Utility functions to help with document creation.
addLegend :: FilePath -> FilePath -> Document -> IO DocumentSource
Create the legend section and add it to the document proper.
today :: IO StringSource
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 BoolSource
Attempts to create the specified directly, returning True if successful (or if the directory already exists), False if an error occurred.
createGraph :: FilePath -> FilePath -> GraphSize -> Maybe GraphSize -> DocGraph -> IO (Maybe DocElement)Source
Attempts to creates a png file (with the given filename in the given directory) from the graph using the given attributes. If the second set of attributes is not Nothing, then the first image links to the second. The whole result is wrapped in a Paragraph.
createSize :: Double -> GraphSizeSource
Using a 6:4 ratio, create the given Point representing width,height from the width.
unDotPath :: FilePath -> FilePathSource
Replace all . with - in the given FilePath, since some output formats (e.g. LaTeX) don't like extraneous .'s in the filename.
Produced by Haddock version 2.4.2