Slides 0.1.0.2 → 0.1.0.3
raw patch · 3 files changed
+23/−17 lines, 3 files
Files
- Slides.cabal +1/−1
- src/Slides/Common.hs +14/−14
- src/Slides/Presentation.hs +8/−2
Slides.cabal view
@@ -1,5 +1,5 @@ name: Slides -version: 0.1.0.2 +version: 0.1.0.3 synopsis: Generate slides from Haskell code description: Make presentations in Haskell with diagrams license: MIT
src/Slides/Common.hs view
@@ -19,46 +19,46 @@ | Immediate deriving (Eq, Show) --- | The outmost type. Holds slides and styling. +-- | The outermost type. Holds slides and styling. data Presentation = Presentation { slides :: [Slide] , style :: Style - -- | A plain string that will be put into the <head> before everything else. + -- | A plain string that will be put into the \<head> before everything else. , baseHead :: String } --- | The outmost type of a single slide. Holds content nodes. +-- | The outermost type of a single slide. Holds content nodes. newtype Slide = Slide { nodes :: [ContentNode] } -- | The main type in the presentaion. Describes all the possible kinds of content. data ContentNode - -- | Generates a <hN> tag where the N is the first argument. + -- | Generates a \<hN> tag where the N is the first argument. = Header Int String -- | Generates an unordered list that's immediately displayed. | List [ContentNode] -- | A plain text node. | Text String - -- | Generates a <br /> tag. A new line. + -- | Generates a \<br /> tag. A new line. | Break - -- | Generates a SVG tag with the specified width and height and string contents. + -- | Generates an SVG tag with the specified width and height and string contents. | RawSVG Int Int String - -- | Generates a SVG element from a given height and a Diagram + -- | Generates an SVG tag from a given height and a Diagram | Diagram Int (Diagram SVG) -- | Generates a list of elements where each element is delayed. The Eagerness parameter - -- | determines whether the list will immediately display the first element. + -- determines whether the list will immediately display the first element. | UnfoldList Eagerness [ContentNode] -- | Generates elements in sequence with the next one REPLACING the previous one. The Eagerness - -- | parameter determines whether the first element in sequence will be immediately displayed. + -- parameter determines whether the first element in sequence will be immediately displayed. | Sequence Eagerness [ContentNode] -- | Generates a 'list' of elements. The elements themselves are not wrapped in anything, - -- | unlike in a normal list where they're wrapped in <li> tags, just concatinated together. + -- unlike in a normal list where they're wrapped in \<li> tags, just concatinated together. | ConcatList [ContentNode] -- | The same as ConcatList with the display behavior of UnfoldList | UnfoldConcatList Eagerness [ContentNode] --- | Rudamentary support for styling +-- | Rudimentary support for styling data Style = Style - -- | Pairs of selectors that determine what kind of elements to apply the style to and the - -- | styles themselves. - { selectors :: [(Selector, ElementStyle)] + { -- | Pairs of selectors that determine what kind of elements to apply the style to and the + -- | styles themselves. + selectors :: [(Selector, ElementStyle)] , baseCss :: String } deriving (Eq, Show, Read)
src/Slides/Presentation.hs view
@@ -1,4 +1,10 @@ {-# LANGUAGE RecordWildCards, OverloadedStrings #-} +-- | To use this package you need to construct a Presentation tree using the types and constructors +-- from the Slides.Common module (re-exported from this one). Then call one of the functions +-- bellow. +-- The generated HTML will not look like a presentation when you open it up in a browser, but +-- it has CSS guides in place that will split it up into pages property when you print it. +-- Good default settings are A3-Landscape. You can just print to PDF to get the actual presentation. module Slides.Presentation ( renderPresentation, writeToFile, module Slides.Common ) where @@ -54,10 +60,10 @@ instance IsString ContentNode where fromString = inlineMarkdown --- | Render the Presentation to a HTML string. +-- | Render the Presentation to an HTML string. renderPresentation :: Presentation -> String renderPresentation = render --- | Render a Presentation to a HTML file with UTF8 encoding. +-- | Render a Presentation to an HTML file with UTF8 encoding. writeToFile :: FilePath -> Presentation -> IO () writeToFile path = UTF8.writeFile path . render