| Copyright | (c) 2015 Jeffrey Rosenbluth |
|---|---|
| License | BSD-style (see LICENSE) |
| Maintainer | diagrams-discuss@googlegroups.com |
| Safe Haskell | None |
| Language | Haskell2010 |
Diagrams.Backend.Html5.CmdLine
Description
Convenient creation of command-line-driven executables for rendering diagrams using the Html5 backend.
defaultMaincreates an executable which can render a single diagram at various options.multiMainis likedefaultMainbut allows for a list of diagrams from which the user can choose one to render.mainWithis a generic form that does all of the above but with a slightly scarier type. See Diagrams.Backend.CmdLine. This form can also take a function type that has a suitable final result (any of arguments to the above types) andParseablearguments.
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.
- Use a function with
mainWith. This may require makingParseableinstances for custom argument types. - Make a new
Mainableinstance. This may require a newtype wrapper on your diagram type to avoid the existing instances. This gives you more control over argument parsing, intervening steps, and diagram creation. - Build option records and pass them along with a diagram to
mainRenderfrom Diagrams.Backend.CmdLine.
For a tutorial on command-line diagram creation see http://projects.haskell.org/diagrams/doc/cmdline.html.
General form of main
mainWith :: (Mainable d, Parseable (MainOpts d)) => d -> IO ()
Main entry point for command-line diagram creation. This is the method that users will call from their program main. For instance an expected user program would take the following form.
import Diagrams.Prelude import Diagrams.Backend.TheBestBackend.CmdLine d :: Diagram B R2 d = ... main = mainWith d
Most backends should be able to use the default implementation. A different implementation should be used to handle more complex interactions with the user.
Supported froms of main
This data declaration is simply used as a token to distinguish this rendering engine.
Instances
| Eq Html5 Source | |
| Ord Html5 Source | |
| Read Html5 Source | |
| Show Html5 Source | |
| Backend Html5 V2 Double Source | |
| Renderable (Text Double) Html5 Source | |
| Renderable (DImage Double External) Html5 Source | |
| Renderable (Path V2 Double) Html5 Source | |
| Renderable (Trail V2 Double) Html5 Source | |
| Monoid (Render Html5 V2 Double) Source | |
| Renderable (Segment Closed V2 Double) Html5 Source | |
| type V Html5 = V2 Source | |
| type N Html5 = Double Source | |
data Options Html5 V2 Double = Html5Options {
| |
| type Result Html5 V2 Double = Builder Source | |
| data Render Html5 V2 Double = C (RenderM ()) Source | |
| type MainOpts [(String, QDiagram Html5 V2 Double Any)] = (MainOpts (QDiagram Html5 V2 Double Any), DiagramMultiOpts) | |
| type MainOpts (QDiagram Html5 V2 Double Any) = DiagramOpts |