diagrams-svg-0.8.0.2: SVG backend for diagrams drawing EDSL.

Maintainer | diagrams-discuss@googlegroups.com
Safe Haskell | None

Diagrams.Backend.SVG.CmdLine

Description

Convenient creation of command-line-driven executables for rendering diagrams using the SVG backend.

- `defaultMain` creates an executable which can render a single diagram at various options.
- `multiMain` is like `defaultMain` but allows for a list of diagrams from which the user can choose one to render.

If you want to generate diagrams programmatically---i.e. if you want to do anything more complex than what the below functions provide---you have several options.

- A simple but somewhat inflexible approach is to wrap up `defaultMain` (or `multiMain`) in a call to `withArgs`.
- You can use `renderSVG` to render a diagram to a file directly; see Diagrams.Backend.SVG.
- A more flexible approach is to directly call `renderDia`; see Diagrams.Backend.SVG for more information.

Synopsis

- defaultMain :: Diagram SVG R2 -> IO ()
- multiMain :: [(String, Diagram SVG R2)] -> IO ()
- data SVG

# Documentation

defaultMain :: Diagram SVG R2 -> IO ()Source

This is the simplest way to render diagrams, and is intended to be used like so:

     ... definitions ...

     main = defaultMain myDiagram

Compiling this file will result in an executable which takes various command-line options for setting the size, output file, and so on, and renders `myDiagram` with the specified options.

Pass `--help` to the generated executable to see all available options.

multiMain :: [(String, Diagram SVG R2)] -> IO ()Source

`multiMain` is like `defaultMain`, except instead of a single diagram it takes a list of diagrams paired with names as input. The generated executable then takes an argument specifying the name of the diagram that should be rendered. This is a convenient way to create an executable that can render many different diagrams without modifying the source code in between each one.

data SVG Source

`SVG` is simply a token used to identify this rendering backend (to aid type inference).

Instances

Show SVG |
Typeable SVG |
Backend SVG R2 |
Renderable Text SVG |
Renderable (Path R2) SVG |
Renderable (Trail R2) SVG |
Show (Options SVG R2) |
Monoid (Render SVG R2) |
Renderable (Segment Closed R2) SVG |