| Copyright | (c) Brent Yorgey 2012-2013 |
|---|---|
| License | BSD-style (see LICENSE) |
| Maintainer | Brent Yorgey <byorgey@gmail.com> |
| Safe Haskell | None |
| Language | Haskell2010 |
Text.BlogLiterately.Diagrams
Description
Custom transformation passes for the BlogLiterately blog-writing
tool (http://hackage.haskell.org/package/BlogLiterately),
allowing inclusion of inline code using the diagrams framework
(http://projects.haskell.org/diagrams) which are compiled into
images. See Text.BlogLiterately.Run for more information.
Note that this package provides an executable, BlogLiteratelyD,
which compiles embedded diagrams code as well as all the standard
transforms provided by BlogLiterately.
Documentation
diagramsXF :: Transform Source #
Transform a blog post by looking for code blocks with class
dia, and replacing them with images generated by evaluating the
identifier dia and rendering the resulting diagram. In
addition, blocks with class dia-def are collected (and deleted
from the output) and provided as additional definitions that will
be in scope during evaluation of all dia blocks.
Be sure to use this transform before the standard
highlightXF transform, i.e.
with the blogLiteratelyCustom function.
For example,
main = blogLiteratelyCustom (diagramsXF : standardTransforms)
It also works well in conjunction with
centerImagesXF (which, of course,
should be placed after diagramsXF in the pipeline). This
package provides an executable BlogLiteratelyD which
includes diagramsInlineXF, diagramsXF, and centerImagesXF.
diagramsInlineXF :: Transform Source #
Transform a blog post by looking for inline code snippets with
class dia, and replacing them with images generated by
evaluating the contents of each code snippet as a Haskell
expression representing a diagram. Any code blocks with class
dia-def will be in scope for the evaluation of these
expressions (such code blocks are unaffected).
Because diagramsXF and diagramsInlineXF both use blocks with
class dia-def, but diagramsInlineXF leaves them alone whereas
diagramsXF deletes them, diagramsInlineXF must be placed
before diagramsXF in the pipeline.