147 lines
4.3 KiB
Plaintext
147 lines
4.3 KiB
Plaintext
|
-- Hoogle documentation, generated by Haddock
|
||
|
-- See Hoogle, http://www.haskell.org/hoogle/
|
||
|
|
||
|
|
||
|
@package pandoc-slide-filter
|
||
|
@version 0.1.0.0
|
||
|
|
||
|
module Text.Pandoc.Util.Filter.Quiz
|
||
|
quiz :: Block -> [Block]
|
||
|
|
||
|
module Text.Pandoc.Util.Filter
|
||
|
|
||
|
-- | converts Attributes to String for usage in HTML
|
||
|
--
|
||
|
-- Also converts <tt>width=xxx</tt> and <tt>height=xxx</tt> to the
|
||
|
-- corresponding style-attributes
|
||
|
attToString :: Attr -> String
|
||
|
|
||
|
-- | helper function for <a>attToString</a>, but can also be used if you
|
||
|
-- want to extract styles from kv-pair
|
||
|
convertToStyle :: [String] -> [(String, String)] -> [(String, String)]
|
||
|
|
||
|
-- | revealjs has some special attributes that has to be passed to the
|
||
|
-- html, but Pandoc only allows <tt>key=value</tt>-attributes, so we have
|
||
|
-- to abuse <tt>.class</tt> to rewrite them.
|
||
|
--
|
||
|
-- The classes that get rewritten are listed here.
|
||
|
--
|
||
|
-- You probably want <a>classToRevealAttr</a>, as that is a wrapper for
|
||
|
-- splitting the class-attribute
|
||
|
revealjsSpecialAttrs :: [String]
|
||
|
|
||
|
-- | HTML allows for some attributes (i.e. autoplay) for which revealjs
|
||
|
-- offers a special version (i.e. only autoplaying on active slide).
|
||
|
-- These are the things that get rewritten
|
||
|
revealjsRewriteAttr :: [String] -> [String]
|
||
|
|
||
|
-- | revealjs has some special attributes that has to be passed to the
|
||
|
-- html, but Pandoc only allows <tt>key=value</tt>-attributes, so we have
|
||
|
-- to abuse <tt>.class</tt> to rewrite them.
|
||
|
--
|
||
|
-- This is a wrapper-function which just splits the list into real
|
||
|
-- classes and <a>revealjsSpecialAttrs</a>
|
||
|
classToRevealAttr :: [String] -> ([String], [String])
|
||
|
|
||
|
-- | small wrapper around <tt>RawInline (Format "html")</tt> as this is
|
||
|
-- less line-noise in the filters and the intent is more clear.
|
||
|
toHtml :: String -> Inline
|
||
|
|
||
|
-- | small wrapper around <tt>Raw (Format "html")</tt> as this is less
|
||
|
-- line-noise in the filters and the intent is more clear.
|
||
|
toBlockHtml :: String -> Block
|
||
|
|
||
|
-- | adds a given String to the list if not in there; Does nothing if the
|
||
|
-- given String is already present.
|
||
|
addToAtt :: Eq a => a -> [a] -> [a]
|
||
|
|
||
|
-- | adds given String to List of key-value-pairs (like in <a>Attr</a>) in
|
||
|
-- the "style"-Key.
|
||
|
--
|
||
|
-- Useful when trying to add CSS-styles directly to (generated) elements
|
||
|
addToStyle :: String -> [(String, String)] -> [(String, String)]
|
||
|
|
||
|
|
||
|
-- | Conversion of lvl-x-headings to x-column-layouts in HTML especially
|
||
|
-- for use in revealjs-slides
|
||
|
module Text.Pandoc.Util.Filter.Cols
|
||
|
|
||
|
-- | This filter makes multi-column-layouts out of lvl-x-headings
|
||
|
--
|
||
|
-- Syntax is
|
||
|
--
|
||
|
-- <pre>
|
||
|
-- ## a b
|
||
|
-- </pre>
|
||
|
--
|
||
|
-- yielding a 2-column-layout with aspects a:b i.e. 1:1 for 50/50-layout
|
||
|
-- or 8:2 for 80/20 layout
|
||
|
--
|
||
|
-- currently works for 2 and 3-columns, but extension is
|
||
|
-- straight-forward.
|
||
|
--
|
||
|
-- If you need multiple Block-Elements inside one column, just wrap them
|
||
|
-- with a <tt><div></tt>:
|
||
|
--
|
||
|
-- <pre>
|
||
|
-- ## 2 5
|
||
|
--
|
||
|
-- <div>
|
||
|
-- multiple things
|
||
|
-- ```
|
||
|
-- foo
|
||
|
-- ```
|
||
|
--
|
||
|
-- </div>
|
||
|
--
|
||
|
-- second column here with only 1 element.
|
||
|
-- </pre>
|
||
|
cols :: [Block] -> [Block]
|
||
|
|
||
|
module Text.Pandoc.Util.Filter.Media
|
||
|
|
||
|
-- | main media-plugin.
|
||
|
--
|
||
|
-- Will convert the following syntax
|
||
|
--
|
||
|
-- <pre>
|
||
|
-- ![](foo.aac){#audio}
|
||
|
-- ![](foo.mp4){#video}
|
||
|
-- ![](foo.png){#img}
|
||
|
-- ![](foo.svg){#svg}
|
||
|
-- ![](foo.html){#demo}
|
||
|
-- </pre>
|
||
|
--
|
||
|
-- HTML-id's maybe ommitted if the file-extension is in whitelist.
|
||
|
--
|
||
|
-- If a type is detected by extension a custom id (not matching the
|
||
|
-- extension) will be preserved.
|
||
|
media :: Inline -> IO [Inline]
|
||
|
|
||
|
module Text.Pandoc.Util.Filter.Styling
|
||
|
|
||
|
-- | Block-Styling
|
||
|
--
|
||
|
-- Special cases captured:
|
||
|
--
|
||
|
-- <ul>
|
||
|
-- <li>#col turns a div into a floating-div for multiple columns</li>
|
||
|
-- <li>CodeBlock gets attributes <tt>data-trim</tt> and
|
||
|
-- <tt>data-noescape</tt> automatically</li>
|
||
|
-- <li>.fragment and .frame work properly on divs</li>
|
||
|
-- </ul>
|
||
|
styling :: Block -> IO [Block]
|
||
|
|
||
|
-- | Inline-Styling
|
||
|
--
|
||
|
-- Special cases captured:
|
||
|
--
|
||
|
-- <ul>
|
||
|
-- <li>.fragment and .frame work properly on spans</li>
|
||
|
-- <li>.vspace inside span adds a vertical space with
|
||
|
-- <tt>height=xxx</tt></li>
|
||
|
-- <li>.hspace inside span adds a horizontal space with
|
||
|
-- <tt>width=xxx</tt></li>
|
||
|
-- </ul>
|
||
|
inlineStyling :: Inline -> Inline
|