Created library instead of binaries. Added doc.
- Split things into Library and Binary - Library has all functionality - Binarys are just wrapper like "main = toJsonFilter foo" - Documented most things - Created haddock-documentation - added documentation to repository
This commit is contained in:
parent
e30e18b5dc
commit
8376d6298b
6
TODO.md
Normal file
6
TODO.md
Normal file
@ -0,0 +1,6 @@
|
||||
|
||||
- fragments in figure-Umgebung
|
||||
- svg per default als img
|
||||
- done
|
||||
- reveal hat speziell html-attribute => herausfinden und in direct-controls rein
|
||||
- in utils ~> müssen noch überall angepasst werden.
|
@ -2,9 +2,6 @@
|
||||
{-# LANGUAGE ScopedTypeVariables #-}
|
||||
|
||||
import Text.Pandoc.JSON
|
||||
import Control.Exception
|
||||
import Data.Monoid ((<>))
|
||||
import Data.List (partition, isInfixOf)
|
||||
|
||||
main :: IO ()
|
||||
main = toJSONFilter clean
|
||||
|
77
app/Cols.hs
77
app/Cols.hs
@ -1,82 +1,9 @@
|
||||
#!/usr/bin/env runhaskell
|
||||
{-# LANGUAGE ScopedTypeVariables #-}
|
||||
|
||||
import Text.Pandoc.JSON
|
||||
import Text.Pandoc.Definition
|
||||
import Text.Pandoc.Generic (topDown)
|
||||
import Control.Exception
|
||||
import Data.Monoid ((<>))
|
||||
import Data.List (partition, elem)
|
||||
import System.FilePath
|
||||
import Debug.Trace (trace)
|
||||
import Text.Read (readMaybe)
|
||||
import Data.Maybe (fromMaybe)
|
||||
|
||||
import Text.Pandoc.Util.Filter.Cols
|
||||
|
||||
main :: IO ()
|
||||
main = toJSONFilter (topDown cols :: Pandoc -> Pandoc)
|
||||
|
||||
|
||||
-- | This filter makes multi-column-layouts out of lvl-x-headings
|
||||
--
|
||||
-- Syntax is
|
||||
--
|
||||
-- ## a b
|
||||
--
|
||||
-- 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 <div>:
|
||||
--
|
||||
-- ## 2 5
|
||||
--
|
||||
-- <div>
|
||||
-- multiple things
|
||||
-- ```
|
||||
-- foo
|
||||
-- ```
|
||||
-- ![image](...)
|
||||
-- </div>
|
||||
--
|
||||
-- second column here with only 1 element.
|
||||
--
|
||||
cols :: [Block] -> [Block]
|
||||
cols (h@(Header 2 attr [Str wa,Space,Str wb]):a:b:rest) =
|
||||
outerDiv:rest
|
||||
where
|
||||
wa' = fromMaybe 1 (readMaybe wa) :: Int
|
||||
wb' = fromMaybe 1 (readMaybe wb) :: Int
|
||||
total = wa' + wb'
|
||||
pa = (100*wa') `div` total
|
||||
pb = (100*wb') `div` total
|
||||
outerDiv = Div attr [ makeDiv pa a
|
||||
, makeDiv pb b
|
||||
, clearDiv
|
||||
]
|
||||
cols (h@(Header 3 attr [Str wa,Space,Str wb,Space,Str wc]):a:b:c:rest) =
|
||||
outerDiv:rest
|
||||
where
|
||||
wa' = fromMaybe 1 (readMaybe wa) :: Int
|
||||
wb' = fromMaybe 1 (readMaybe wb) :: Int
|
||||
wc' = fromMaybe 1 (readMaybe wc) :: Int
|
||||
total = wa' + wb' + wc'
|
||||
pa = (100*wa') `div` total
|
||||
pb = (100*wb') `div` total
|
||||
pc = (100*wc') `div` total
|
||||
outerDiv = Div attr [ makeDiv pa a
|
||||
, makeDiv pb b
|
||||
, makeDiv pc c
|
||||
, clearDiv
|
||||
]
|
||||
cols x = x
|
||||
|
||||
makeDiv :: Int -> Block -> Block
|
||||
makeDiv width content = Div ("", [], [("style","width:" <> show width <> "%;float:left")]) [content]
|
||||
|
||||
clearDiv :: Block
|
||||
clearDiv = Div ("", [], [("style", "clear: both")]) [Plain [toHtml " "]]
|
||||
|
||||
toHtml :: String -> Inline
|
||||
toHtml = RawInline (Format "html")
|
||||
|
180
app/Media.hs
180
app/Media.hs
@ -1,184 +1,6 @@
|
||||
#!/usr/bin/env runhaskell
|
||||
{-# LANGUAGE ScopedTypeVariables #-}
|
||||
|
||||
import Text.Pandoc.Util.Filter.Media
|
||||
import Text.Pandoc.JSON
|
||||
import Control.Exception
|
||||
import Data.Monoid ((<>))
|
||||
import Data.List (partition, elem)
|
||||
import Data.Char (toLower)
|
||||
import System.FilePath
|
||||
|
||||
main :: IO ()
|
||||
main = toJSONFilter media
|
||||
|
||||
-- | File-extensions that should be treated as audio
|
||||
audioExt :: [String]
|
||||
audioExt = ["mp3","aac"]
|
||||
|
||||
-- | File-extensions that should be treated as video
|
||||
videoExt :: [String]
|
||||
videoExt = [ "avi"
|
||||
, "mp4"
|
||||
, "mov"
|
||||
]
|
||||
|
||||
-- | File-extensions that should be treated as image
|
||||
imgExt :: [String]
|
||||
imgExt =
|
||||
[ "jpg"
|
||||
, "jpeg"
|
||||
, "png"
|
||||
, "gif"
|
||||
, "tif"
|
||||
, "tiff"
|
||||
, "bmp"
|
||||
]
|
||||
|
||||
-- | File-extensions that should be treated as demo and will be included
|
||||
-- in an iframe
|
||||
demoExt :: [String]
|
||||
demoExt = ["html", "htm"]
|
||||
|
||||
-- | main media-plugin.
|
||||
--
|
||||
-- Will convert the following syntax
|
||||
--
|
||||
--
|
||||
-- - `![](foo.aac){#audio}`
|
||||
-- - `![](foo.mp4){#video}`
|
||||
-- - `![](foo.png){#img}`
|
||||
-- - `![](foo.svg){#svg}`
|
||||
-- - `![](foo.html){#demo}`
|
||||
--
|
||||
-- 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]
|
||||
--audio
|
||||
media (Image (id',att,att') [] (filename,_))
|
||||
| id' == "audio" || (checkExtension filename audioExt)
|
||||
= return $ [toHtml $ "<audio " <> unwords direct <> " src=\"" <> filename <> "\"" <> attToString (idFilter "audio" id',css,att') <> "></audio>"]
|
||||
where
|
||||
(direct, css) = classToPlain att
|
||||
media (Image (id',att,att') alt (filename,_))
|
||||
| id' == "audio" || (checkExtension filename audioExt)
|
||||
= return $ [toHtml $ "<figure><audio " <> unwords direct <> " src=\"" <> filename <> "\"" <> attToString (idFilter "audio" id',css,att') <> "></audio>"]
|
||||
++ [toHtml $ "<figcaption>"]
|
||||
++ alt
|
||||
++ [toHtml $ "</figcaption></figure>"]
|
||||
where
|
||||
(direct, css) = classToPlain att
|
||||
--videos
|
||||
media (Image (id', att, att') [] (filename,_))
|
||||
| id' == "video" || (checkExtension filename videoExt)
|
||||
= return $ [toHtml $ "<video " <> unwords direct <> " src=\"" <> filename <> "\"" <> attToString (idFilter "video" id',css,att') <> "></video>"]
|
||||
where
|
||||
(direct, css) = classToPlain att
|
||||
media (Image (id', att, att') alt (filename,_))
|
||||
| id' == "video" || (checkExtension filename videoExt)
|
||||
= return $ [toHtml $ "<figure>"]
|
||||
++ [toHtml $ "<video " <> unwords direct <> " src=\"" <> filename <> "\"" <> attToString (idFilter "video" id',css,att') <> "></video>"]
|
||||
++ [toHtml $ "<figcaption>"]
|
||||
++ alt
|
||||
++ [toHtml $ "</figcaption></figure>"]
|
||||
where
|
||||
(direct, css) = classToPlain att
|
||||
--images
|
||||
media (Image (id', att, att') [] (filename,_))
|
||||
| id' == "img" || (checkExtension filename imgExt)
|
||||
= return $ [toHtml $ "<figure>"]
|
||||
++ [toHtml $ "<img " <> unwords direct <> " src=\"" <> filename <> "\"" <> attToString (idFilter "img" id',css,att') <> "></img>"]
|
||||
++ [toHtml $ "</figure>"]
|
||||
where
|
||||
(direct, css) = classToPlain att
|
||||
media (Image (id', att, att') alt (filename,_))
|
||||
| id' == "img" || (checkExtension filename imgExt)
|
||||
= return $ [toHtml $ "<figure>"]
|
||||
++ [toHtml $ "<img " <> unwords direct <> " src=\"" <> filename <> "\"" <> attToString (idFilter "img" id',css,att') <> "></img>"]
|
||||
++ [toHtml $ "<figcaption>"]
|
||||
++ alt
|
||||
++ [toHtml $ "</figcaption></figure>"]
|
||||
where
|
||||
(direct, css) = classToPlain att
|
||||
--load svg and dump it in
|
||||
media (Image (id', att, att') [] (filename,_))
|
||||
| id' == "svg" || (checkExtension filename ["svg"])
|
||||
= handle (\(fileerror :: IOException) -> return [toHtml $ "Could not read file: " <> filename <> "<br />" <> show fileerror]) $
|
||||
do
|
||||
svg <- readFile filename
|
||||
return $ [toHtml $ "<figure " <> unwords direct <> " " <> attToString (idFilter "svg" id', css, att') <> ">"] -- use attributes on figure, as svg gets dumped in..
|
||||
++ [toHtml $ svg]
|
||||
++ [toHtml $ "</figure>"]
|
||||
where
|
||||
(direct, css) = classToPlain att
|
||||
media (Image (id', att, att') alt (filename,_))
|
||||
| id' == "svg" || (checkExtension filename ["svg"])
|
||||
= handle (\(fileerror :: IOException) -> return $ [toHtml $ "Could not read file: " <> filename <> "<br />" <> show filename]) $
|
||||
do
|
||||
svg <- readFile filename
|
||||
return $ [toHtml $ "<figure " <> unwords direct <> " " <> attToString (idFilter "svg" id', css, att') <> ">"] -- use attributes on figure, as svg gets dumped in..
|
||||
++ [toHtml $ svg]
|
||||
++ [toHtml $ "<figcaption>"]
|
||||
++ alt
|
||||
++ [toHtml $ "</figcaption></figure>"]
|
||||
where
|
||||
(direct, css) = classToPlain att
|
||||
--html-demos etc. as IFrames
|
||||
media (Image (id', att, att') [] (filename,_))
|
||||
| id' == "demo" || (checkExtension filename demoExt)
|
||||
= return $ [toHtml $ "<iframe " <> unwords direct <> " src=\"" <> filename <> "?plugin\"" <> attToString (idFilter "demo" id', css, att') <> "></iframe>"]
|
||||
where
|
||||
(direct, css) = classToPlain att
|
||||
media (Image (id', att, att') alt (filename,_))
|
||||
| id' == "demo" || (checkExtension filename demoExt)
|
||||
= return $ [toHtml $ "<figure>"]
|
||||
++ [toHtml $ "<iframe " <> unwords direct <> " src=\"" <> filename <> "?plugin\"" <> attToString (idFilter "demo" id', css, att') <> "></iframe>"]
|
||||
++ [toHtml $ "<figcaption>"]
|
||||
++ alt
|
||||
++ [toHtml $ "</figcaption></figure>"]
|
||||
where
|
||||
(direct, css) = classToPlain att
|
||||
-- if not matched
|
||||
media x = return [x]
|
||||
|
||||
|
||||
-- | converts Attributes to String for usage in HTML
|
||||
--
|
||||
-- Also converts width=xxx and height=xxx to the
|
||||
-- corresponding style-attributes
|
||||
attToString :: Attr -> String
|
||||
attToString ("", classes, kvpairs) = "class=\"" <> unwords classes <> "\" " <> unwords ((\(k,v) -> k <> "=\"" <> v <> "\"") <$> kvpairs')
|
||||
where
|
||||
kvpairs' = convertToStyle ["width","height","transform"] kvpairs
|
||||
attToString (id', classes, kvpairs) = "id=\"" <> id' <> "\" class=\"" <> unwords classes <> "\" " <> unwords ((\(k,v) -> k <> "=\"" <> v <> "\"") <$> kvpairs')
|
||||
where
|
||||
kvpairs' = convertToStyle ["width","height","transform"] kvpairs
|
||||
|
||||
convertToStyle :: [String] -> [(String,String)] -> [(String,String)]
|
||||
convertToStyle keys kvpairs = ("style", newstyle):rest
|
||||
where
|
||||
oldstyle = case filter (\(k,v) -> k == "style") kvpairs of
|
||||
[] -> ""
|
||||
[(_,st)] -> st
|
||||
stylesToAdd = filter (\(k,v) -> k `elem` keys) kvpairs
|
||||
rest = filter (\(k,v) -> not $ k `elem` keys) kvpairs
|
||||
newstyle = concat ((\(k,v) -> k <> ":" <> v <> ";") <$> stylesToAdd) <> oldstyle
|
||||
|
||||
checkExtension :: String -> [String] -> Bool
|
||||
checkExtension fn exts = (fmap toLower . tail . takeExtension) fn `elem` exts
|
||||
|
||||
idFilter :: String -> String -> String
|
||||
idFilter a b
|
||||
| a == b = ""
|
||||
| otherwise = b
|
||||
|
||||
classToPlain :: [String] -> ([String],[String])
|
||||
classToPlain = partition (`elem` [ "data-autoplay"
|
||||
, "controls"
|
||||
]
|
||||
)
|
||||
|
||||
toHtml :: String -> Inline
|
||||
toHtml = RawInline (Format "html")
|
||||
|
37
app/Quiz.hs
37
app/Quiz.hs
@ -2,40 +2,7 @@
|
||||
{-# LANGUAGE ScopedTypeVariables #-}
|
||||
|
||||
import Text.Pandoc.JSON
|
||||
import Text.Pandoc.Walk
|
||||
import Control.Exception
|
||||
import Data.Monoid ((<>))
|
||||
import Data.List (partition)
|
||||
import Data.Maybe (isNothing, mapMaybe, listToMaybe)
|
||||
import Text.Pandoc.Util.Filter.Quiz
|
||||
|
||||
main :: IO ()
|
||||
main = toJSONFilter quizLift
|
||||
|
||||
-- Move bottom-Up through the structure, find quiz-answers and remove the
|
||||
-- incorrect formattet ones from the Block they came from.
|
||||
quizLift :: Block -> [Block]
|
||||
quizLift pb@(Plain b) = fmap makeQuiz (query findQuiz pb) ++ [Plain (filter ((==) [] . findQuiz) b)]
|
||||
quizLift pb@(Para b) = fmap makeQuiz (query findQuiz pb) ++ [Plain (filter ((==) [] . findQuiz) b)]
|
||||
quizLift x = [x]
|
||||
|
||||
-- If we have []{.answer} then we have a quiz-answer
|
||||
-- maybe with a tooltip
|
||||
findQuiz :: Inline -> [(Attr, [Inline], Maybe ([Inline],Attr))]
|
||||
findQuiz (Span attributes@(id, att, att') answerText)
|
||||
| "answer" `elem` att = [(attributes, answerText', tooltip)]
|
||||
where
|
||||
answerText' = filter (isNothing . findTooltip) answerText --filter everything that is a tooltip
|
||||
tooltip = listToMaybe $ mapMaybe findTooltip answerText --get the first span that is labled tooltip
|
||||
findQuiz x = []
|
||||
|
||||
-- If we have []{.tooltip} we have a tooltip ;)
|
||||
-- we save the text and the attributes in a tuple
|
||||
findTooltip :: Inline -> Maybe ([Inline],Attr)
|
||||
findTooltip (Span attr@(_,att,_) tooltipText)
|
||||
| "tooltip" `elem` att = Just (tooltipText, attr)
|
||||
findTooltip _ = Nothing
|
||||
|
||||
-- Generate Divs for the quiz
|
||||
makeQuiz :: (Attr, [Inline], Maybe ([Inline],Attr)) -> Block
|
||||
makeQuiz (att, answer, Nothing) = Div att [Plain answer]
|
||||
makeQuiz (att, answer, Just (tooltip,a)) = Div att [Plain answer, Div a [Plain tooltip]]
|
||||
main = toJSONFilter quiz
|
||||
|
@ -1,77 +1,8 @@
|
||||
#!/usr/bin/env runhaskell
|
||||
{-# LANGUAGE ScopedTypeVariables #-}
|
||||
|
||||
import Text.Pandoc.JSON
|
||||
import Text.Pandoc.Walk
|
||||
import Control.Exception
|
||||
import Data.Monoid ((<>))
|
||||
import Data.List (partition, isInfixOf)
|
||||
import Text.Pandoc.Util.Filter.Styling
|
||||
|
||||
main :: IO ()
|
||||
main = toJSONFilter $ styling . walk inlineStyling
|
||||
|
||||
styling :: Block -> IO [Block]
|
||||
styling (Div ("col",att,att') inner) = return $ [toHtml $ "<div style=\"float:left; margin-bottom:10px;\"" <> unwords direct <> attToString ("",css,att') <> ">"]
|
||||
++ inner
|
||||
++ [toHtml"</div>"]
|
||||
where
|
||||
(direct, css) = classToPlain att
|
||||
styling (CodeBlock (id,att,att') inner) = return $ [CodeBlock (id, addToAtt "data-trim"
|
||||
. addToAtt "data-noescape"
|
||||
$ att
|
||||
, att') inner]
|
||||
styling div@(Div (id,att,att') inner)
|
||||
| "fragment" `elem` att = return [Div (id, att, addToStyle "display: block;" att') inner]
|
||||
| "frame" `elem` att = return [Div (id, addToAtt "fragment" --insert fragment
|
||||
. addToAtt "current-visible" --insert current-visible
|
||||
. filter (/= "frame") --remove frame
|
||||
$ att
|
||||
, addToStyle "display: block;" att') inner]
|
||||
| otherwise = return [div]
|
||||
styling x = return [x]
|
||||
|
||||
|
||||
inlineStyling :: Inline -> Inline
|
||||
inlineStyling span@(Span (id, att, att') inner)
|
||||
| "fragment" `elem` att = Span (id, att, addToStyle "display: inline-block;" att') inner
|
||||
| "frame" `elem` att = Span (id, addToAtt "fragment" --insert fragment
|
||||
. addToAtt "current-visible" --insert current-visible
|
||||
. filter (/= "frame") --remove frame
|
||||
$ att
|
||||
, addToStyle "display: inline-block;" att') inner
|
||||
| id == "vspace" = toInlineHtml $ "<div style=\"clear:both;\"" <> unwords direct <> attToString ("",css,att') <> "></div>"
|
||||
| id == "hspace" = toInlineHtml $ "<span " <> unwords direct <> attToString ("",css,att') <> "></span>"
|
||||
| otherwise = span
|
||||
where
|
||||
(direct, css) = classToPlain att
|
||||
inlineStyling x = x
|
||||
|
||||
addToStyle :: String -> [(String, String)] -> [(String, String)]
|
||||
-- we are looking for style and inject
|
||||
addToStyle toAdd (("style",val):as) = ("style", if toAdd `isInfixOf` val then val else val <> " " <> toAdd):as
|
||||
-- if we land here the current one is not style -> skip
|
||||
addToStyle toAdd (a:as) = a:addToStyle toAdd as
|
||||
-- if we land here we have no more to skip -> add
|
||||
addToStyle toAdd [] = [("style", toAdd)]
|
||||
|
||||
addToAtt :: String -> [String] -> [String]
|
||||
addToAtt toAdd (a:as)
|
||||
| a == toAdd = toAdd:as
|
||||
| otherwise = a:addToAtt toAdd as
|
||||
addToAtt toAdd [] = [toAdd]
|
||||
|
||||
attToString :: Attr -> String
|
||||
attToString (ident, [], kvpairs) = ident <> " " <> unwords ((\(k,v) -> k <> "=\"" <> v <> "\"") <$> kvpairs)
|
||||
attToString (ident, classes, kvpairs) = ident <> " class=\"" <> unwords classes <> "\" " <> unwords ((\(k,v) -> k <> "=\"" <> v <> "\"") <$> kvpairs)
|
||||
|
||||
classToPlain :: [String] -> ([String],[String])
|
||||
classToPlain = partition (`elem` [ "data-autoplay"
|
||||
, "controls"
|
||||
]
|
||||
)
|
||||
|
||||
toHtml :: String -> Block
|
||||
toHtml = RawBlock (Format "html")
|
||||
|
||||
toInlineHtml :: String -> Inline
|
||||
toInlineHtml = RawInline (Format "html")
|
||||
|
19
doc/Text-Pandoc-Util-Filter-Cols.html
Normal file
19
doc/Text-Pandoc-Util-Filter-Cols.html
Normal file
@ -0,0 +1,19 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Text.Pandoc.Util.Filter.Cols</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
|
||||
window.onload = function () {pageLoad();setSynopsis("mini_Text-Pandoc-Util-Filter-Cols.html");};
|
||||
//]]>
|
||||
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Text.Pandoc.Util.Filter.Cols.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">pandoc-slide-filter-0.1.0.0</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Safe Haskell</th><td>None</td></tr><tr><th>Language</th><td>Haskell2010</td></tr></table><p class="caption">Text.Pandoc.Util.Filter.Cols</p></div><div id="description"><p class="caption">Description</p><div class="doc"><p>Conversion of lvl-x-headings to x-column-layouts in HTML
|
||||
especially for use in revealjs-slides</p></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><a href="#v:cols">cols</a> :: [<a href="../pandoc-types-1.17.0.5/Text-Pandoc-Definition.html#t:Block">Block</a>] -> [<a href="../pandoc-types-1.17.0.5/Text-Pandoc-Definition.html#t:Block">Block</a>]</li></ul></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src"><a id="v:cols" class="def">cols</a> :: [<a href="../pandoc-types-1.17.0.5/Text-Pandoc-Definition.html#t:Block">Block</a>] -> [<a href="../pandoc-types-1.17.0.5/Text-Pandoc-Definition.html#t:Block">Block</a>] <a href="src/Text.Pandoc.Util.Filter.Cols.html#cols" class="link">Source</a> <a href="#v:cols" class="selflink">#</a></p><div class="doc"><p>This filter makes multi-column-layouts out of lvl-x-headings</p><p>Syntax is</p><pre> ## a b
|
||||
</pre><p>yielding a 2-column-layout with aspects a:b i.e. 1:1 for 50/50-layout
|
||||
or 8:2 for 80/20 layout</p><p>currently works for 2 and 3-columns, but extension is straight-forward.</p><p>If you need multiple Block-Elements inside one column, just wrap them
|
||||
with a <code><div></code>:</p><pre> ## 2 5
|
||||
|
||||
<div>
|
||||
multiple things
|
||||
```
|
||||
foo
|
||||
```
|
||||
<img src="..." title="image" />
|
||||
</div>
|
||||
|
||||
second column here with only 1 element.
|
||||
</pre></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.17.3</p></div></body></html>
|
10
doc/Text-Pandoc-Util-Filter-Media.html
Normal file
10
doc/Text-Pandoc-Util-Filter-Media.html
Normal file
@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Text.Pandoc.Util.Filter.Media</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
|
||||
window.onload = function () {pageLoad();setSynopsis("mini_Text-Pandoc-Util-Filter-Media.html");};
|
||||
//]]>
|
||||
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Text.Pandoc.Util.Filter.Media.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">pandoc-slide-filter-0.1.0.0</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Safe Haskell</th><td>None</td></tr><tr><th>Language</th><td>Haskell2010</td></tr></table><p class="caption">Text.Pandoc.Util.Filter.Media</p></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><a href="#v:media">media</a> :: <a href="../pandoc-types-1.17.0.5/Text-Pandoc-Definition.html#t:Inline">Inline</a> -> <a href="../base-4.9.1.0/System-IO.html#t:IO">IO</a> [<a href="../pandoc-types-1.17.0.5/Text-Pandoc-Definition.html#t:Inline">Inline</a>]</li></ul></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src"><a id="v:media" class="def">media</a> :: <a href="../pandoc-types-1.17.0.5/Text-Pandoc-Definition.html#t:Inline">Inline</a> -> <a href="../base-4.9.1.0/System-IO.html#t:IO">IO</a> [<a href="../pandoc-types-1.17.0.5/Text-Pandoc-Definition.html#t:Inline">Inline</a>] <a href="src/Text.Pandoc.Util.Filter.Media.html#media" class="link">Source</a> <a href="#v:media" class="selflink">#</a></p><div class="doc"><p>main media-plugin.</p><p>Will convert the following syntax</p><pre>![](foo.aac){#audio}
|
||||
![](foo.mp4){#video}
|
||||
![](foo.png){#img}
|
||||
![](foo.svg){#svg}
|
||||
![](foo.html){#demo}
|
||||
</pre><p>HTML-id's maybe ommitted if the file-extension is in whitelist.</p><p>If a type is detected by extension a custom id (not matching the extension)
|
||||
will be preserved.</p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.17.3</p></div></body></html>
|
4
doc/Text-Pandoc-Util-Filter-Quiz.html
Normal file
4
doc/Text-Pandoc-Util-Filter-Quiz.html
Normal file
@ -0,0 +1,4 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Text.Pandoc.Util.Filter.Quiz</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
|
||||
window.onload = function () {pageLoad();setSynopsis("mini_Text-Pandoc-Util-Filter-Quiz.html");};
|
||||
//]]>
|
||||
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Text.Pandoc.Util.Filter.Quiz.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">pandoc-slide-filter-0.1.0.0</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Safe Haskell</th><td>None</td></tr><tr><th>Language</th><td>Haskell2010</td></tr></table><p class="caption">Text.Pandoc.Util.Filter.Quiz</p></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src"><a id="v:quiz" class="def">quiz</a> :: <a href="../pandoc-types-1.17.0.5/Text-Pandoc-Definition.html#t:Block">Block</a> -> [<a href="../pandoc-types-1.17.0.5/Text-Pandoc-Definition.html#t:Block">Block</a>] <a href="src/Text.Pandoc.Util.Filter.Quiz.html#quiz" class="link">Source</a> <a href="#v:quiz" class="selflink">#</a></p></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.17.3</p></div></body></html>
|
5
doc/Text-Pandoc-Util-Filter-Styling.html
Normal file
5
doc/Text-Pandoc-Util-Filter-Styling.html
Normal file
@ -0,0 +1,5 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Text.Pandoc.Util.Filter.Styling</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
|
||||
window.onload = function () {pageLoad();setSynopsis("mini_Text-Pandoc-Util-Filter-Styling.html");};
|
||||
//]]>
|
||||
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Text.Pandoc.Util.Filter.Styling.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">pandoc-slide-filter-0.1.0.0</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Safe Haskell</th><td>None</td></tr><tr><th>Language</th><td>Haskell2010</td></tr></table><p class="caption">Text.Pandoc.Util.Filter.Styling</p></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><a href="#v:styling">styling</a> :: <a href="../pandoc-types-1.17.0.5/Text-Pandoc-Definition.html#t:Block">Block</a> -> <a href="../base-4.9.1.0/System-IO.html#t:IO">IO</a> [<a href="../pandoc-types-1.17.0.5/Text-Pandoc-Definition.html#t:Block">Block</a>]</li><li class="src short"><a href="#v:inlineStyling">inlineStyling</a> :: <a href="../pandoc-types-1.17.0.5/Text-Pandoc-Definition.html#t:Inline">Inline</a> -> <a href="../pandoc-types-1.17.0.5/Text-Pandoc-Definition.html#t:Inline">Inline</a></li></ul></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src"><a id="v:styling" class="def">styling</a> :: <a href="../pandoc-types-1.17.0.5/Text-Pandoc-Definition.html#t:Block">Block</a> -> <a href="../base-4.9.1.0/System-IO.html#t:IO">IO</a> [<a href="../pandoc-types-1.17.0.5/Text-Pandoc-Definition.html#t:Block">Block</a>] <a href="src/Text.Pandoc.Util.Filter.Styling.html#styling" class="link">Source</a> <a href="#v:styling" class="selflink">#</a></p><div class="doc"><p>Block-Styling</p><p>Special cases captured:</p><ul><li>#col turns a div into a floating-div for multiple columns</li><li>CodeBlock gets attributes <code>data-trim</code> and <code>data-noescape</code>
|
||||
automatically</li><li>.fragment and .frame work properly on divs</li></ul></div></div><div class="top"><p class="src"><a id="v:inlineStyling" class="def">inlineStyling</a> :: <a href="../pandoc-types-1.17.0.5/Text-Pandoc-Definition.html#t:Inline">Inline</a> -> <a href="../pandoc-types-1.17.0.5/Text-Pandoc-Definition.html#t:Inline">Inline</a> <a href="src/Text.Pandoc.Util.Filter.Styling.html#inlineStyling" class="link">Source</a> <a href="#v:inlineStyling" class="selflink">#</a></p><div class="doc"><p>Inline-Styling</p><p>Special cases captured:</p><ul><li>.fragment and .frame work properly on spans</li><li>.vspace inside span adds a vertical space with <code>height=xxx</code></li><li>.hspace inside span adds a horizontal space with <code>width=xxx</code></li></ul></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.17.3</p></div></body></html>
|
19
doc/Text-Pandoc-Util-Filter.html
Normal file
19
doc/Text-Pandoc-Util-Filter.html
Normal file
@ -0,0 +1,19 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Text.Pandoc.Util.Filter</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
|
||||
window.onload = function () {pageLoad();setSynopsis("mini_Text-Pandoc-Util-Filter.html");};
|
||||
//]]>
|
||||
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Text.Pandoc.Util.Filter.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">pandoc-slide-filter-0.1.0.0</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Safe Haskell</th><td>None</td></tr><tr><th>Language</th><td>Haskell2010</td></tr></table><p class="caption">Text.Pandoc.Util.Filter</p></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><a href="#v:attToString">attToString</a> :: <a href="../pandoc-types-1.17.0.5/Text-Pandoc-Definition.html#t:Attr">Attr</a> -> <a href="../base-4.9.1.0/Data-String.html#t:String">String</a></li><li class="src short"><a href="#v:revealjsSpecialAttrs">revealjsSpecialAttrs</a> :: [<a href="../base-4.9.1.0/Data-String.html#t:String">String</a>]</li><li class="src short"><a href="#v:classToRevealAttr">classToRevealAttr</a> :: [<a href="../base-4.9.1.0/Data-String.html#t:String">String</a>] -> ([<a href="../base-4.9.1.0/Data-String.html#t:String">String</a>], [<a href="../base-4.9.1.0/Data-String.html#t:String">String</a>])</li><li class="src short"><a href="#v:toHtml">toHtml</a> :: <a href="../base-4.9.1.0/Data-String.html#t:String">String</a> -> <a href="../pandoc-types-1.17.0.5/Text-Pandoc-Definition.html#t:Inline">Inline</a></li><li class="src short"><a href="#v:toBlockHtml">toBlockHtml</a> :: <a href="../base-4.9.1.0/Data-String.html#t:String">String</a> -> <a href="../pandoc-types-1.17.0.5/Text-Pandoc-Definition.html#t:Block">Block</a></li><li class="src short"><a href="#v:addToAtt">addToAtt</a> :: <a href="../base-4.9.1.0/Data-Eq.html#t:Eq">Eq</a> a => a -> [a] -> [a]</li><li class="src short"><a href="#v:addToStyle">addToStyle</a> :: <a href="../base-4.9.1.0/Data-String.html#t:String">String</a> -> [(<a href="../base-4.9.1.0/Data-String.html#t:String">String</a>, <a href="../base-4.9.1.0/Data-String.html#t:String">String</a>)] -> [(<a href="../base-4.9.1.0/Data-String.html#t:String">String</a>, <a href="../base-4.9.1.0/Data-String.html#t:String">String</a>)]</li></ul></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src"><a id="v:attToString" class="def">attToString</a> :: <a href="../pandoc-types-1.17.0.5/Text-Pandoc-Definition.html#t:Attr">Attr</a> -> <a href="../base-4.9.1.0/Data-String.html#t:String">String</a> <a href="src/Text.Pandoc.Util.Filter.html#attToString" class="link">Source</a> <a href="#v:attToString" class="selflink">#</a></p><div class="doc"><p>converts Attributes to String for usage in HTML</p><p>Also converts <code>width=xxx</code> and <code>height=xxx</code> to the
|
||||
corresponding style-attributes</p></div></div><div class="top"><p class="src"><a id="v:revealjsSpecialAttrs" class="def">revealjsSpecialAttrs</a> :: [<a href="../base-4.9.1.0/Data-String.html#t:String">String</a>] <a href="src/Text.Pandoc.Util.Filter.html#revealjsSpecialAttrs" class="link">Source</a> <a href="#v:revealjsSpecialAttrs" class="selflink">#</a></p><div class="doc"><p>revealjs has some special attributes that has to be
|
||||
passed to the html, but Pandoc only allows
|
||||
<code>key=value</code>-attributes, so we have to abuse
|
||||
<code>.class</code> to rewrite them.</p><p>The classes that get rewritten are listed here.</p><p>You probably want <code><a href="Text-Pandoc-Util-Filter.html#v:classToRevealAttr">classToRevealAttr</a></code>, as that
|
||||
is a wrapper for splitting the class-attribute</p></div></div><div class="top"><p class="src"><a id="v:classToRevealAttr" class="def">classToRevealAttr</a> :: [<a href="../base-4.9.1.0/Data-String.html#t:String">String</a>] -> ([<a href="../base-4.9.1.0/Data-String.html#t:String">String</a>], [<a href="../base-4.9.1.0/Data-String.html#t:String">String</a>]) <a href="src/Text.Pandoc.Util.Filter.html#classToRevealAttr" class="link">Source</a> <a href="#v:classToRevealAttr" class="selflink">#</a></p><div class="doc"><p>revealjs has some special attributes that has to be
|
||||
passed to the html, but Pandoc only allows
|
||||
<code>key=value</code>-attributes, so we have to abuse
|
||||
<code>.class</code> to rewrite them.</p><p>This is a wrapper-function which just splits the list
|
||||
into real classes and <code><a href="Text-Pandoc-Util-Filter.html#v:revealjsSpecialAttrs">revealjsSpecialAttrs</a></code></p></div></div><div class="top"><p class="src"><a id="v:toHtml" class="def">toHtml</a> :: <a href="../base-4.9.1.0/Data-String.html#t:String">String</a> -> <a href="../pandoc-types-1.17.0.5/Text-Pandoc-Definition.html#t:Inline">Inline</a> <a href="src/Text.Pandoc.Util.Filter.html#toHtml" class="link">Source</a> <a href="#v:toHtml" class="selflink">#</a></p><div class="doc"><p>small wrapper around <code>RawInline (Format "html")</code>
|
||||
as this is less line-noise in the filters and the
|
||||
intent is more clear.</p></div></div><div class="top"><p class="src"><a id="v:toBlockHtml" class="def">toBlockHtml</a> :: <a href="../base-4.9.1.0/Data-String.html#t:String">String</a> -> <a href="../pandoc-types-1.17.0.5/Text-Pandoc-Definition.html#t:Block">Block</a> <a href="src/Text.Pandoc.Util.Filter.html#toBlockHtml" class="link">Source</a> <a href="#v:toBlockHtml" class="selflink">#</a></p><div class="doc"><p>small wrapper around <code>Raw (Format "html")</code>
|
||||
as this is less line-noise in the filters and the
|
||||
intent is more clear.</p></div></div><div class="top"><p class="src"><a id="v:addToAtt" class="def">addToAtt</a> :: <a href="../base-4.9.1.0/Data-Eq.html#t:Eq">Eq</a> a => a -> [a] -> [a] <a href="src/Text.Pandoc.Util.Filter.html#addToAtt" class="link">Source</a> <a href="#v:addToAtt" class="selflink">#</a></p><div class="doc"><p>adds a given String to the list if not in there; Does nothing if the
|
||||
given String is already present.</p></div></div><div class="top"><p class="src"><a id="v:addToStyle" class="def">addToStyle</a> :: <a href="../base-4.9.1.0/Data-String.html#t:String">String</a> -> [(<a href="../base-4.9.1.0/Data-String.html#t:String">String</a>, <a href="../base-4.9.1.0/Data-String.html#t:String">String</a>)] -> [(<a href="../base-4.9.1.0/Data-String.html#t:String">String</a>, <a href="../base-4.9.1.0/Data-String.html#t:String">String</a>)] <a href="src/Text.Pandoc.Util.Filter.html#addToStyle" class="link">Source</a> <a href="#v:addToStyle" class="selflink">#</a></p><div class="doc"><p>adds given String to List of key-value-pairs (like in <code><a href="../pandoc-types-1.17.0.5/Text-Pandoc-Definition.html#t:Attr">Attr</a></code>)
|
||||
in the "style"-Key.</p><p>Useful when trying to add CSS-styles directly to (generated) elements</p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.17.3</p></div></body></html>
|
4
doc/doc-index.html
Normal file
4
doc/doc-index.html
Normal file
@ -0,0 +1,4 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>pandoc-slide-filter-0.1.0.0 (Index)</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
|
||||
window.onload = function () {pageLoad();};
|
||||
//]]>
|
||||
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">pandoc-slide-filter-0.1.0.0</p></div><div id="content"><div id="index"><p class="caption">Index</p><table><tr><td class="src">addToAtt</td><td class="module"><a href="Text-Pandoc-Util-Filter.html#v:addToAtt">Text.Pandoc.Util.Filter</a></td></tr><tr><td class="src">addToStyle</td><td class="module"><a href="Text-Pandoc-Util-Filter.html#v:addToStyle">Text.Pandoc.Util.Filter</a></td></tr><tr><td class="src">attToString</td><td class="module"><a href="Text-Pandoc-Util-Filter.html#v:attToString">Text.Pandoc.Util.Filter</a></td></tr><tr><td class="src">classToRevealAttr</td><td class="module"><a href="Text-Pandoc-Util-Filter.html#v:classToRevealAttr">Text.Pandoc.Util.Filter</a></td></tr><tr><td class="src">cols</td><td class="module"><a href="Text-Pandoc-Util-Filter-Cols.html#v:cols">Text.Pandoc.Util.Filter.Cols</a></td></tr><tr><td class="src">inlineStyling</td><td class="module"><a href="Text-Pandoc-Util-Filter-Styling.html#v:inlineStyling">Text.Pandoc.Util.Filter.Styling</a></td></tr><tr><td class="src">media</td><td class="module"><a href="Text-Pandoc-Util-Filter-Media.html#v:media">Text.Pandoc.Util.Filter.Media</a></td></tr><tr><td class="src">quiz</td><td class="module"><a href="Text-Pandoc-Util-Filter-Quiz.html#v:quiz">Text.Pandoc.Util.Filter.Quiz</a></td></tr><tr><td class="src">revealjsSpecialAttrs</td><td class="module"><a href="Text-Pandoc-Util-Filter.html#v:revealjsSpecialAttrs">Text.Pandoc.Util.Filter</a></td></tr><tr><td class="src">styling</td><td class="module"><a href="Text-Pandoc-Util-Filter-Styling.html#v:styling">Text.Pandoc.Util.Filter.Styling</a></td></tr><tr><td class="src">toBlockHtml</td><td class="module"><a href="Text-Pandoc-Util-Filter.html#v:toBlockHtml">Text.Pandoc.Util.Filter</a></td></tr><tr><td class="src">toHtml</td><td class="module"><a href="Text-Pandoc-Util-Filter.html#v:toHtml">Text.Pandoc.Util.Filter</a></td></tr></table></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.17.3</p></div></body></html>
|
316
doc/haddock-util.js
Normal file
316
doc/haddock-util.js
Normal file
@ -0,0 +1,316 @@
|
||||
// Haddock JavaScript utilities
|
||||
|
||||
var rspace = /\s\s+/g,
|
||||
rtrim = /^\s+|\s+$/g;
|
||||
|
||||
function spaced(s) { return (" " + s + " ").replace(rspace, " "); }
|
||||
function trim(s) { return s.replace(rtrim, ""); }
|
||||
|
||||
function hasClass(elem, value) {
|
||||
var className = spaced(elem.className || "");
|
||||
return className.indexOf( " " + value + " " ) >= 0;
|
||||
}
|
||||
|
||||
function addClass(elem, value) {
|
||||
var className = spaced(elem.className || "");
|
||||
if ( className.indexOf( " " + value + " " ) < 0 ) {
|
||||
elem.className = trim(className + " " + value);
|
||||
}
|
||||
}
|
||||
|
||||
function removeClass(elem, value) {
|
||||
var className = spaced(elem.className || "");
|
||||
className = className.replace(" " + value + " ", " ");
|
||||
elem.className = trim(className);
|
||||
}
|
||||
|
||||
function toggleClass(elem, valueOn, valueOff, bool) {
|
||||
if (bool == null) { bool = ! hasClass(elem, valueOn); }
|
||||
if (bool) {
|
||||
removeClass(elem, valueOff);
|
||||
addClass(elem, valueOn);
|
||||
}
|
||||
else {
|
||||
removeClass(elem, valueOn);
|
||||
addClass(elem, valueOff);
|
||||
}
|
||||
return bool;
|
||||
}
|
||||
|
||||
|
||||
function makeClassToggle(valueOn, valueOff)
|
||||
{
|
||||
return function(elem, bool) {
|
||||
return toggleClass(elem, valueOn, valueOff, bool);
|
||||
}
|
||||
}
|
||||
|
||||
toggleShow = makeClassToggle("show", "hide");
|
||||
toggleCollapser = makeClassToggle("collapser", "expander");
|
||||
|
||||
function toggleSection(id)
|
||||
{
|
||||
var b = toggleShow(document.getElementById("section." + id));
|
||||
toggleCollapser(document.getElementById("control." + id), b);
|
||||
rememberCollapsed(id, b);
|
||||
return b;
|
||||
}
|
||||
|
||||
var collapsed = {};
|
||||
function rememberCollapsed(id, b)
|
||||
{
|
||||
if(b)
|
||||
delete collapsed[id]
|
||||
else
|
||||
collapsed[id] = null;
|
||||
|
||||
var sections = [];
|
||||
for(var i in collapsed)
|
||||
{
|
||||
if(collapsed.hasOwnProperty(i))
|
||||
sections.push(i);
|
||||
}
|
||||
// cookie specific to this page; don't use setCookie which sets path=/
|
||||
document.cookie = "collapsed=" + escape(sections.join('+'));
|
||||
}
|
||||
|
||||
function restoreCollapsed()
|
||||
{
|
||||
var cookie = getCookie("collapsed");
|
||||
if(!cookie)
|
||||
return;
|
||||
|
||||
var ids = cookie.split('+');
|
||||
for(var i in ids)
|
||||
{
|
||||
if(document.getElementById("section." + ids[i]))
|
||||
toggleSection(ids[i]);
|
||||
}
|
||||
}
|
||||
|
||||
function setCookie(name, value) {
|
||||
document.cookie = name + "=" + escape(value) + ";path=/;";
|
||||
}
|
||||
|
||||
function clearCookie(name) {
|
||||
document.cookie = name + "=;path=/;expires=Thu, 01-Jan-1970 00:00:01 GMT;";
|
||||
}
|
||||
|
||||
function getCookie(name) {
|
||||
var nameEQ = name + "=";
|
||||
var ca = document.cookie.split(';');
|
||||
for(var i=0;i < ca.length;i++) {
|
||||
var c = ca[i];
|
||||
while (c.charAt(0)==' ') c = c.substring(1,c.length);
|
||||
if (c.indexOf(nameEQ) == 0) {
|
||||
return unescape(c.substring(nameEQ.length,c.length));
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
var max_results = 75; // 50 is not enough to search for map in the base libraries
|
||||
var shown_range = null;
|
||||
var last_search = null;
|
||||
|
||||
function quick_search()
|
||||
{
|
||||
perform_search(false);
|
||||
}
|
||||
|
||||
function full_search()
|
||||
{
|
||||
perform_search(true);
|
||||
}
|
||||
|
||||
|
||||
function perform_search(full)
|
||||
{
|
||||
var text = document.getElementById("searchbox").value.toLowerCase();
|
||||
if (text == last_search && !full) return;
|
||||
last_search = text;
|
||||
|
||||
var table = document.getElementById("indexlist");
|
||||
var status = document.getElementById("searchmsg");
|
||||
var children = table.firstChild.childNodes;
|
||||
|
||||
// first figure out the first node with the prefix
|
||||
var first = bisect(-1);
|
||||
var last = (first == -1 ? -1 : bisect(1));
|
||||
|
||||
if (first == -1)
|
||||
{
|
||||
table.className = "";
|
||||
status.innerHTML = "No results found, displaying all";
|
||||
}
|
||||
else if (first == 0 && last == children.length - 1)
|
||||
{
|
||||
table.className = "";
|
||||
status.innerHTML = "";
|
||||
}
|
||||
else if (last - first >= max_results && !full)
|
||||
{
|
||||
table.className = "";
|
||||
status.innerHTML = "More than " + max_results + ", press Search to display";
|
||||
}
|
||||
else
|
||||
{
|
||||
// decide what you need to clear/show
|
||||
if (shown_range)
|
||||
setclass(shown_range[0], shown_range[1], "indexrow");
|
||||
setclass(first, last, "indexshow");
|
||||
shown_range = [first, last];
|
||||
table.className = "indexsearch";
|
||||
status.innerHTML = "";
|
||||
}
|
||||
|
||||
|
||||
function setclass(first, last, status)
|
||||
{
|
||||
for (var i = first; i <= last; i++)
|
||||
{
|
||||
children[i].className = status;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// do a binary search, treating 0 as ...
|
||||
// return either -1 (no 0's found) or location of most far match
|
||||
function bisect(dir)
|
||||
{
|
||||
var first = 0, finish = children.length - 1;
|
||||
var mid, success = false;
|
||||
|
||||
while (finish - first > 3)
|
||||
{
|
||||
mid = Math.floor((finish + first) / 2);
|
||||
|
||||
var i = checkitem(mid);
|
||||
if (i == 0) i = dir;
|
||||
if (i == -1)
|
||||
finish = mid;
|
||||
else
|
||||
first = mid;
|
||||
}
|
||||
var a = (dir == 1 ? first : finish);
|
||||
var b = (dir == 1 ? finish : first);
|
||||
for (var i = b; i != a - dir; i -= dir)
|
||||
{
|
||||
if (checkitem(i) == 0) return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
// from an index, decide what the result is
|
||||
// 0 = match, -1 is lower, 1 is higher
|
||||
function checkitem(i)
|
||||
{
|
||||
var s = getitem(i).toLowerCase().substr(0, text.length);
|
||||
if (s == text) return 0;
|
||||
else return (s > text ? -1 : 1);
|
||||
}
|
||||
|
||||
|
||||
// from an index, get its string
|
||||
// this abstracts over alternates
|
||||
function getitem(i)
|
||||
{
|
||||
for ( ; i >= 0; i--)
|
||||
{
|
||||
var s = children[i].firstChild.firstChild.data;
|
||||
if (s.indexOf(' ') == -1)
|
||||
return s;
|
||||
}
|
||||
return ""; // should never be reached
|
||||
}
|
||||
}
|
||||
|
||||
function setSynopsis(filename) {
|
||||
if (parent.window.synopsis && parent.window.synopsis.location) {
|
||||
if (parent.window.synopsis.location.replace) {
|
||||
// In Firefox this avoids adding the change to the history.
|
||||
parent.window.synopsis.location.replace(filename);
|
||||
} else {
|
||||
parent.window.synopsis.location = filename;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function addMenuItem(html) {
|
||||
var menu = document.getElementById("page-menu");
|
||||
if (menu) {
|
||||
var btn = menu.firstChild.cloneNode(false);
|
||||
btn.innerHTML = html;
|
||||
menu.appendChild(btn);
|
||||
}
|
||||
}
|
||||
|
||||
function styles() {
|
||||
var i, a, es = document.getElementsByTagName("link"), rs = [];
|
||||
for (i = 0; a = es[i]; i++) {
|
||||
if(a.rel.indexOf("style") != -1 && a.title) {
|
||||
rs.push(a);
|
||||
}
|
||||
}
|
||||
return rs;
|
||||
}
|
||||
|
||||
function addStyleMenu() {
|
||||
var as = styles();
|
||||
var i, a, btns = "";
|
||||
for(i=0; a = as[i]; i++) {
|
||||
btns += "<li><a href='#' onclick=\"setActiveStyleSheet('"
|
||||
+ a.title + "'); return false;\">"
|
||||
+ a.title + "</a></li>"
|
||||
}
|
||||
if (as.length > 1) {
|
||||
var h = "<div id='style-menu-holder'>"
|
||||
+ "<a href='#' onclick='styleMenu(); return false;'>Style ▾</a>"
|
||||
+ "<ul id='style-menu' class='hide'>" + btns + "</ul>"
|
||||
+ "</div>";
|
||||
addMenuItem(h);
|
||||
}
|
||||
}
|
||||
|
||||
function setActiveStyleSheet(title) {
|
||||
var as = styles();
|
||||
var i, a, found;
|
||||
for(i=0; a = as[i]; i++) {
|
||||
a.disabled = true;
|
||||
// need to do this always, some browsers are edge triggered
|
||||
if(a.title == title) {
|
||||
found = a;
|
||||
}
|
||||
}
|
||||
if (found) {
|
||||
found.disabled = false;
|
||||
setCookie("haddock-style", title);
|
||||
}
|
||||
else {
|
||||
as[0].disabled = false;
|
||||
clearCookie("haddock-style");
|
||||
}
|
||||
styleMenu(false);
|
||||
}
|
||||
|
||||
function resetStyle() {
|
||||
var s = getCookie("haddock-style");
|
||||
if (s) setActiveStyleSheet(s);
|
||||
}
|
||||
|
||||
|
||||
function styleMenu(show) {
|
||||
var m = document.getElementById('style-menu');
|
||||
if (m) toggleShow(m, show);
|
||||
}
|
||||
|
||||
|
||||
function pageLoad() {
|
||||
addStyleMenu();
|
||||
resetStyle();
|
||||
restoreCollapsed();
|
||||
}
|
||||
|
BIN
doc/hslogo-16.png
Normal file
BIN
doc/hslogo-16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
4
doc/index.html
Normal file
4
doc/index.html
Normal file
@ -0,0 +1,4 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>pandoc-slide-filter-0.1.0.0</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
|
||||
window.onload = function () {pageLoad();};
|
||||
//]]>
|
||||
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">pandoc-slide-filter-0.1.0.0</p></div><div id="content"><div id="description"><h1>pandoc-slide-filter-0.1.0.0</h1><div class="doc empty"> </div></div><div id="module-list"><p class="caption">Modules</p><ul><li><span id="control.n.1" class="module collapser" onclick="toggleSection('n.1')">Text</span><ul id="section.n.1" class="show"><li><span id="control.n.1.1" class="module collapser" onclick="toggleSection('n.1.1')">Pandoc</span><ul id="section.n.1.1" class="show"><li><span id="control.n.1.1.1" class="module collapser" onclick="toggleSection('n.1.1.1')">Util</span><ul id="section.n.1.1.1" class="show"><li><span class="module"><span id="control.n.1.1.1.1" class="collapser" onclick="toggleSection('n.1.1.1.1')"> </span><a href="Text-Pandoc-Util-Filter.html">Text.Pandoc.Util.Filter</a></span><ul id="section.n.1.1.1.1" class="show"><li><span class="module"><a href="Text-Pandoc-Util-Filter-Cols.html">Text.Pandoc.Util.Filter.Cols</a></span></li><li><span class="module"><a href="Text-Pandoc-Util-Filter-Media.html">Text.Pandoc.Util.Filter.Media</a></span></li><li><span class="module"><a href="Text-Pandoc-Util-Filter-Quiz.html">Text.Pandoc.Util.Filter.Quiz</a></span></li><li><span class="module"><a href="Text-Pandoc-Util-Filter-Styling.html">Text.Pandoc.Util.Filter.Styling</a></span></li></ul></li></ul></li></ul></li></ul></li></ul></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.17.3</p></div></body></html>
|
4
doc/mini_Text-Pandoc-Util-Filter-Cols.html
Normal file
4
doc/mini_Text-Pandoc-Util-Filter-Cols.html
Normal file
@ -0,0 +1,4 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Text.Pandoc.Util.Filter.Cols</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
|
||||
window.onload = function () {pageLoad();};
|
||||
//]]>
|
||||
</script></head><body id="mini"><div id="module-header"><p class="caption">Text.Pandoc.Util.Filter.Cols</p></div><div id="interface"><div class="top"><p class="src"><a href="Text-Pandoc-Util-Filter-Cols.html#v:cols" target="main">cols</a></p></div></div></body></html>
|
4
doc/mini_Text-Pandoc-Util-Filter-Media.html
Normal file
4
doc/mini_Text-Pandoc-Util-Filter-Media.html
Normal file
@ -0,0 +1,4 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Text.Pandoc.Util.Filter.Media</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
|
||||
window.onload = function () {pageLoad();};
|
||||
//]]>
|
||||
</script></head><body id="mini"><div id="module-header"><p class="caption">Text.Pandoc.Util.Filter.Media</p></div><div id="interface"><div class="top"><p class="src"><a href="Text-Pandoc-Util-Filter-Media.html#v:media" target="main">media</a></p></div></div></body></html>
|
4
doc/mini_Text-Pandoc-Util-Filter-Quiz.html
Normal file
4
doc/mini_Text-Pandoc-Util-Filter-Quiz.html
Normal file
@ -0,0 +1,4 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Text.Pandoc.Util.Filter.Quiz</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
|
||||
window.onload = function () {pageLoad();};
|
||||
//]]>
|
||||
</script></head><body id="mini"><div id="module-header"><p class="caption">Text.Pandoc.Util.Filter.Quiz</p></div><div id="interface"><div class="top"><p class="src"><a href="Text-Pandoc-Util-Filter-Quiz.html#v:quiz" target="main">quiz</a></p></div></div></body></html>
|
4
doc/mini_Text-Pandoc-Util-Filter-Styling.html
Normal file
4
doc/mini_Text-Pandoc-Util-Filter-Styling.html
Normal file
@ -0,0 +1,4 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Text.Pandoc.Util.Filter.Styling</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
|
||||
window.onload = function () {pageLoad();};
|
||||
//]]>
|
||||
</script></head><body id="mini"><div id="module-header"><p class="caption">Text.Pandoc.Util.Filter.Styling</p></div><div id="interface"><div class="top"><p class="src"><a href="Text-Pandoc-Util-Filter-Styling.html#v:styling" target="main">styling</a></p></div><div class="top"><p class="src"><a href="Text-Pandoc-Util-Filter-Styling.html#v:inlineStyling" target="main">inlineStyling</a></p></div></div></body></html>
|
4
doc/mini_Text-Pandoc-Util-Filter.html
Normal file
4
doc/mini_Text-Pandoc-Util-Filter.html
Normal file
@ -0,0 +1,4 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Text.Pandoc.Util.Filter</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
|
||||
window.onload = function () {pageLoad();};
|
||||
//]]>
|
||||
</script></head><body id="mini"><div id="module-header"><p class="caption">Text.Pandoc.Util.Filter</p></div><div id="interface"><div class="top"><p class="src"><a href="Text-Pandoc-Util-Filter.html#v:attToString" target="main">attToString</a></p></div><div class="top"><p class="src"><a href="Text-Pandoc-Util-Filter.html#v:revealjsSpecialAttrs" target="main">revealjsSpecialAttrs</a></p></div><div class="top"><p class="src"><a href="Text-Pandoc-Util-Filter.html#v:classToRevealAttr" target="main">classToRevealAttr</a></p></div><div class="top"><p class="src"><a href="Text-Pandoc-Util-Filter.html#v:toHtml" target="main">toHtml</a></p></div><div class="top"><p class="src"><a href="Text-Pandoc-Util-Filter.html#v:toBlockHtml" target="main">toBlockHtml</a></p></div><div class="top"><p class="src"><a href="Text-Pandoc-Util-Filter.html#v:addToAtt" target="main">addToAtt</a></p></div><div class="top"><p class="src"><a href="Text-Pandoc-Util-Filter.html#v:addToStyle" target="main">addToStyle</a></p></div></div></body></html>
|
BIN
doc/minus.gif
Normal file
BIN
doc/minus.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 56 B |
612
doc/ocean.css
Normal file
612
doc/ocean.css
Normal file
@ -0,0 +1,612 @@
|
||||
/* @group Fundamentals */
|
||||
|
||||
* { margin: 0; padding: 0 }
|
||||
|
||||
/* Is this portable? */
|
||||
html {
|
||||
background-color: white;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
background: white;
|
||||
color: black;
|
||||
text-align: left;
|
||||
min-height: 100%;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0.8em 0;
|
||||
}
|
||||
|
||||
ul, ol {
|
||||
margin: 0.8em 0 0.8em 2em;
|
||||
}
|
||||
|
||||
dl {
|
||||
margin: 0.8em 0;
|
||||
}
|
||||
|
||||
dt {
|
||||
font-weight: bold;
|
||||
}
|
||||
dd {
|
||||
margin-left: 2em;
|
||||
}
|
||||
|
||||
a { text-decoration: none; }
|
||||
a[href]:link { color: rgb(196,69,29); }
|
||||
a[href]:visited { color: rgb(171,105,84); }
|
||||
a[href]:hover { text-decoration:underline; }
|
||||
|
||||
a[href].def:link, a[href].def:visited { color: black; }
|
||||
a[href].def:hover { color: rgb(78, 98, 114); }
|
||||
|
||||
/* @end */
|
||||
|
||||
/* @group Fonts & Sizes */
|
||||
|
||||
/* Basic technique & IE workarounds from YUI 3
|
||||
For reasons, see:
|
||||
http://yui.yahooapis.com/3.1.1/build/cssfonts/fonts.css
|
||||
*/
|
||||
|
||||
body {
|
||||
font:13px/1.4 sans-serif;
|
||||
*font-size:small; /* for IE */
|
||||
*font:x-small; /* for IE in quirks mode */
|
||||
}
|
||||
|
||||
h1 { font-size: 146.5%; /* 19pt */ }
|
||||
h2 { font-size: 131%; /* 17pt */ }
|
||||
h3 { font-size: 116%; /* 15pt */ }
|
||||
h4 { font-size: 100%; /* 13pt */ }
|
||||
h5 { font-size: 100%; /* 13pt */ }
|
||||
|
||||
select, input, button, textarea {
|
||||
font:99% sans-serif;
|
||||
}
|
||||
|
||||
table {
|
||||
font-size:inherit;
|
||||
font:100%;
|
||||
}
|
||||
|
||||
pre, code, kbd, samp, tt, .src {
|
||||
font-family:monospace;
|
||||
*font-size:108%;
|
||||
line-height: 124%;
|
||||
}
|
||||
|
||||
.links, .link {
|
||||
font-size: 85%; /* 11pt */
|
||||
}
|
||||
|
||||
#module-header .caption {
|
||||
font-size: 182%; /* 24pt */
|
||||
}
|
||||
|
||||
.info {
|
||||
font-size: 85%; /* 11pt */
|
||||
}
|
||||
|
||||
#table-of-contents, #synopsis {
|
||||
/* font-size: 85%; /* 11pt */
|
||||
}
|
||||
|
||||
|
||||
/* @end */
|
||||
|
||||
/* @group Common */
|
||||
|
||||
.caption, h1, h2, h3, h4, h5, h6 {
|
||||
font-weight: bold;
|
||||
color: rgb(78,98,114);
|
||||
margin: 0.8em 0 0.4em;
|
||||
}
|
||||
|
||||
* + h1, * + h2, * + h3, * + h4, * + h5, * + h6 {
|
||||
margin-top: 2em;
|
||||
}
|
||||
|
||||
h1 + h2, h2 + h3, h3 + h4, h4 + h5, h5 + h6 {
|
||||
margin-top: inherit;
|
||||
}
|
||||
|
||||
ul.links {
|
||||
list-style: none;
|
||||
text-align: left;
|
||||
float: right;
|
||||
display: inline-table;
|
||||
margin: 0 0 0 1em;
|
||||
}
|
||||
|
||||
ul.links li {
|
||||
display: inline;
|
||||
border-left: 1px solid #d5d5d5;
|
||||
white-space: nowrap;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
ul.links li a {
|
||||
padding: 0.2em 0.5em;
|
||||
}
|
||||
|
||||
.hide { display: none; }
|
||||
.show { display: inherit; }
|
||||
.clear { clear: both; }
|
||||
|
||||
.collapser {
|
||||
background-image: url(minus.gif);
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
.expander {
|
||||
background-image: url(plus.gif);
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
.collapser, .expander {
|
||||
padding-left: 14px;
|
||||
margin-left: -14px;
|
||||
cursor: pointer;
|
||||
}
|
||||
p.caption.collapser,
|
||||
p.caption.expander {
|
||||
background-position: 0 0.4em;
|
||||
}
|
||||
|
||||
.instance.collapser, .instance.expander {
|
||||
margin-left: 0px;
|
||||
background-position: left center;
|
||||
min-width: 9px;
|
||||
min-height: 9px;
|
||||
}
|
||||
|
||||
|
||||
pre {
|
||||
padding: 0.25em;
|
||||
margin: 0.8em 0;
|
||||
background: rgb(229,237,244);
|
||||
overflow: auto;
|
||||
border-bottom: 0.25em solid white;
|
||||
/* white border adds some space below the box to compensate
|
||||
for visual extra space that paragraphs have between baseline
|
||||
and the bounding box */
|
||||
}
|
||||
|
||||
.src {
|
||||
background: #f0f0f0;
|
||||
padding: 0.2em 0.5em;
|
||||
}
|
||||
|
||||
.keyword { font-weight: normal; }
|
||||
.def { font-weight: bold; }
|
||||
|
||||
@media print {
|
||||
#footer { display: none; }
|
||||
}
|
||||
|
||||
/* @end */
|
||||
|
||||
/* @group Page Structure */
|
||||
|
||||
#content {
|
||||
margin: 0 auto;
|
||||
padding: 0 2em 6em;
|
||||
}
|
||||
|
||||
#package-header {
|
||||
background: rgb(41,56,69);
|
||||
border-top: 5px solid rgb(78,98,114);
|
||||
color: #ddd;
|
||||
padding: 0.2em;
|
||||
position: relative;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
#package-header .caption {
|
||||
background: url(hslogo-16.png) no-repeat 0em;
|
||||
color: white;
|
||||
margin: 0 2em;
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
padding-left: 2em;
|
||||
}
|
||||
|
||||
#package-header a:link, #package-header a:visited { color: white; }
|
||||
#package-header a:hover { background: rgb(78,98,114); }
|
||||
|
||||
#module-header .caption {
|
||||
color: rgb(78,98,114);
|
||||
font-weight: bold;
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
|
||||
table.info {
|
||||
float: right;
|
||||
padding: 0.5em 1em;
|
||||
border: 1px solid #ddd;
|
||||
color: rgb(78,98,114);
|
||||
background-color: #fff;
|
||||
max-width: 40%;
|
||||
border-spacing: 0;
|
||||
position: relative;
|
||||
top: -0.5em;
|
||||
margin: 0 0 0 2em;
|
||||
}
|
||||
|
||||
.info th {
|
||||
padding: 0 1em 0 0;
|
||||
}
|
||||
|
||||
div#style-menu-holder {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
display: inline;
|
||||
}
|
||||
|
||||
#style-menu {
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
overflow: visible;
|
||||
background: #374c5e;
|
||||
margin: 0;
|
||||
text-align: center;
|
||||
right: 0;
|
||||
padding: 0;
|
||||
top: 1.25em;
|
||||
}
|
||||
|
||||
#style-menu li {
|
||||
display: list-item;
|
||||
border-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
color: #000;
|
||||
list-style-type: none;
|
||||
}
|
||||
|
||||
#style-menu li + li {
|
||||
border-top: 1px solid #919191;
|
||||
}
|
||||
|
||||
#style-menu a {
|
||||
width: 6em;
|
||||
padding: 3px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
#footer {
|
||||
background: #ddd;
|
||||
border-top: 1px solid #aaa;
|
||||
padding: 0.5em 0;
|
||||
color: #666;
|
||||
text-align: center;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
height: 3em;
|
||||
}
|
||||
|
||||
/* @end */
|
||||
|
||||
/* @group Front Matter */
|
||||
|
||||
#table-of-contents {
|
||||
float: right;
|
||||
clear: right;
|
||||
background: #faf9dc;
|
||||
border: 1px solid #d8d7ad;
|
||||
padding: 0.5em 1em;
|
||||
max-width: 20em;
|
||||
margin: 0.5em 0 1em 1em;
|
||||
}
|
||||
|
||||
#table-of-contents .caption {
|
||||
text-align: center;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#table-of-contents ul {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#table-of-contents ul ul {
|
||||
margin-left: 2em;
|
||||
}
|
||||
|
||||
#description .caption {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#synopsis {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.no-frame #synopsis {
|
||||
display: block;
|
||||
position: fixed;
|
||||
right: 0;
|
||||
height: 80%;
|
||||
top: 10%;
|
||||
padding: 0;
|
||||
max-width: 75%;
|
||||
/* Ensure that synopsis covers everything (including MathJAX markup) */
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
#synopsis .caption {
|
||||
float: left;
|
||||
width: 29px;
|
||||
color: rgba(255,255,255,0);
|
||||
height: 110px;
|
||||
margin: 0;
|
||||
font-size: 1px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#synopsis p.caption.collapser {
|
||||
background: url(synopsis.png) no-repeat -64px -8px;
|
||||
}
|
||||
|
||||
#synopsis p.caption.expander {
|
||||
background: url(synopsis.png) no-repeat 0px -8px;
|
||||
}
|
||||
|
||||
#synopsis ul {
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
padding: 0.5em;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#synopsis ul ul {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#synopsis ul,
|
||||
#synopsis ul li.src {
|
||||
background-color: #faf9dc;
|
||||
white-space: nowrap;
|
||||
list-style: none;
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
/* @end */
|
||||
|
||||
/* @group Main Content */
|
||||
|
||||
#interface div.top { margin: 2em 0; }
|
||||
#interface h1 + div.top,
|
||||
#interface h2 + div.top,
|
||||
#interface h3 + div.top,
|
||||
#interface h4 + div.top,
|
||||
#interface h5 + div.top {
|
||||
margin-top: 1em;
|
||||
}
|
||||
#interface .src .selflink,
|
||||
#interface .src .link {
|
||||
float: right;
|
||||
color: #919191;
|
||||
background: #f0f0f0;
|
||||
padding: 0 0.5em 0.2em;
|
||||
margin: 0 -0.5em 0 0;
|
||||
}
|
||||
#interface .src .selflink {
|
||||
border-left: 1px solid #919191;
|
||||
margin: 0 -0.5em 0 0.5em;
|
||||
}
|
||||
|
||||
#interface span.fixity {
|
||||
color: #919191;
|
||||
border-left: 1px solid #919191;
|
||||
padding: 0.2em 0.5em 0.2em 0.5em;
|
||||
margin: 0 -1em 0 1em;
|
||||
}
|
||||
|
||||
#interface span.rightedge {
|
||||
border-left: 1px solid #919191;
|
||||
padding: 0.2em 0 0.2em 0;
|
||||
margin: 0 0 0 1em;
|
||||
}
|
||||
|
||||
#interface table { border-spacing: 2px; }
|
||||
#interface td {
|
||||
vertical-align: top;
|
||||
padding-left: 0.5em;
|
||||
}
|
||||
#interface td.src {
|
||||
white-space: nowrap;
|
||||
}
|
||||
#interface td.doc p {
|
||||
margin: 0;
|
||||
}
|
||||
#interface td.doc p + p {
|
||||
margin-top: 0.8em;
|
||||
}
|
||||
|
||||
.clearfix:after {
|
||||
clear: both;
|
||||
content: " ";
|
||||
display: block;
|
||||
height: 0;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.subs ul {
|
||||
list-style: none;
|
||||
display: table;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.subs ul li {
|
||||
display: table-row;
|
||||
}
|
||||
|
||||
.subs ul li dfn {
|
||||
display: table-cell;
|
||||
font-style: normal;
|
||||
font-weight: bold;
|
||||
margin: 1px 0;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.subs ul li > .doc {
|
||||
display: table-cell;
|
||||
padding-left: 0.5em;
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
|
||||
.subs ul li > .doc p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* Render short-style data instances */
|
||||
.inst ul {
|
||||
height: 100%;
|
||||
padding: 0.5em;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.inst, .inst li {
|
||||
list-style: none;
|
||||
margin-left: 1em;
|
||||
}
|
||||
|
||||
/* Workaround for bug in Firefox (issue #384) */
|
||||
.inst-left {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.top p.src {
|
||||
border-top: 1px solid #ccc;
|
||||
}
|
||||
|
||||
.subs, .doc {
|
||||
/* use this selector for one level of indent */
|
||||
padding-left: 2em;
|
||||
}
|
||||
|
||||
.warning {
|
||||
color: red;
|
||||
}
|
||||
|
||||
.arguments {
|
||||
margin-top: -0.4em;
|
||||
}
|
||||
.arguments .caption {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.fields { padding-left: 1em; }
|
||||
|
||||
.fields .caption { display: none; }
|
||||
|
||||
.fields p { margin: 0 0; }
|
||||
|
||||
/* this seems bulky to me
|
||||
.methods, .constructors {
|
||||
background: #f8f8f8;
|
||||
border: 1px solid #eee;
|
||||
}
|
||||
*/
|
||||
|
||||
/* @end */
|
||||
|
||||
/* @group Auxillary Pages */
|
||||
|
||||
|
||||
.extension-list {
|
||||
list-style-type: none;
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
#mini {
|
||||
margin: 0 auto;
|
||||
padding: 0 1em 1em;
|
||||
}
|
||||
|
||||
#mini > * {
|
||||
font-size: 93%; /* 12pt */
|
||||
}
|
||||
|
||||
#mini #module-list .caption,
|
||||
#mini #module-header .caption {
|
||||
font-size: 125%; /* 15pt */
|
||||
}
|
||||
|
||||
#mini #interface h1,
|
||||
#mini #interface h2,
|
||||
#mini #interface h3,
|
||||
#mini #interface h4 {
|
||||
font-size: 109%; /* 13pt */
|
||||
margin: 1em 0 0;
|
||||
}
|
||||
|
||||
#mini #interface .top,
|
||||
#mini #interface .src {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#mini #module-list ul {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#alphabet ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0.5em 0 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#alphabet li {
|
||||
display: inline;
|
||||
margin: 0 0.25em;
|
||||
}
|
||||
|
||||
#alphabet a {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#index .caption,
|
||||
#module-list .caption { font-size: 131%; /* 17pt */ }
|
||||
|
||||
#index table {
|
||||
margin-left: 2em;
|
||||
}
|
||||
|
||||
#index .src {
|
||||
font-weight: bold;
|
||||
}
|
||||
#index .alt {
|
||||
font-size: 77%; /* 10pt */
|
||||
font-style: italic;
|
||||
padding-left: 2em;
|
||||
}
|
||||
|
||||
#index td + td {
|
||||
padding-left: 1em;
|
||||
}
|
||||
|
||||
#module-list ul {
|
||||
list-style: none;
|
||||
margin: 0 0 0 2em;
|
||||
}
|
||||
|
||||
#module-list li {
|
||||
clear: right;
|
||||
}
|
||||
|
||||
#module-list span.collapser,
|
||||
#module-list span.expander {
|
||||
background-position: 0 0.3em;
|
||||
}
|
||||
|
||||
#module-list .package {
|
||||
float: right;
|
||||
}
|
||||
|
||||
/* @end */
|
BIN
doc/pandoc-slide-filter.haddock
Normal file
BIN
doc/pandoc-slide-filter.haddock
Normal file
Binary file not shown.
BIN
doc/plus.gif
Normal file
BIN
doc/plus.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 59 B |
79
doc/src/Text.Pandoc.Util.Filter.Cols.html
Normal file
79
doc/src/Text.Pandoc.Util.Filter.Cols.html
Normal file
@ -0,0 +1,79 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE ScopedTypeVariables #-}</span><span>
|
||||
</span><a name="line-2"></a><span>
|
||||
</span><a name="line-3"></a><span class="hs-comment">-- | Conversion of lvl-x-headings to x-column-layouts in HTML</span><span>
|
||||
</span><a name="line-4"></a><span class="hs-comment">-- especially for use in revealjs-slides</span><span>
|
||||
</span><a name="line-5"></a><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">Text</span><span class="hs-operator">.</span><span class="hs-identifier">Pandoc</span><span class="hs-operator">.</span><span class="hs-identifier">Util</span><span class="hs-operator">.</span><span class="hs-identifier">Filter</span><span class="hs-operator">.</span><span class="hs-identifier">Cols</span><span>
|
||||
</span><a name="line-6"></a><span> </span><span class="hs-special">(</span><a href="Text.Pandoc.Util.Filter.Cols.html#cols"><span class="hs-identifier hs-var">cols</span></a><span class="hs-special">)</span><span>
|
||||
</span><a name="line-7"></a><span> </span><span class="hs-keyword">where</span><span>
|
||||
</span><a name="line-8"></a><span>
|
||||
</span><a name="line-9"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Text</span><span class="hs-operator">.</span><span class="hs-identifier">Pandoc</span><span class="hs-operator">.</span><span class="hs-identifier">JSON</span><span>
|
||||
</span><a name="line-10"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Data</span><span class="hs-operator">.</span><span class="hs-identifier">Monoid</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-operator hs-var"><></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
|
||||
</span><a name="line-11"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Text</span><span class="hs-operator">.</span><span class="hs-identifier">Read</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">readMaybe</span><span class="hs-special">)</span><span>
|
||||
</span><a name="line-12"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Data</span><span class="hs-operator">.</span><span class="hs-identifier">Maybe</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">fromMaybe</span><span class="hs-special">)</span><span>
|
||||
</span><a name="line-13"></a><span class="hs-keyword">import</span><span> </span><a href="Text.Pandoc.Util.Filter.html"><span class="hs-identifier">Text</span><span class="hs-operator">.</span><span class="hs-identifier">Pandoc</span><span class="hs-operator">.</span><span class="hs-identifier">Util</span><span class="hs-operator">.</span><span class="hs-identifier">Filter</span></a><span>
|
||||
</span><a name="line-14"></a><span>
|
||||
</span><a name="line-15"></a><span class="hs-comment">-- | This filter makes multi-column-layouts out of lvl-x-headings</span><span>
|
||||
</span><a name="line-16"></a><span class="hs-comment">--</span><span>
|
||||
</span><a name="line-17"></a><span class="hs-comment">-- Syntax is</span><span>
|
||||
</span><a name="line-18"></a><span class="hs-comment">-- </span><span>
|
||||
</span><a name="line-19"></a><span class="hs-comment">-- @</span><span>
|
||||
</span><a name="line-20"></a><span class="hs-comment">-- ## a b</span><span>
|
||||
</span><a name="line-21"></a><span class="hs-comment">-- @</span><span>
|
||||
</span><a name="line-22"></a><span class="hs-comment">--</span><span>
|
||||
</span><a name="line-23"></a><span class="hs-comment">-- yielding a 2-column-layout with aspects a:b i.e. 1:1 for 50/50-layout</span><span>
|
||||
</span><a name="line-24"></a><span class="hs-comment">-- or 8:2 for 80/20 layout</span><span>
|
||||
</span><a name="line-25"></a><span class="hs-comment">--</span><span>
|
||||
</span><a name="line-26"></a><span class="hs-comment">-- currently works for 2 and 3-columns, but extension is straight-forward.</span><span>
|
||||
</span><a name="line-27"></a><span class="hs-comment">--</span><span>
|
||||
</span><a name="line-28"></a><span class="hs-comment">-- If you need multiple Block-Elements inside one column, just wrap them</span><span>
|
||||
</span><a name="line-29"></a><span class="hs-comment">-- with a @\<div\>@:</span><span>
|
||||
</span><a name="line-30"></a><span class="hs-comment">--</span><span>
|
||||
</span><a name="line-31"></a><span class="hs-comment">-- @</span><span>
|
||||
</span><a name="line-32"></a><span class="hs-comment">-- ## 2 5</span><span>
|
||||
</span><a name="line-33"></a><span class="hs-comment">--</span><span>
|
||||
</span><a name="line-34"></a><span class="hs-comment">-- \<div\></span><span>
|
||||
</span><a name="line-35"></a><span class="hs-comment">-- multiple things</span><span>
|
||||
</span><a name="line-36"></a><span class="hs-comment">-- ```</span><span>
|
||||
</span><a name="line-37"></a><span class="hs-comment">-- foo</span><span>
|
||||
</span><a name="line-38"></a><span class="hs-comment">-- ```</span><span>
|
||||
</span><a name="line-39"></a><span class="hs-comment">-- ![image](...)</span><span>
|
||||
</span><a name="line-40"></a><span class="hs-comment">-- \</div\></span><span>
|
||||
</span><a name="line-41"></a><span class="hs-comment">--</span><span>
|
||||
</span><a name="line-42"></a><span class="hs-comment">-- second column here with only 1 element.</span><span>
|
||||
</span><a name="line-43"></a><span class="hs-comment">-- @</span><span>
|
||||
</span><a name="line-44"></a><span class="hs-identifier">cols</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-identifier hs-type">Block</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-></span><span> </span><span class="hs-special">[</span><span class="hs-identifier hs-type">Block</span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-45"></a><a name="cols"><a href="Text.Pandoc.Util.Filter.Cols.html#cols"><span class="hs-identifier">cols</span></a></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">Header</span><span> </span><span class="hs-number">2</span><span> </span><a name="local-6989586621679076570"><a href="#local-6989586621679076570"><span class="hs-identifier">attr</span></a></a><span> </span><span class="hs-special">[</span><span class="hs-identifier hs-var">Str</span><span> </span><a name="local-6989586621679076571"><a href="#local-6989586621679076571"><span class="hs-identifier">wa</span></a></a><span class="hs-special">,</span><span class="hs-identifier hs-var">Space</span><span class="hs-special">,</span><span class="hs-identifier hs-var">Str</span><span> </span><a name="local-6989586621679076572"><a href="#local-6989586621679076572"><span class="hs-identifier">wb</span></a></a><span class="hs-special">]</span><span class="hs-glyph">:</span><a name="local-6989586621679076573"><a href="#local-6989586621679076573"><span class="hs-identifier">a</span></a></a><span class="hs-glyph">:</span><a name="local-6989586621679076574"><a href="#local-6989586621679076574"><span class="hs-identifier">b</span></a></a><span class="hs-glyph">:</span><a name="local-6989586621679076575"><a href="#local-6989586621679076575"><span class="hs-identifier">rest</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
|
||||
</span><a name="line-46"></a><span> </span><a href="#local-6989586621679076581"><span class="hs-identifier hs-var">outerDiv</span></a><span class="hs-glyph">:</span><a href="#local-6989586621679076575"><span class="hs-identifier hs-var">rest</span></a><span>
|
||||
</span><a name="line-47"></a><span> </span><span class="hs-keyword">where</span><span>
|
||||
</span><a name="line-48"></a><span> </span><a name="local-6989586621679076576"><a href="#local-6989586621679076576"><span class="hs-identifier">wa'</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">fromMaybe</span><span> </span><span class="hs-number">1</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">readMaybe</span><span> </span><a href="#local-6989586621679076571"><span class="hs-identifier hs-var">wa</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Int</span><span>
|
||||
</span><a name="line-49"></a><span> </span><a name="local-6989586621679076577"><a href="#local-6989586621679076577"><span class="hs-identifier">wb'</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">fromMaybe</span><span> </span><span class="hs-number">1</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">readMaybe</span><span> </span><a href="#local-6989586621679076572"><span class="hs-identifier hs-var">wb</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Int</span><span>
|
||||
</span><a name="line-50"></a><span> </span><a name="local-6989586621679076578"><a href="#local-6989586621679076578"><span class="hs-identifier">total</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="#local-6989586621679076576"><span class="hs-identifier hs-var">wa'</span></a><span> </span><span class="hs-operator hs-var">+</span><span> </span><a href="#local-6989586621679076577"><span class="hs-identifier hs-var">wb'</span></a><span>
|
||||
</span><a name="line-51"></a><span> </span><a name="local-6989586621679076579"><a href="#local-6989586621679076579"><span class="hs-identifier">pa</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-number">100</span><span class="hs-operator hs-var">*</span><a href="#local-6989586621679076576"><span class="hs-identifier hs-var">wa'</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">`</span><span class="hs-identifier hs-var">div</span><span class="hs-special">`</span><span> </span><a href="#local-6989586621679076578"><span class="hs-identifier hs-var">total</span></a><span>
|
||||
</span><a name="line-52"></a><span> </span><a name="local-6989586621679076580"><a href="#local-6989586621679076580"><span class="hs-identifier">pb</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-number">100</span><span class="hs-operator hs-var">*</span><a href="#local-6989586621679076577"><span class="hs-identifier hs-var">wb'</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">`</span><span class="hs-identifier hs-var">div</span><span class="hs-special">`</span><span> </span><a href="#local-6989586621679076578"><span class="hs-identifier hs-var">total</span></a><span>
|
||||
</span><a name="line-53"></a><span> </span><a name="local-6989586621679076581"><a href="#local-6989586621679076581"><span class="hs-identifier">outerDiv</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">Div</span><span> </span><a href="#local-6989586621679076570"><span class="hs-identifier hs-var">attr</span></a><span> </span><span class="hs-special">[</span><span> </span><a href="Text.Pandoc.Util.Filter.Cols.html#makeDiv"><span class="hs-identifier hs-var">makeDiv</span></a><span> </span><a href="#local-6989586621679076579"><span class="hs-identifier hs-var">pa</span></a><span> </span><a href="#local-6989586621679076573"><span class="hs-identifier hs-var">a</span></a><span>
|
||||
</span><a name="line-54"></a><span> </span><span class="hs-special">,</span><span> </span><a href="Text.Pandoc.Util.Filter.Cols.html#makeDiv"><span class="hs-identifier hs-var">makeDiv</span></a><span> </span><a href="#local-6989586621679076580"><span class="hs-identifier hs-var">pb</span></a><span> </span><a href="#local-6989586621679076574"><span class="hs-identifier hs-var">b</span></a><span>
|
||||
</span><a name="line-55"></a><span> </span><span class="hs-special">,</span><span> </span><a href="Text.Pandoc.Util.Filter.Cols.html#clearDiv"><span class="hs-identifier hs-var">clearDiv</span></a><span>
|
||||
</span><a name="line-56"></a><span> </span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-57"></a><span class="hs-identifier">cols</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">Header</span><span> </span><span class="hs-number">3</span><span> </span><a name="local-6989586621679077186"><a href="#local-6989586621679077186"><span class="hs-identifier">attr</span></a></a><span> </span><span class="hs-special">[</span><span class="hs-identifier hs-var">Str</span><span> </span><a name="local-6989586621679077187"><a href="#local-6989586621679077187"><span class="hs-identifier">wa</span></a></a><span class="hs-special">,</span><span class="hs-identifier hs-var">Space</span><span class="hs-special">,</span><span class="hs-identifier hs-var">Str</span><span> </span><a name="local-6989586621679077188"><a href="#local-6989586621679077188"><span class="hs-identifier">wb</span></a></a><span class="hs-special">,</span><span class="hs-identifier hs-var">Space</span><span class="hs-special">,</span><span class="hs-identifier hs-var">Str</span><span> </span><a name="local-6989586621679077189"><a href="#local-6989586621679077189"><span class="hs-identifier">wc</span></a></a><span class="hs-special">]</span><span class="hs-glyph">:</span><a name="local-6989586621679077190"><a href="#local-6989586621679077190"><span class="hs-identifier">a</span></a></a><span class="hs-glyph">:</span><a name="local-6989586621679077191"><a href="#local-6989586621679077191"><span class="hs-identifier">b</span></a></a><span class="hs-glyph">:</span><a name="local-6989586621679077192"><a href="#local-6989586621679077192"><span class="hs-identifier">c</span></a></a><span class="hs-glyph">:</span><a name="local-6989586621679077193"><a href="#local-6989586621679077193"><span class="hs-identifier">rest</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
|
||||
</span><a name="line-58"></a><span> </span><a href="#local-6989586621679077201"><span class="hs-identifier hs-var">outerDiv</span></a><span class="hs-glyph">:</span><a href="#local-6989586621679077193"><span class="hs-identifier hs-var">rest</span></a><span>
|
||||
</span><a name="line-59"></a><span> </span><span class="hs-keyword">where</span><span>
|
||||
</span><a name="line-60"></a><span> </span><a name="local-6989586621679077194"><a href="#local-6989586621679077194"><span class="hs-identifier">wa'</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">fromMaybe</span><span> </span><span class="hs-number">1</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">readMaybe</span><span> </span><a href="#local-6989586621679077187"><span class="hs-identifier hs-var">wa</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Int</span><span>
|
||||
</span><a name="line-61"></a><span> </span><a name="local-6989586621679077195"><a href="#local-6989586621679077195"><span class="hs-identifier">wb'</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">fromMaybe</span><span> </span><span class="hs-number">1</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">readMaybe</span><span> </span><a href="#local-6989586621679077188"><span class="hs-identifier hs-var">wb</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Int</span><span>
|
||||
</span><a name="line-62"></a><span> </span><a name="local-6989586621679077196"><a href="#local-6989586621679077196"><span class="hs-identifier">wc'</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">fromMaybe</span><span> </span><span class="hs-number">1</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">readMaybe</span><span> </span><a href="#local-6989586621679077189"><span class="hs-identifier hs-var">wc</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Int</span><span>
|
||||
</span><a name="line-63"></a><span> </span><a name="local-6989586621679077197"><a href="#local-6989586621679077197"><span class="hs-identifier">total</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="#local-6989586621679077194"><span class="hs-identifier hs-var">wa'</span></a><span> </span><span class="hs-operator hs-var">+</span><span> </span><a href="#local-6989586621679077195"><span class="hs-identifier hs-var">wb'</span></a><span> </span><span class="hs-operator hs-var">+</span><span> </span><a href="#local-6989586621679077196"><span class="hs-identifier hs-var">wc'</span></a><span>
|
||||
</span><a name="line-64"></a><span> </span><a name="local-6989586621679077198"><a href="#local-6989586621679077198"><span class="hs-identifier">pa</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-number">100</span><span class="hs-operator hs-var">*</span><a href="#local-6989586621679077194"><span class="hs-identifier hs-var">wa'</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">`</span><span class="hs-identifier hs-var">div</span><span class="hs-special">`</span><span> </span><a href="#local-6989586621679077197"><span class="hs-identifier hs-var">total</span></a><span>
|
||||
</span><a name="line-65"></a><span> </span><a name="local-6989586621679077199"><a href="#local-6989586621679077199"><span class="hs-identifier">pb</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-number">100</span><span class="hs-operator hs-var">*</span><a href="#local-6989586621679077195"><span class="hs-identifier hs-var">wb'</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">`</span><span class="hs-identifier hs-var">div</span><span class="hs-special">`</span><span> </span><a href="#local-6989586621679077197"><span class="hs-identifier hs-var">total</span></a><span>
|
||||
</span><a name="line-66"></a><span> </span><a name="local-6989586621679077200"><a href="#local-6989586621679077200"><span class="hs-identifier">pc</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-number">100</span><span class="hs-operator hs-var">*</span><a href="#local-6989586621679077196"><span class="hs-identifier hs-var">wc'</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">`</span><span class="hs-identifier hs-var">div</span><span class="hs-special">`</span><span> </span><a href="#local-6989586621679077197"><span class="hs-identifier hs-var">total</span></a><span>
|
||||
</span><a name="line-67"></a><span> </span><a name="local-6989586621679077201"><a href="#local-6989586621679077201"><span class="hs-identifier">outerDiv</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">Div</span><span> </span><a href="#local-6989586621679077186"><span class="hs-identifier hs-var">attr</span></a><span> </span><span class="hs-special">[</span><span> </span><a href="Text.Pandoc.Util.Filter.Cols.html#makeDiv"><span class="hs-identifier hs-var">makeDiv</span></a><span> </span><a href="#local-6989586621679077198"><span class="hs-identifier hs-var">pa</span></a><span> </span><a href="#local-6989586621679077190"><span class="hs-identifier hs-var">a</span></a><span>
|
||||
</span><a name="line-68"></a><span> </span><span class="hs-special">,</span><span> </span><a href="Text.Pandoc.Util.Filter.Cols.html#makeDiv"><span class="hs-identifier hs-var">makeDiv</span></a><span> </span><a href="#local-6989586621679077199"><span class="hs-identifier hs-var">pb</span></a><span> </span><a href="#local-6989586621679077191"><span class="hs-identifier hs-var">b</span></a><span>
|
||||
</span><a name="line-69"></a><span> </span><span class="hs-special">,</span><span> </span><a href="Text.Pandoc.Util.Filter.Cols.html#makeDiv"><span class="hs-identifier hs-var">makeDiv</span></a><span> </span><a href="#local-6989586621679077200"><span class="hs-identifier hs-var">pc</span></a><span> </span><a href="#local-6989586621679077192"><span class="hs-identifier hs-var">c</span></a><span>
|
||||
</span><a name="line-70"></a><span> </span><span class="hs-special">,</span><span> </span><a href="Text.Pandoc.Util.Filter.Cols.html#clearDiv"><span class="hs-identifier hs-var">clearDiv</span></a><span>
|
||||
</span><a name="line-71"></a><span> </span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-72"></a><span class="hs-identifier">cols</span><span> </span><a name="local-6989586621679077202"><a href="#local-6989586621679077202"><span class="hs-identifier">x</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="#local-6989586621679077202"><span class="hs-identifier hs-var">x</span></a><span>
|
||||
</span><a name="line-73"></a><span>
|
||||
</span><a name="line-74"></a><span class="hs-identifier">makeDiv</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Int</span><span> </span><span class="hs-glyph">-></span><span> </span><span class="hs-identifier hs-type">Block</span><span> </span><span class="hs-glyph">-></span><span> </span><span class="hs-identifier hs-type">Block</span><span>
|
||||
</span><a name="line-75"></a><a name="makeDiv"><a href="Text.Pandoc.Util.Filter.Cols.html#makeDiv"><span class="hs-identifier">makeDiv</span></a></a><span> </span><a name="local-6989586621679077203"><a href="#local-6989586621679077203"><span class="hs-identifier">width</span></a></a><span> </span><a name="local-6989586621679077204"><a href="#local-6989586621679077204"><span class="hs-identifier">content</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">Div</span><span> </span><span class="hs-special">(</span><span class="hs-string">""</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="hs-string">"style"</span><span class="hs-special">,</span><span class="hs-string">"width:"</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-identifier hs-var">show</span><span> </span><a href="#local-6989586621679077203"><span class="hs-identifier hs-var">width</span></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-string">"%;float:left"</span><span class="hs-special">)</span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-special">[</span><a href="#local-6989586621679077204"><span class="hs-identifier hs-var">content</span></a><span class="hs-special">]</span><span>
|
||||
</span><a name="line-76"></a><span>
|
||||
</span><a name="line-77"></a><span class="hs-identifier">clearDiv</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Block</span><span>
|
||||
</span><a name="line-78"></a><a name="clearDiv"><a href="Text.Pandoc.Util.Filter.Cols.html#clearDiv"><span class="hs-identifier">clearDiv</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">Div</span><span> </span><span class="hs-special">(</span><span class="hs-string">""</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="hs-string">"style"</span><span class="hs-special">,</span><span> </span><span class="hs-string">"clear: both"</span><span class="hs-special">)</span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-special">[</span><span class="hs-identifier hs-var">Plain</span><span> </span><span class="hs-special">[</span><a href="Text.Pandoc.Util.Filter.html#toHtml"><span class="hs-identifier hs-var">toHtml</span></a><span> </span><span class="hs-string">"&nbsp;"</span><span class="hs-special">]</span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-79"></a></pre></body></html>
|
159
doc/src/Text.Pandoc.Util.Filter.Media.html
Normal file
159
doc/src/Text.Pandoc.Util.Filter.Media.html
Normal file
@ -0,0 +1,159 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE ScopedTypeVariables #-}</span><span>
|
||||
</span><a name="line-2"></a><span>
|
||||
</span><a name="line-3"></a><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">Text</span><span class="hs-operator">.</span><span class="hs-identifier">Pandoc</span><span class="hs-operator">.</span><span class="hs-identifier">Util</span><span class="hs-operator">.</span><span class="hs-identifier">Filter</span><span class="hs-operator">.</span><span class="hs-identifier">Media</span><span>
|
||||
</span><a name="line-4"></a><span> </span><span class="hs-special">(</span><a href="Text.Pandoc.Util.Filter.Media.html#media"><span class="hs-identifier hs-var">media</span></a><span class="hs-special">)</span><span>
|
||||
</span><a name="line-5"></a><span> </span><span class="hs-keyword">where</span><span>
|
||||
</span><a name="line-6"></a><span>
|
||||
</span><a name="line-7"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Text</span><span class="hs-operator">.</span><span class="hs-identifier">Pandoc</span><span class="hs-operator">.</span><span class="hs-identifier">JSON</span><span>
|
||||
</span><a name="line-8"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Control</span><span class="hs-operator">.</span><span class="hs-identifier">Exception</span><span>
|
||||
</span><a name="line-9"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Data</span><span class="hs-operator">.</span><span class="hs-identifier">Monoid</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-operator hs-var"><></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
|
||||
</span><a name="line-10"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Data</span><span class="hs-operator">.</span><span class="hs-identifier">Char</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">toLower</span><span class="hs-special">)</span><span>
|
||||
</span><a name="line-11"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">System</span><span class="hs-operator">.</span><span class="hs-identifier">FilePath</span><span>
|
||||
</span><a name="line-12"></a><span>
|
||||
</span><a name="line-13"></a><span class="hs-keyword">import</span><span> </span><a href="Text.Pandoc.Util.Filter.html"><span class="hs-identifier">Text</span><span class="hs-operator">.</span><span class="hs-identifier">Pandoc</span><span class="hs-operator">.</span><span class="hs-identifier">Util</span><span class="hs-operator">.</span><span class="hs-identifier">Filter</span></a><span>
|
||||
</span><a name="line-14"></a><span>
|
||||
</span><a name="line-15"></a><span class="hs-pragma">{-# ANN module "HLint: ignore Redundant $" #-}</span><span> </span><span class="hs-comment">-- supress HLint-Warnings about $</span><span>
|
||||
</span><a name="line-16"></a><span>
|
||||
</span><a name="line-17"></a><span class="hs-comment">-- | File-extensions that should be treated as audio</span><span>
|
||||
</span><a name="line-18"></a><span class="hs-identifier">audioExt</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-identifier hs-type">String</span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-19"></a><a name="audioExt"><a href="Text.Pandoc.Util.Filter.Media.html#audioExt"><span class="hs-identifier">audioExt</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-string">"mp3"</span><span class="hs-special">,</span><span class="hs-string">"aac"</span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-20"></a><span>
|
||||
</span><a name="line-21"></a><span class="hs-comment">-- | File-extensions that should be treated as video</span><span>
|
||||
</span><a name="line-22"></a><span class="hs-identifier">videoExt</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-identifier hs-type">String</span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-23"></a><a name="videoExt"><a href="Text.Pandoc.Util.Filter.Media.html#videoExt"><span class="hs-identifier">videoExt</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="hs-string">"avi"</span><span>
|
||||
</span><a name="line-24"></a><span> </span><span class="hs-special">,</span><span> </span><span class="hs-string">"mp4"</span><span>
|
||||
</span><a name="line-25"></a><span> </span><span class="hs-special">,</span><span> </span><span class="hs-string">"mov"</span><span>
|
||||
</span><a name="line-26"></a><span> </span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-27"></a><span>
|
||||
</span><a name="line-28"></a><span class="hs-comment">-- | File-extensions that should be treated as image</span><span>
|
||||
</span><a name="line-29"></a><span class="hs-identifier">imgExt</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-identifier hs-type">String</span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-30"></a><a name="imgExt"><a href="Text.Pandoc.Util.Filter.Media.html#imgExt"><span class="hs-identifier">imgExt</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span>
|
||||
</span><a name="line-31"></a><span> </span><span class="hs-special">[</span><span> </span><span class="hs-string">"jpg"</span><span>
|
||||
</span><a name="line-32"></a><span> </span><span class="hs-special">,</span><span> </span><span class="hs-string">"jpeg"</span><span>
|
||||
</span><a name="line-33"></a><span> </span><span class="hs-special">,</span><span> </span><span class="hs-string">"png"</span><span>
|
||||
</span><a name="line-34"></a><span> </span><span class="hs-special">,</span><span> </span><span class="hs-string">"gif"</span><span>
|
||||
</span><a name="line-35"></a><span> </span><span class="hs-special">,</span><span> </span><span class="hs-string">"tif"</span><span>
|
||||
</span><a name="line-36"></a><span> </span><span class="hs-special">,</span><span> </span><span class="hs-string">"tiff"</span><span>
|
||||
</span><a name="line-37"></a><span> </span><span class="hs-special">,</span><span> </span><span class="hs-string">"bmp"</span><span>
|
||||
</span><a name="line-38"></a><span> </span><span class="hs-special">,</span><span> </span><span class="hs-string">"svg"</span><span>
|
||||
</span><a name="line-39"></a><span> </span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-40"></a><span>
|
||||
</span><a name="line-41"></a><span class="hs-comment">-- | File-extensions that should be treated as demo and will be included</span><span>
|
||||
</span><a name="line-42"></a><span class="hs-comment">-- in an iframe</span><span>
|
||||
</span><a name="line-43"></a><span class="hs-identifier">demoExt</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-identifier hs-type">String</span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-44"></a><a name="demoExt"><a href="Text.Pandoc.Util.Filter.Media.html#demoExt"><span class="hs-identifier">demoExt</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-string">"html"</span><span class="hs-special">,</span><span> </span><span class="hs-string">"htm"</span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-45"></a><span>
|
||||
</span><a name="line-46"></a><span class="hs-comment">-- | main media-plugin.</span><span>
|
||||
</span><a name="line-47"></a><span class="hs-comment">--</span><span>
|
||||
</span><a name="line-48"></a><span class="hs-comment">-- Will convert the following syntax</span><span>
|
||||
</span><a name="line-49"></a><span class="hs-comment">--</span><span>
|
||||
</span><a name="line-50"></a><span class="hs-comment">-- @</span><span>
|
||||
</span><a name="line-51"></a><span class="hs-comment">-- ![](foo.aac){#audio}</span><span>
|
||||
</span><a name="line-52"></a><span class="hs-comment">-- ![](foo.mp4){#video}</span><span>
|
||||
</span><a name="line-53"></a><span class="hs-comment">-- ![](foo.png){#img}</span><span>
|
||||
</span><a name="line-54"></a><span class="hs-comment">-- ![](foo.svg){#svg}</span><span>
|
||||
</span><a name="line-55"></a><span class="hs-comment">-- ![](foo.html){#demo}</span><span>
|
||||
</span><a name="line-56"></a><span class="hs-comment">-- @</span><span>
|
||||
</span><a name="line-57"></a><span class="hs-comment">--</span><span>
|
||||
</span><a name="line-58"></a><span class="hs-comment">-- HTML-id's maybe ommitted if the file-extension is in whitelist.</span><span>
|
||||
</span><a name="line-59"></a><span class="hs-comment">--</span><span>
|
||||
</span><a name="line-60"></a><span class="hs-comment">-- If a type is detected by extension a custom id (not matching the extension)</span><span>
|
||||
</span><a name="line-61"></a><span class="hs-comment">-- will be preserved.</span><span>
|
||||
</span><a name="line-62"></a><span class="hs-comment">--</span><span>
|
||||
</span><a name="line-63"></a><span class="hs-identifier">media</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Inline</span><span> </span><span class="hs-glyph">-></span><span> </span><span class="hs-identifier hs-type">IO</span><span> </span><span class="hs-special">[</span><span class="hs-identifier hs-type">Inline</span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-64"></a><span class="hs-comment">--audio</span><span>
|
||||
</span><a name="line-65"></a><a name="media"><a href="Text.Pandoc.Util.Filter.Media.html#media"><span class="hs-identifier">media</span></a></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">Image</span><span> </span><span class="hs-special">(</span><a name="local-6989586621679079177"><a href="#local-6989586621679079177"><span class="hs-identifier">id'</span></a></a><span class="hs-special">,</span><a name="local-6989586621679079178"><a href="#local-6989586621679079178"><span class="hs-identifier">att</span></a></a><span class="hs-special">,</span><a name="local-6989586621679079179"><a href="#local-6989586621679079179"><span class="hs-identifier">att'</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">(</span><a name="local-6989586621679079180"><a href="#local-6989586621679079180"><span class="hs-identifier">filename</span></a></a><span class="hs-special">,</span><span class="hs-identifier">_</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
|
||||
</span><a name="line-66"></a><span> </span><span class="hs-glyph">|</span><span> </span><a href="#local-6989586621679079177"><span class="hs-identifier hs-var">id'</span></a><span> </span><span class="hs-operator hs-var">==</span><span> </span><span class="hs-string">"audio"</span><span> </span><span class="hs-operator hs-var">||</span><span> </span><a href="Text.Pandoc.Util.Filter.Media.html#checkExtension"><span class="hs-identifier hs-var">checkExtension</span></a><span> </span><a href="#local-6989586621679079180"><span class="hs-identifier hs-var">filename</span></a><span> </span><a href="Text.Pandoc.Util.Filter.Media.html#audioExt"><span class="hs-identifier hs-var">audioExt</span></a><span>
|
||||
</span><a name="line-67"></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">return</span><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-special">[</span><a href="Text.Pandoc.Util.Filter.html#toHtml"><span class="hs-identifier hs-var">toHtml</span></a><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-string">"<audio "</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-identifier hs-var">unwords</span><span> </span><a href="#local-6989586621679079181"><span class="hs-identifier hs-var">direct</span></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-string">" src=\""</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><a href="#local-6989586621679079180"><span class="hs-identifier hs-var">filename</span></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-string">"\""</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><a href="Text.Pandoc.Util.Filter.html#attToString"><span class="hs-identifier hs-var">attToString</span></a><span> </span><span class="hs-special">(</span><a href="Text.Pandoc.Util.Filter.Media.html#idFilter"><span class="hs-identifier hs-var">idFilter</span></a><span> </span><span class="hs-string">"audio"</span><span> </span><a href="#local-6989586621679079177"><span class="hs-identifier hs-var">id'</span></a><span class="hs-special">,</span><a href="#local-6989586621679079182"><span class="hs-identifier hs-var">css</span></a><span class="hs-special">,</span><a href="#local-6989586621679079179"><span class="hs-identifier hs-var">att'</span></a><span class="hs-special">)</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-string">"></audio>"</span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-68"></a><span> </span><span class="hs-keyword">where</span><span>
|
||||
</span><a name="line-69"></a><span> </span><span class="hs-special">(</span><a name="local-6989586621679079181"><a href="#local-6989586621679079181"><span class="hs-identifier">direct</span></a></a><span class="hs-special">,</span><span> </span><a name="local-6989586621679079182"><a href="#local-6989586621679079182"><span class="hs-identifier">css</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Text.Pandoc.Util.Filter.html#classToRevealAttr"><span class="hs-identifier hs-var">classToRevealAttr</span></a><span> </span><a href="#local-6989586621679079178"><span class="hs-identifier hs-var">att</span></a><span>
|
||||
</span><a name="line-70"></a><span class="hs-identifier">media</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">Image</span><span> </span><span class="hs-special">(</span><a name="local-6989586621679079183"><a href="#local-6989586621679079183"><span class="hs-identifier">id'</span></a></a><span class="hs-special">,</span><a name="local-6989586621679079184"><a href="#local-6989586621679079184"><span class="hs-identifier">att</span></a></a><span class="hs-special">,</span><a name="local-6989586621679079185"><a href="#local-6989586621679079185"><span class="hs-identifier">att'</span></a></a><span class="hs-special">)</span><span> </span><a name="local-6989586621679079186"><a href="#local-6989586621679079186"><span class="hs-identifier">alt</span></a></a><span> </span><span class="hs-special">(</span><a name="local-6989586621679079187"><a href="#local-6989586621679079187"><span class="hs-identifier">filename</span></a></a><span class="hs-special">,</span><span class="hs-identifier">_</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
|
||||
</span><a name="line-71"></a><span> </span><span class="hs-glyph">|</span><span> </span><a href="#local-6989586621679079183"><span class="hs-identifier hs-var">id'</span></a><span> </span><span class="hs-operator hs-var">==</span><span> </span><span class="hs-string">"audio"</span><span> </span><span class="hs-operator hs-var">||</span><span> </span><a href="Text.Pandoc.Util.Filter.Media.html#checkExtension"><span class="hs-identifier hs-var">checkExtension</span></a><span> </span><a href="#local-6989586621679079187"><span class="hs-identifier hs-var">filename</span></a><span> </span><a href="Text.Pandoc.Util.Filter.Media.html#audioExt"><span class="hs-identifier hs-var">audioExt</span></a><span>
|
||||
</span><a name="line-72"></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">return</span><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-special">[</span><a href="Text.Pandoc.Util.Filter.html#toHtml"><span class="hs-identifier hs-var">toHtml</span></a><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-string">"<figure><audio "</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-identifier hs-var">unwords</span><span> </span><a href="#local-6989586621679079188"><span class="hs-identifier hs-var">direct</span></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-string">" src=\""</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><a href="#local-6989586621679079187"><span class="hs-identifier hs-var">filename</span></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-string">"\""</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><a href="Text.Pandoc.Util.Filter.html#attToString"><span class="hs-identifier hs-var">attToString</span></a><span> </span><span class="hs-special">(</span><a href="Text.Pandoc.Util.Filter.Media.html#idFilter"><span class="hs-identifier hs-var">idFilter</span></a><span> </span><span class="hs-string">"audio"</span><span> </span><a href="#local-6989586621679079183"><span class="hs-identifier hs-var">id'</span></a><span class="hs-special">,</span><a href="#local-6989586621679079189"><span class="hs-identifier hs-var">css</span></a><span class="hs-special">,</span><a href="#local-6989586621679079185"><span class="hs-identifier hs-var">att'</span></a><span class="hs-special">)</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-string">"></audio>"</span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-73"></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-special">[</span><a href="Text.Pandoc.Util.Filter.html#toHtml"><span class="hs-identifier hs-var">toHtml</span></a><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-string">"<figcaption>"</span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-74"></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><a href="#local-6989586621679079186"><span class="hs-identifier hs-var">alt</span></a><span>
|
||||
</span><a name="line-75"></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-special">[</span><a href="Text.Pandoc.Util.Filter.html#toHtml"><span class="hs-identifier hs-var">toHtml</span></a><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-string">"</figcaption></figure>"</span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-76"></a><span> </span><span class="hs-keyword">where</span><span>
|
||||
</span><a name="line-77"></a><span> </span><span class="hs-special">(</span><a name="local-6989586621679079188"><a href="#local-6989586621679079188"><span class="hs-identifier">direct</span></a></a><span class="hs-special">,</span><span> </span><a name="local-6989586621679079189"><a href="#local-6989586621679079189"><span class="hs-identifier">css</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Text.Pandoc.Util.Filter.html#classToRevealAttr"><span class="hs-identifier hs-var">classToRevealAttr</span></a><span> </span><a href="#local-6989586621679079184"><span class="hs-identifier hs-var">att</span></a><span>
|
||||
</span><a name="line-78"></a><span class="hs-comment">--videos</span><span>
|
||||
</span><a name="line-79"></a><span class="hs-identifier">media</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">Image</span><span> </span><span class="hs-special">(</span><a name="local-6989586621679079190"><a href="#local-6989586621679079190"><span class="hs-identifier">id'</span></a></a><span class="hs-special">,</span><span> </span><a name="local-6989586621679079191"><a href="#local-6989586621679079191"><span class="hs-identifier">att</span></a></a><span class="hs-special">,</span><span> </span><a name="local-6989586621679079192"><a href="#local-6989586621679079192"><span class="hs-identifier">att'</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">(</span><a name="local-6989586621679079193"><a href="#local-6989586621679079193"><span class="hs-identifier">filename</span></a></a><span class="hs-special">,</span><span class="hs-identifier">_</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
|
||||
</span><a name="line-80"></a><span> </span><span class="hs-glyph">|</span><span> </span><a href="#local-6989586621679079190"><span class="hs-identifier hs-var">id'</span></a><span> </span><span class="hs-operator hs-var">==</span><span> </span><span class="hs-string">"video"</span><span> </span><span class="hs-operator hs-var">||</span><span> </span><a href="Text.Pandoc.Util.Filter.Media.html#checkExtension"><span class="hs-identifier hs-var">checkExtension</span></a><span> </span><a href="#local-6989586621679079193"><span class="hs-identifier hs-var">filename</span></a><span> </span><a href="Text.Pandoc.Util.Filter.Media.html#videoExt"><span class="hs-identifier hs-var">videoExt</span></a><span>
|
||||
</span><a name="line-81"></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">return</span><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-special">[</span><a href="Text.Pandoc.Util.Filter.html#toHtml"><span class="hs-identifier hs-var">toHtml</span></a><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-string">"<video "</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-identifier hs-var">unwords</span><span> </span><a href="#local-6989586621679079194"><span class="hs-identifier hs-var">direct</span></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-string">" src=\""</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><a href="#local-6989586621679079193"><span class="hs-identifier hs-var">filename</span></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-string">"\""</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><a href="Text.Pandoc.Util.Filter.html#attToString"><span class="hs-identifier hs-var">attToString</span></a><span> </span><span class="hs-special">(</span><a href="Text.Pandoc.Util.Filter.Media.html#idFilter"><span class="hs-identifier hs-var">idFilter</span></a><span> </span><span class="hs-string">"video"</span><span> </span><a href="#local-6989586621679079190"><span class="hs-identifier hs-var">id'</span></a><span class="hs-special">,</span><a href="#local-6989586621679079195"><span class="hs-identifier hs-var">css</span></a><span class="hs-special">,</span><a href="#local-6989586621679079192"><span class="hs-identifier hs-var">att'</span></a><span class="hs-special">)</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-string">"></video>"</span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-82"></a><span> </span><span class="hs-keyword">where</span><span>
|
||||
</span><a name="line-83"></a><span> </span><span class="hs-special">(</span><a name="local-6989586621679079194"><a href="#local-6989586621679079194"><span class="hs-identifier">direct</span></a></a><span class="hs-special">,</span><span> </span><a name="local-6989586621679079195"><a href="#local-6989586621679079195"><span class="hs-identifier">css</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Text.Pandoc.Util.Filter.html#classToRevealAttr"><span class="hs-identifier hs-var">classToRevealAttr</span></a><span> </span><a href="#local-6989586621679079191"><span class="hs-identifier hs-var">att</span></a><span>
|
||||
</span><a name="line-84"></a><span class="hs-identifier">media</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">Image</span><span> </span><span class="hs-special">(</span><a name="local-6989586621679079196"><a href="#local-6989586621679079196"><span class="hs-identifier">id'</span></a></a><span class="hs-special">,</span><span> </span><a name="local-6989586621679079197"><a href="#local-6989586621679079197"><span class="hs-identifier">att</span></a></a><span class="hs-special">,</span><span> </span><a name="local-6989586621679079198"><a href="#local-6989586621679079198"><span class="hs-identifier">att'</span></a></a><span class="hs-special">)</span><span> </span><a name="local-6989586621679079199"><a href="#local-6989586621679079199"><span class="hs-identifier">alt</span></a></a><span> </span><span class="hs-special">(</span><a name="local-6989586621679079200"><a href="#local-6989586621679079200"><span class="hs-identifier">filename</span></a></a><span class="hs-special">,</span><span class="hs-identifier">_</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
|
||||
</span><a name="line-85"></a><span> </span><span class="hs-glyph">|</span><span> </span><a href="#local-6989586621679079196"><span class="hs-identifier hs-var">id'</span></a><span> </span><span class="hs-operator hs-var">==</span><span> </span><span class="hs-string">"video"</span><span> </span><span class="hs-operator hs-var">||</span><span> </span><a href="Text.Pandoc.Util.Filter.Media.html#checkExtension"><span class="hs-identifier hs-var">checkExtension</span></a><span> </span><a href="#local-6989586621679079200"><span class="hs-identifier hs-var">filename</span></a><span> </span><a href="Text.Pandoc.Util.Filter.Media.html#videoExt"><span class="hs-identifier hs-var">videoExt</span></a><span>
|
||||
</span><a name="line-86"></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">return</span><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-special">[</span><a href="Text.Pandoc.Util.Filter.html#toHtml"><span class="hs-identifier hs-var">toHtml</span></a><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-string">"<figure>"</span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-87"></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-special">[</span><a href="Text.Pandoc.Util.Filter.html#toHtml"><span class="hs-identifier hs-var">toHtml</span></a><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-string">"<video "</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-identifier hs-var">unwords</span><span> </span><a href="#local-6989586621679079201"><span class="hs-identifier hs-var">direct</span></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-string">" src=\""</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><a href="#local-6989586621679079200"><span class="hs-identifier hs-var">filename</span></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-string">"\""</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><a href="Text.Pandoc.Util.Filter.html#attToString"><span class="hs-identifier hs-var">attToString</span></a><span> </span><span class="hs-special">(</span><a href="Text.Pandoc.Util.Filter.Media.html#idFilter"><span class="hs-identifier hs-var">idFilter</span></a><span> </span><span class="hs-string">"video"</span><span> </span><a href="#local-6989586621679079196"><span class="hs-identifier hs-var">id'</span></a><span class="hs-special">,</span><a href="#local-6989586621679079202"><span class="hs-identifier hs-var">css</span></a><span class="hs-special">,</span><a href="#local-6989586621679079198"><span class="hs-identifier hs-var">att'</span></a><span class="hs-special">)</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-string">"></video>"</span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-88"></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-special">[</span><a href="Text.Pandoc.Util.Filter.html#toHtml"><span class="hs-identifier hs-var">toHtml</span></a><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-string">"<figcaption>"</span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-89"></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><a href="#local-6989586621679079199"><span class="hs-identifier hs-var">alt</span></a><span>
|
||||
</span><a name="line-90"></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-special">[</span><a href="Text.Pandoc.Util.Filter.html#toHtml"><span class="hs-identifier hs-var">toHtml</span></a><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-string">"</figcaption></figure>"</span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-91"></a><span> </span><span class="hs-keyword">where</span><span>
|
||||
</span><a name="line-92"></a><span> </span><span class="hs-special">(</span><a name="local-6989586621679079201"><a href="#local-6989586621679079201"><span class="hs-identifier">direct</span></a></a><span class="hs-special">,</span><span> </span><a name="local-6989586621679079202"><a href="#local-6989586621679079202"><span class="hs-identifier">css</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Text.Pandoc.Util.Filter.html#classToRevealAttr"><span class="hs-identifier hs-var">classToRevealAttr</span></a><span> </span><a href="#local-6989586621679079197"><span class="hs-identifier hs-var">att</span></a><span>
|
||||
</span><a name="line-93"></a><span class="hs-comment">--images</span><span>
|
||||
</span><a name="line-94"></a><span class="hs-identifier">media</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">Image</span><span> </span><span class="hs-special">(</span><a name="local-6989586621679079203"><a href="#local-6989586621679079203"><span class="hs-identifier">id'</span></a></a><span class="hs-special">,</span><span> </span><a name="local-6989586621679079204"><a href="#local-6989586621679079204"><span class="hs-identifier">att</span></a></a><span class="hs-special">,</span><span> </span><a name="local-6989586621679079205"><a href="#local-6989586621679079205"><span class="hs-identifier">att'</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">(</span><a name="local-6989586621679079206"><a href="#local-6989586621679079206"><span class="hs-identifier">filename</span></a></a><span class="hs-special">,</span><span class="hs-identifier">_</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
|
||||
</span><a name="line-95"></a><span> </span><span class="hs-glyph">|</span><span> </span><a href="#local-6989586621679079203"><span class="hs-identifier hs-var">id'</span></a><span> </span><span class="hs-operator hs-var">==</span><span> </span><span class="hs-string">"img"</span><span> </span><span class="hs-operator hs-var">||</span><span> </span><a href="Text.Pandoc.Util.Filter.Media.html#checkExtension"><span class="hs-identifier hs-var">checkExtension</span></a><span> </span><a href="#local-6989586621679079206"><span class="hs-identifier hs-var">filename</span></a><span> </span><a href="Text.Pandoc.Util.Filter.Media.html#imgExt"><span class="hs-identifier hs-var">imgExt</span></a><span>
|
||||
</span><a name="line-96"></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">return</span><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-special">[</span><a href="Text.Pandoc.Util.Filter.html#toHtml"><span class="hs-identifier hs-var">toHtml</span></a><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-string">"<figure>"</span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-97"></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-special">[</span><a href="Text.Pandoc.Util.Filter.html#toHtml"><span class="hs-identifier hs-var">toHtml</span></a><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-string">"<img "</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-identifier hs-var">unwords</span><span> </span><a href="#local-6989586621679079207"><span class="hs-identifier hs-var">direct</span></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-string">" src=\""</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><a href="#local-6989586621679079206"><span class="hs-identifier hs-var">filename</span></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-string">"\""</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><a href="Text.Pandoc.Util.Filter.html#attToString"><span class="hs-identifier hs-var">attToString</span></a><span> </span><span class="hs-special">(</span><a href="Text.Pandoc.Util.Filter.Media.html#idFilter"><span class="hs-identifier hs-var">idFilter</span></a><span> </span><span class="hs-string">"img"</span><span> </span><a href="#local-6989586621679079203"><span class="hs-identifier hs-var">id'</span></a><span class="hs-special">,</span><a href="#local-6989586621679079208"><span class="hs-identifier hs-var">css</span></a><span class="hs-special">,</span><a href="#local-6989586621679079205"><span class="hs-identifier hs-var">att'</span></a><span class="hs-special">)</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-string">"></img>"</span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-98"></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-special">[</span><a href="Text.Pandoc.Util.Filter.html#toHtml"><span class="hs-identifier hs-var">toHtml</span></a><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-string">"</figure>"</span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-99"></a><span> </span><span class="hs-keyword">where</span><span>
|
||||
</span><a name="line-100"></a><span> </span><span class="hs-special">(</span><a name="local-6989586621679079207"><a href="#local-6989586621679079207"><span class="hs-identifier">direct</span></a></a><span class="hs-special">,</span><span> </span><a name="local-6989586621679079208"><a href="#local-6989586621679079208"><span class="hs-identifier">css</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Text.Pandoc.Util.Filter.html#classToRevealAttr"><span class="hs-identifier hs-var">classToRevealAttr</span></a><span> </span><a href="#local-6989586621679079204"><span class="hs-identifier hs-var">att</span></a><span>
|
||||
</span><a name="line-101"></a><span class="hs-identifier">media</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">Image</span><span> </span><span class="hs-special">(</span><a name="local-6989586621679079209"><a href="#local-6989586621679079209"><span class="hs-identifier">id'</span></a></a><span class="hs-special">,</span><span> </span><a name="local-6989586621679079210"><a href="#local-6989586621679079210"><span class="hs-identifier">att</span></a></a><span class="hs-special">,</span><span> </span><a name="local-6989586621679079211"><a href="#local-6989586621679079211"><span class="hs-identifier">att'</span></a></a><span class="hs-special">)</span><span> </span><a name="local-6989586621679079212"><a href="#local-6989586621679079212"><span class="hs-identifier">alt</span></a></a><span> </span><span class="hs-special">(</span><a name="local-6989586621679079213"><a href="#local-6989586621679079213"><span class="hs-identifier">filename</span></a></a><span class="hs-special">,</span><span class="hs-identifier">_</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
|
||||
</span><a name="line-102"></a><span> </span><span class="hs-glyph">|</span><span> </span><a href="#local-6989586621679079209"><span class="hs-identifier hs-var">id'</span></a><span> </span><span class="hs-operator hs-var">==</span><span> </span><span class="hs-string">"img"</span><span> </span><span class="hs-operator hs-var">||</span><span> </span><a href="Text.Pandoc.Util.Filter.Media.html#checkExtension"><span class="hs-identifier hs-var">checkExtension</span></a><span> </span><a href="#local-6989586621679079213"><span class="hs-identifier hs-var">filename</span></a><span> </span><a href="Text.Pandoc.Util.Filter.Media.html#imgExt"><span class="hs-identifier hs-var">imgExt</span></a><span>
|
||||
</span><a name="line-103"></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">return</span><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-special">[</span><a href="Text.Pandoc.Util.Filter.html#toHtml"><span class="hs-identifier hs-var">toHtml</span></a><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-string">"<figure>"</span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-104"></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-special">[</span><a href="Text.Pandoc.Util.Filter.html#toHtml"><span class="hs-identifier hs-var">toHtml</span></a><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-string">"<img "</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-identifier hs-var">unwords</span><span> </span><a href="#local-6989586621679079214"><span class="hs-identifier hs-var">direct</span></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-string">" src=\""</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><a href="#local-6989586621679079213"><span class="hs-identifier hs-var">filename</span></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-string">"\""</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><a href="Text.Pandoc.Util.Filter.html#attToString"><span class="hs-identifier hs-var">attToString</span></a><span> </span><span class="hs-special">(</span><a href="Text.Pandoc.Util.Filter.Media.html#idFilter"><span class="hs-identifier hs-var">idFilter</span></a><span> </span><span class="hs-string">"img"</span><span> </span><a href="#local-6989586621679079209"><span class="hs-identifier hs-var">id'</span></a><span class="hs-special">,</span><a href="#local-6989586621679079215"><span class="hs-identifier hs-var">css</span></a><span class="hs-special">,</span><a href="#local-6989586621679079211"><span class="hs-identifier hs-var">att'</span></a><span class="hs-special">)</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-string">"></img>"</span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-105"></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-special">[</span><a href="Text.Pandoc.Util.Filter.html#toHtml"><span class="hs-identifier hs-var">toHtml</span></a><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-string">"<figcaption>"</span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-106"></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><a href="#local-6989586621679079212"><span class="hs-identifier hs-var">alt</span></a><span>
|
||||
</span><a name="line-107"></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-special">[</span><a href="Text.Pandoc.Util.Filter.html#toHtml"><span class="hs-identifier hs-var">toHtml</span></a><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-string">"</figcaption></figure>"</span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-108"></a><span> </span><span class="hs-keyword">where</span><span>
|
||||
</span><a name="line-109"></a><span> </span><span class="hs-special">(</span><a name="local-6989586621679079214"><a href="#local-6989586621679079214"><span class="hs-identifier">direct</span></a></a><span class="hs-special">,</span><span> </span><a name="local-6989586621679079215"><a href="#local-6989586621679079215"><span class="hs-identifier">css</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Text.Pandoc.Util.Filter.html#classToRevealAttr"><span class="hs-identifier hs-var">classToRevealAttr</span></a><span> </span><a href="#local-6989586621679079210"><span class="hs-identifier hs-var">att</span></a><span>
|
||||
</span><a name="line-110"></a><span class="hs-comment">--load svg and dump it in</span><span>
|
||||
</span><a name="line-111"></a><span class="hs-identifier">media</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">Image</span><span> </span><span class="hs-special">(</span><a name="local-6989586621679079216"><a href="#local-6989586621679079216"><span class="hs-identifier">id'</span></a></a><span class="hs-special">,</span><span> </span><a name="local-6989586621679079217"><a href="#local-6989586621679079217"><span class="hs-identifier">att</span></a></a><span class="hs-special">,</span><span> </span><a name="local-6989586621679079218"><a href="#local-6989586621679079218"><span class="hs-identifier">att'</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">(</span><a name="local-6989586621679079219"><a href="#local-6989586621679079219"><span class="hs-identifier">filename</span></a></a><span class="hs-special">,</span><span class="hs-identifier">_</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
|
||||
</span><a name="line-112"></a><span> </span><span class="hs-glyph">|</span><span> </span><a href="#local-6989586621679079216"><span class="hs-identifier hs-var">id'</span></a><span> </span><span class="hs-operator hs-var">==</span><span> </span><span class="hs-string">"svg"</span><span>
|
||||
</span><a name="line-113"></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">handle</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-special">(</span><a name="local-6989586621679079549"><a href="#local-6989586621679079549"><span class="hs-identifier">fileerror</span></a></a><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">IOException</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-></span><span> </span><span class="hs-identifier hs-var">return</span><span> </span><span class="hs-special">[</span><a href="Text.Pandoc.Util.Filter.html#toHtml"><span class="hs-identifier hs-var">toHtml</span></a><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-string">"Could not read file: "</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><a href="#local-6989586621679079219"><span class="hs-identifier hs-var">filename</span></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-string">"<br />"</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-identifier hs-var">show</span><span> </span><a href="#local-6989586621679079549"><span class="hs-identifier hs-var">fileerror</span></a><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-operator hs-var">$</span><span>
|
||||
</span><a name="line-114"></a><span> </span><span class="hs-keyword">do</span><span>
|
||||
</span><a name="line-115"></a><span> </span><a name="local-6989586621679079690"><a href="#local-6989586621679079690"><span class="hs-identifier">svg</span></a></a><span> </span><span class="hs-glyph"><-</span><span> </span><span class="hs-identifier hs-var">readFile</span><span> </span><a href="#local-6989586621679079219"><span class="hs-identifier hs-var">filename</span></a><span>
|
||||
</span><a name="line-116"></a><span> </span><span class="hs-identifier hs-var">return</span><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-special">[</span><a href="Text.Pandoc.Util.Filter.html#toHtml"><span class="hs-identifier hs-var">toHtml</span></a><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-string">"<figure "</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-identifier hs-var">unwords</span><span> </span><a href="#local-6989586621679079220"><span class="hs-identifier hs-var">direct</span></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-string">" "</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><a href="Text.Pandoc.Util.Filter.html#attToString"><span class="hs-identifier hs-var">attToString</span></a><span> </span><span class="hs-special">(</span><a href="Text.Pandoc.Util.Filter.Media.html#idFilter"><span class="hs-identifier hs-var">idFilter</span></a><span> </span><span class="hs-string">"svg"</span><span> </span><a href="#local-6989586621679079216"><span class="hs-identifier hs-var">id'</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679079221"><span class="hs-identifier hs-var">css</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679079218"><span class="hs-identifier hs-var">att'</span></a><span class="hs-special">)</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-string">">"</span><span class="hs-special">]</span><span> </span><span class="hs-comment">-- use attributes on figure, as svg gets dumped in..</span><span>
|
||||
</span><a name="line-117"></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-special">[</span><a href="Text.Pandoc.Util.Filter.html#toHtml"><span class="hs-identifier hs-var">toHtml</span></a><span> </span><span class="hs-operator hs-var">$</span><span> </span><a href="#local-6989586621679079690"><span class="hs-identifier hs-var">svg</span></a><span class="hs-special">]</span><span>
|
||||
</span><a name="line-118"></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-special">[</span><a href="Text.Pandoc.Util.Filter.html#toHtml"><span class="hs-identifier hs-var">toHtml</span></a><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-string">"</figure>"</span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-119"></a><span> </span><span class="hs-keyword">where</span><span>
|
||||
</span><a name="line-120"></a><span> </span><span class="hs-special">(</span><a name="local-6989586621679079220"><a href="#local-6989586621679079220"><span class="hs-identifier">direct</span></a></a><span class="hs-special">,</span><span> </span><a name="local-6989586621679079221"><a href="#local-6989586621679079221"><span class="hs-identifier">css</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Text.Pandoc.Util.Filter.html#classToRevealAttr"><span class="hs-identifier hs-var">classToRevealAttr</span></a><span> </span><a href="#local-6989586621679079217"><span class="hs-identifier hs-var">att</span></a><span>
|
||||
</span><a name="line-121"></a><span class="hs-identifier">media</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">Image</span><span> </span><span class="hs-special">(</span><a name="local-6989586621679079691"><a href="#local-6989586621679079691"><span class="hs-identifier">id'</span></a></a><span class="hs-special">,</span><span> </span><a name="local-6989586621679079692"><a href="#local-6989586621679079692"><span class="hs-identifier">att</span></a></a><span class="hs-special">,</span><span> </span><a name="local-6989586621679079693"><a href="#local-6989586621679079693"><span class="hs-identifier">att'</span></a></a><span class="hs-special">)</span><span> </span><a name="local-6989586621679079694"><a href="#local-6989586621679079694"><span class="hs-identifier">alt</span></a></a><span> </span><span class="hs-special">(</span><a name="local-6989586621679079695"><a href="#local-6989586621679079695"><span class="hs-identifier">filename</span></a></a><span class="hs-special">,</span><span class="hs-identifier">_</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
|
||||
</span><a name="line-122"></a><span> </span><span class="hs-glyph">|</span><span> </span><a href="#local-6989586621679079691"><span class="hs-identifier hs-var">id'</span></a><span> </span><span class="hs-operator hs-var">==</span><span> </span><span class="hs-string">"svg"</span><span>
|
||||
</span><a name="line-123"></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">handle</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-special">(</span><a name="local-6989586621679079698"><a href="#local-6989586621679079698"><span class="hs-identifier">fileerror</span></a></a><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">IOException</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-></span><span> </span><span class="hs-identifier hs-var">return</span><span> </span><span class="hs-special">[</span><a href="Text.Pandoc.Util.Filter.html#toHtml"><span class="hs-identifier hs-var">toHtml</span></a><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-string">"Could not read file: "</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><a href="#local-6989586621679079695"><span class="hs-identifier hs-var">filename</span></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-string">"<br />"</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-identifier hs-var">show</span><span> </span><a href="#local-6989586621679079698"><span class="hs-identifier hs-var">fileerror</span></a><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-operator hs-var">$</span><span>
|
||||
</span><a name="line-124"></a><span> </span><span class="hs-keyword">do</span><span>
|
||||
</span><a name="line-125"></a><span> </span><a name="local-6989586621679079699"><a href="#local-6989586621679079699"><span class="hs-identifier">svg</span></a></a><span> </span><span class="hs-glyph"><-</span><span> </span><span class="hs-identifier hs-var">readFile</span><span> </span><a href="#local-6989586621679079695"><span class="hs-identifier hs-var">filename</span></a><span>
|
||||
</span><a name="line-126"></a><span> </span><span class="hs-identifier hs-var">return</span><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-special">[</span><a href="Text.Pandoc.Util.Filter.html#toHtml"><span class="hs-identifier hs-var">toHtml</span></a><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-string">"<figure "</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-identifier hs-var">unwords</span><span> </span><a href="#local-6989586621679079696"><span class="hs-identifier hs-var">direct</span></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-string">" "</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><a href="Text.Pandoc.Util.Filter.html#attToString"><span class="hs-identifier hs-var">attToString</span></a><span> </span><span class="hs-special">(</span><a href="Text.Pandoc.Util.Filter.Media.html#idFilter"><span class="hs-identifier hs-var">idFilter</span></a><span> </span><span class="hs-string">"svg"</span><span> </span><a href="#local-6989586621679079691"><span class="hs-identifier hs-var">id'</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679079697"><span class="hs-identifier hs-var">css</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679079693"><span class="hs-identifier hs-var">att'</span></a><span class="hs-special">)</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-string">">"</span><span class="hs-special">]</span><span> </span><span class="hs-comment">-- use attributes on figure, as svg gets dumped in..</span><span>
|
||||
</span><a name="line-127"></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-special">[</span><a href="Text.Pandoc.Util.Filter.html#toHtml"><span class="hs-identifier hs-var">toHtml</span></a><span> </span><span class="hs-operator hs-var">$</span><span> </span><a href="#local-6989586621679079699"><span class="hs-identifier hs-var">svg</span></a><span class="hs-special">]</span><span>
|
||||
</span><a name="line-128"></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-special">[</span><a href="Text.Pandoc.Util.Filter.html#toHtml"><span class="hs-identifier hs-var">toHtml</span></a><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-string">"<figcaption>"</span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-129"></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><a href="#local-6989586621679079694"><span class="hs-identifier hs-var">alt</span></a><span>
|
||||
</span><a name="line-130"></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-special">[</span><a href="Text.Pandoc.Util.Filter.html#toHtml"><span class="hs-identifier hs-var">toHtml</span></a><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-string">"</figcaption></figure>"</span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-131"></a><span> </span><span class="hs-keyword">where</span><span>
|
||||
</span><a name="line-132"></a><span> </span><span class="hs-special">(</span><a name="local-6989586621679079696"><a href="#local-6989586621679079696"><span class="hs-identifier">direct</span></a></a><span class="hs-special">,</span><span> </span><a name="local-6989586621679079697"><a href="#local-6989586621679079697"><span class="hs-identifier">css</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Text.Pandoc.Util.Filter.html#classToRevealAttr"><span class="hs-identifier hs-var">classToRevealAttr</span></a><span> </span><a href="#local-6989586621679079692"><span class="hs-identifier hs-var">att</span></a><span>
|
||||
</span><a name="line-133"></a><span class="hs-comment">--html-demos etc. as IFrames</span><span>
|
||||
</span><a name="line-134"></a><span class="hs-identifier">media</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">Image</span><span> </span><span class="hs-special">(</span><a name="local-6989586621679079700"><a href="#local-6989586621679079700"><span class="hs-identifier">id'</span></a></a><span class="hs-special">,</span><span> </span><a name="local-6989586621679079701"><a href="#local-6989586621679079701"><span class="hs-identifier">att</span></a></a><span class="hs-special">,</span><span> </span><a name="local-6989586621679079702"><a href="#local-6989586621679079702"><span class="hs-identifier">att'</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">(</span><a name="local-6989586621679079703"><a href="#local-6989586621679079703"><span class="hs-identifier">filename</span></a></a><span class="hs-special">,</span><span class="hs-identifier">_</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
|
||||
</span><a name="line-135"></a><span> </span><span class="hs-glyph">|</span><span> </span><a href="#local-6989586621679079700"><span class="hs-identifier hs-var">id'</span></a><span> </span><span class="hs-operator hs-var">==</span><span> </span><span class="hs-string">"demo"</span><span> </span><span class="hs-operator hs-var">||</span><span> </span><a href="Text.Pandoc.Util.Filter.Media.html#checkExtension"><span class="hs-identifier hs-var">checkExtension</span></a><span> </span><a href="#local-6989586621679079703"><span class="hs-identifier hs-var">filename</span></a><span> </span><a href="Text.Pandoc.Util.Filter.Media.html#demoExt"><span class="hs-identifier hs-var">demoExt</span></a><span>
|
||||
</span><a name="line-136"></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">return</span><span> </span><span class="hs-special">[</span><a href="Text.Pandoc.Util.Filter.html#toHtml"><span class="hs-identifier hs-var">toHtml</span></a><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-string">"<iframe "</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-identifier hs-var">unwords</span><span> </span><a href="#local-6989586621679079704"><span class="hs-identifier hs-var">direct</span></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-string">" src=\""</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><a href="#local-6989586621679079703"><span class="hs-identifier hs-var">filename</span></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-string">"?plugin\""</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><a href="Text.Pandoc.Util.Filter.html#attToString"><span class="hs-identifier hs-var">attToString</span></a><span> </span><span class="hs-special">(</span><a href="Text.Pandoc.Util.Filter.Media.html#idFilter"><span class="hs-identifier hs-var">idFilter</span></a><span> </span><span class="hs-string">"demo"</span><span> </span><a href="#local-6989586621679079700"><span class="hs-identifier hs-var">id'</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679079705"><span class="hs-identifier hs-var">css</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679079702"><span class="hs-identifier hs-var">att'</span></a><span class="hs-special">)</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-string">"></iframe>"</span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-137"></a><span> </span><span class="hs-keyword">where</span><span>
|
||||
</span><a name="line-138"></a><span> </span><span class="hs-special">(</span><a name="local-6989586621679079704"><a href="#local-6989586621679079704"><span class="hs-identifier">direct</span></a></a><span class="hs-special">,</span><span> </span><a name="local-6989586621679079705"><a href="#local-6989586621679079705"><span class="hs-identifier">css</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Text.Pandoc.Util.Filter.html#classToRevealAttr"><span class="hs-identifier hs-var">classToRevealAttr</span></a><span> </span><a href="#local-6989586621679079701"><span class="hs-identifier hs-var">att</span></a><span>
|
||||
</span><a name="line-139"></a><span class="hs-identifier">media</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">Image</span><span> </span><span class="hs-special">(</span><a name="local-6989586621679079706"><a href="#local-6989586621679079706"><span class="hs-identifier">id'</span></a></a><span class="hs-special">,</span><span> </span><a name="local-6989586621679079707"><a href="#local-6989586621679079707"><span class="hs-identifier">att</span></a></a><span class="hs-special">,</span><span> </span><a name="local-6989586621679079708"><a href="#local-6989586621679079708"><span class="hs-identifier">att'</span></a></a><span class="hs-special">)</span><span> </span><a name="local-6989586621679079709"><a href="#local-6989586621679079709"><span class="hs-identifier">alt</span></a></a><span> </span><span class="hs-special">(</span><a name="local-6989586621679079710"><a href="#local-6989586621679079710"><span class="hs-identifier">filename</span></a></a><span class="hs-special">,</span><span class="hs-identifier">_</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
|
||||
</span><a name="line-140"></a><span> </span><span class="hs-glyph">|</span><span> </span><a href="#local-6989586621679079706"><span class="hs-identifier hs-var">id'</span></a><span> </span><span class="hs-operator hs-var">==</span><span> </span><span class="hs-string">"demo"</span><span> </span><span class="hs-operator hs-var">||</span><span> </span><a href="Text.Pandoc.Util.Filter.Media.html#checkExtension"><span class="hs-identifier hs-var">checkExtension</span></a><span> </span><a href="#local-6989586621679079710"><span class="hs-identifier hs-var">filename</span></a><span> </span><a href="Text.Pandoc.Util.Filter.Media.html#demoExt"><span class="hs-identifier hs-var">demoExt</span></a><span>
|
||||
</span><a name="line-141"></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">return</span><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-special">[</span><a href="Text.Pandoc.Util.Filter.html#toHtml"><span class="hs-identifier hs-var">toHtml</span></a><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-string">"<figure>"</span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-142"></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-special">[</span><a href="Text.Pandoc.Util.Filter.html#toHtml"><span class="hs-identifier hs-var">toHtml</span></a><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-string">"<iframe "</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-identifier hs-var">unwords</span><span> </span><a href="#local-6989586621679079711"><span class="hs-identifier hs-var">direct</span></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-string">" src=\""</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><a href="#local-6989586621679079710"><span class="hs-identifier hs-var">filename</span></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-string">"?plugin\""</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><a href="Text.Pandoc.Util.Filter.html#attToString"><span class="hs-identifier hs-var">attToString</span></a><span> </span><span class="hs-special">(</span><a href="Text.Pandoc.Util.Filter.Media.html#idFilter"><span class="hs-identifier hs-var">idFilter</span></a><span> </span><span class="hs-string">"demo"</span><span> </span><a href="#local-6989586621679079706"><span class="hs-identifier hs-var">id'</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679079712"><span class="hs-identifier hs-var">css</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679079708"><span class="hs-identifier hs-var">att'</span></a><span class="hs-special">)</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-string">"></iframe>"</span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-143"></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-special">[</span><a href="Text.Pandoc.Util.Filter.html#toHtml"><span class="hs-identifier hs-var">toHtml</span></a><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-string">"<figcaption>"</span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-144"></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><a href="#local-6989586621679079709"><span class="hs-identifier hs-var">alt</span></a><span>
|
||||
</span><a name="line-145"></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-special">[</span><a href="Text.Pandoc.Util.Filter.html#toHtml"><span class="hs-identifier hs-var">toHtml</span></a><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-string">"</figcaption></figure>"</span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-146"></a><span> </span><span class="hs-keyword">where</span><span>
|
||||
</span><a name="line-147"></a><span> </span><span class="hs-special">(</span><a name="local-6989586621679079711"><a href="#local-6989586621679079711"><span class="hs-identifier">direct</span></a></a><span class="hs-special">,</span><span> </span><a name="local-6989586621679079712"><a href="#local-6989586621679079712"><span class="hs-identifier">css</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Text.Pandoc.Util.Filter.html#classToRevealAttr"><span class="hs-identifier hs-var">classToRevealAttr</span></a><span> </span><a href="#local-6989586621679079707"><span class="hs-identifier hs-var">att</span></a><span>
|
||||
</span><a name="line-148"></a><span class="hs-comment">-- if not matched</span><span>
|
||||
</span><a name="line-149"></a><span class="hs-identifier">media</span><span> </span><a name="local-6989586621679079713"><a href="#local-6989586621679079713"><span class="hs-identifier">x</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">return</span><span> </span><span class="hs-special">[</span><a href="#local-6989586621679079713"><span class="hs-identifier hs-var">x</span></a><span class="hs-special">]</span><span>
|
||||
</span><a name="line-150"></a><span>
|
||||
</span><a name="line-151"></a><span class="hs-identifier">checkExtension</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">String</span><span> </span><span class="hs-glyph">-></span><span> </span><span class="hs-special">[</span><span class="hs-identifier hs-type">String</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-></span><span> </span><span class="hs-identifier hs-type">Bool</span><span>
|
||||
</span><a name="line-152"></a><a name="checkExtension"><a href="Text.Pandoc.Util.Filter.Media.html#checkExtension"><span class="hs-identifier">checkExtension</span></a></a><span> </span><a name="local-6989586621679079714"><a href="#local-6989586621679079714"><span class="hs-identifier">fn</span></a></a><span> </span><a name="local-6989586621679079715"><a href="#local-6989586621679079715"><span class="hs-identifier">exts</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">fmap</span><span> </span><span class="hs-identifier hs-var">toLower</span><span> </span><span class="hs-operator hs-var">.</span><span> </span><span class="hs-identifier hs-var">tail</span><span> </span><span class="hs-operator hs-var">.</span><span> </span><span class="hs-identifier hs-var">takeExtension</span><span class="hs-special">)</span><span> </span><a href="#local-6989586621679079714"><span class="hs-identifier hs-var">fn</span></a><span> </span><span class="hs-special">`</span><span class="hs-identifier hs-var">elem</span><span class="hs-special">`</span><span> </span><a href="#local-6989586621679079715"><span class="hs-identifier hs-var">exts</span></a><span>
|
||||
</span><a name="line-153"></a><span>
|
||||
</span><a name="line-154"></a><span class="hs-identifier">idFilter</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">String</span><span> </span><span class="hs-glyph">-></span><span> </span><span class="hs-identifier hs-type">String</span><span> </span><span class="hs-glyph">-></span><span> </span><span class="hs-identifier hs-type">String</span><span>
|
||||
</span><a name="line-155"></a><a name="idFilter"><a href="Text.Pandoc.Util.Filter.Media.html#idFilter"><span class="hs-identifier">idFilter</span></a></a><span> </span><a name="local-6989586621679080112"><a href="#local-6989586621679080112"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679080113"><a href="#local-6989586621679080113"><span class="hs-identifier">b</span></a></a><span>
|
||||
</span><a name="line-156"></a><span> </span><span class="hs-glyph">|</span><span> </span><a href="#local-6989586621679080112"><span class="hs-identifier hs-var">a</span></a><span> </span><span class="hs-operator hs-var">==</span><span> </span><a href="#local-6989586621679080113"><span class="hs-identifier hs-var">b</span></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-string">""</span><span>
|
||||
</span><a name="line-157"></a><span> </span><span class="hs-glyph">|</span><span> </span><span class="hs-identifier hs-var">otherwise</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="#local-6989586621679080113"><span class="hs-identifier hs-var">b</span></a><span>
|
||||
</span><a name="line-158"></a><span>
|
||||
</span><a name="line-159"></a></pre></body></html>
|
40
doc/src/Text.Pandoc.Util.Filter.Quiz.html
Normal file
40
doc/src/Text.Pandoc.Util.Filter.Quiz.html
Normal file
@ -0,0 +1,40 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE ScopedTypeVariables #-}</span><span>
|
||||
</span><a name="line-2"></a><span>
|
||||
</span><a name="line-3"></a><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">Text</span><span class="hs-operator">.</span><span class="hs-identifier">Pandoc</span><span class="hs-operator">.</span><span class="hs-identifier">Util</span><span class="hs-operator">.</span><span class="hs-identifier">Filter</span><span class="hs-operator">.</span><span class="hs-identifier">Quiz</span><span>
|
||||
</span><a name="line-4"></a><span> </span><span class="hs-special">(</span><a href="Text.Pandoc.Util.Filter.Quiz.html#quiz"><span class="hs-identifier hs-var">quiz</span></a><span class="hs-special">)</span><span>
|
||||
</span><a name="line-5"></a><span> </span><span class="hs-keyword">where</span><span>
|
||||
</span><a name="line-6"></a><span>
|
||||
</span><a name="line-7"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Text</span><span class="hs-operator">.</span><span class="hs-identifier">Pandoc</span><span class="hs-operator">.</span><span class="hs-identifier">JSON</span><span>
|
||||
</span><a name="line-8"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Text</span><span class="hs-operator">.</span><span class="hs-identifier">Pandoc</span><span class="hs-operator">.</span><span class="hs-identifier">Walk</span><span>
|
||||
</span><a name="line-9"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Data</span><span class="hs-operator">.</span><span class="hs-identifier">Monoid</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-operator hs-var"><></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
|
||||
</span><a name="line-10"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Data</span><span class="hs-operator">.</span><span class="hs-identifier">Maybe</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">isNothing</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-var">mapMaybe</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-var">listToMaybe</span><span class="hs-special">)</span><span>
|
||||
</span><a name="line-11"></a><span>
|
||||
</span><a name="line-12"></a><span class="hs-comment">-- Move bottom-Up through the structure, find quiz-answers and remove the</span><span>
|
||||
</span><a name="line-13"></a><span class="hs-comment">-- incorrect formattet ones from the Block they came from.</span><span>
|
||||
</span><a name="line-14"></a><span class="hs-identifier">quiz</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Block</span><span> </span><span class="hs-glyph">-></span><span> </span><span class="hs-special">[</span><span class="hs-identifier hs-type">Block</span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-15"></a><a name="quiz"><a href="Text.Pandoc.Util.Filter.Quiz.html#quiz"><span class="hs-identifier">quiz</span></a></a><span> </span><a name="local-6989586621679038523"><a href="#local-6989586621679038523"><span class="hs-identifier">pb</span></a></a><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="hs-identifier hs-var">Plain</span><span> </span><a name="local-6989586621679038524"><a href="#local-6989586621679038524"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">fmap</span><span> </span><a href="Text.Pandoc.Util.Filter.Quiz.html#makeQuiz"><span class="hs-identifier hs-var">makeQuiz</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">query</span><span> </span><a href="Text.Pandoc.Util.Filter.Quiz.html#findQuiz"><span class="hs-identifier hs-var">findQuiz</span></a><span> </span><a href="#local-6989586621679038523"><span class="hs-identifier hs-var">pb</span></a><span class="hs-special">)</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-special">[</span><span class="hs-identifier hs-var">Plain</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">filter</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-operator hs-var">==</span><span class="hs-special">)</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-operator hs-var">.</span><span> </span><a href="Text.Pandoc.Util.Filter.Quiz.html#findQuiz"><span class="hs-identifier hs-var">findQuiz</span></a><span class="hs-special">)</span><span> </span><a href="#local-6989586621679038524"><span class="hs-identifier hs-var">b</span></a><span class="hs-special">)</span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-16"></a><span class="hs-identifier">quiz</span><span> </span><a name="local-6989586621679042244"><a href="#local-6989586621679042244"><span class="hs-identifier">pb</span></a></a><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="hs-identifier hs-var">Para</span><span> </span><a name="local-6989586621679042245"><a href="#local-6989586621679042245"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">fmap</span><span> </span><a href="Text.Pandoc.Util.Filter.Quiz.html#makeQuiz"><span class="hs-identifier hs-var">makeQuiz</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">query</span><span> </span><a href="Text.Pandoc.Util.Filter.Quiz.html#findQuiz"><span class="hs-identifier hs-var">findQuiz</span></a><span> </span><a href="#local-6989586621679042244"><span class="hs-identifier hs-var">pb</span></a><span class="hs-special">)</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-special">[</span><span class="hs-identifier hs-var">Plain</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">filter</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-operator hs-var">==</span><span class="hs-special">)</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-operator hs-var">.</span><span> </span><a href="Text.Pandoc.Util.Filter.Quiz.html#findQuiz"><span class="hs-identifier hs-var">findQuiz</span></a><span class="hs-special">)</span><span> </span><a href="#local-6989586621679042245"><span class="hs-identifier hs-var">b</span></a><span class="hs-special">)</span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-17"></a><span class="hs-identifier">quiz</span><span> </span><a name="local-6989586621679042246"><a href="#local-6989586621679042246"><span class="hs-identifier">x</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><a href="#local-6989586621679042246"><span class="hs-identifier hs-var">x</span></a><span class="hs-special">]</span><span>
|
||||
</span><a name="line-18"></a><span>
|
||||
</span><a name="line-19"></a><span class="hs-comment">-- If we have []{.answer} then we have a quiz-answer</span><span>
|
||||
</span><a name="line-20"></a><span class="hs-comment">-- maybe with a tooltip</span><span>
|
||||
</span><a name="line-21"></a><span class="hs-identifier">findQuiz</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Inline</span><span> </span><span class="hs-glyph">-></span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="hs-identifier hs-type">Attr</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-identifier hs-type">Inline</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">Maybe</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-identifier hs-type">Inline</span><span class="hs-special">]</span><span class="hs-special">,</span><span class="hs-identifier hs-type">Attr</span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-22"></a><a name="findQuiz"><a href="Text.Pandoc.Util.Filter.Quiz.html#findQuiz"><span class="hs-identifier">findQuiz</span></a></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">Span</span><span> </span><a name="local-6989586621679042247"><a href="#local-6989586621679042247"><span class="hs-identifier">attributes</span></a></a><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="hs-identifier">_</span><span class="hs-special">,</span><span> </span><a name="local-6989586621679042248"><a href="#local-6989586621679042248"><span class="hs-identifier">att</span></a></a><span class="hs-special">,</span><span> </span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><a name="local-6989586621679042249"><a href="#local-6989586621679042249"><span class="hs-identifier">answerText</span></a></a><span class="hs-special">)</span><span>
|
||||
</span><a name="line-23"></a><span> </span><span class="hs-glyph">|</span><span> </span><span class="hs-string">"answer"</span><span> </span><span class="hs-special">`</span><span class="hs-identifier hs-var">elem</span><span class="hs-special">`</span><span> </span><a href="#local-6989586621679042248"><span class="hs-identifier hs-var">att</span></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><a href="#local-6989586621679042247"><span class="hs-identifier hs-var">attributes</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679042250"><span class="hs-identifier hs-var">answerText'</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679042251"><span class="hs-identifier hs-var">tooltip</span></a><span class="hs-special">)</span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-24"></a><span> </span><span class="hs-keyword">where</span><span>
|
||||
</span><a name="line-25"></a><span> </span><a name="local-6989586621679042250"><a href="#local-6989586621679042250"><span class="hs-identifier">answerText'</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">filter</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">isNothing</span><span> </span><span class="hs-operator hs-var">.</span><span> </span><a href="Text.Pandoc.Util.Filter.Quiz.html#findTooltip"><span class="hs-identifier hs-var">findTooltip</span></a><span class="hs-special">)</span><span> </span><a href="#local-6989586621679042249"><span class="hs-identifier hs-var">answerText</span></a><span> </span><span class="hs-comment">--filter everything that is a tooltip</span><span>
|
||||
</span><a name="line-26"></a><span> </span><a name="local-6989586621679042251"><a href="#local-6989586621679042251"><span class="hs-identifier">tooltip</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">listToMaybe</span><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-identifier hs-var">mapMaybe</span><span> </span><a href="Text.Pandoc.Util.Filter.Quiz.html#findTooltip"><span class="hs-identifier hs-var">findTooltip</span></a><span> </span><a href="#local-6989586621679042249"><span class="hs-identifier hs-var">answerText</span></a><span> </span><span class="hs-comment">--get the first span that is labled tooltip</span><span>
|
||||
</span><a name="line-27"></a><span class="hs-identifier">findQuiz</span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-28"></a><span>
|
||||
</span><a name="line-29"></a><span class="hs-comment">-- If we have []{.tooltip} we have a tooltip ;)</span><span>
|
||||
</span><a name="line-30"></a><span class="hs-comment">-- we save the text and the attributes in a tuple</span><span>
|
||||
</span><a name="line-31"></a><span class="hs-identifier">findTooltip</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Inline</span><span> </span><span class="hs-glyph">-></span><span> </span><span class="hs-identifier hs-type">Maybe</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-identifier hs-type">Inline</span><span class="hs-special">]</span><span class="hs-special">,</span><span class="hs-identifier hs-type">Attr</span><span class="hs-special">)</span><span>
|
||||
</span><a name="line-32"></a><a name="findTooltip"><a href="Text.Pandoc.Util.Filter.Quiz.html#findTooltip"><span class="hs-identifier">findTooltip</span></a></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">Span</span><span> </span><a name="local-6989586621679043307"><a href="#local-6989586621679043307"><span class="hs-identifier">attr</span></a></a><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="hs-identifier">_</span><span class="hs-special">,</span><a name="local-6989586621679043308"><a href="#local-6989586621679043308"><span class="hs-identifier">att</span></a></a><span class="hs-special">,</span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><a name="local-6989586621679043309"><a href="#local-6989586621679043309"><span class="hs-identifier">tooltipText</span></a></a><span class="hs-special">)</span><span>
|
||||
</span><a name="line-33"></a><span> </span><span class="hs-glyph">|</span><span> </span><span class="hs-string">"tooltip"</span><span> </span><span class="hs-special">`</span><span class="hs-identifier hs-var">elem</span><span class="hs-special">`</span><span> </span><a href="#local-6989586621679043308"><span class="hs-identifier hs-var">att</span></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">Just</span><span> </span><span class="hs-special">(</span><a href="#local-6989586621679043309"><span class="hs-identifier hs-var">tooltipText</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679043307"><span class="hs-identifier hs-var">attr</span></a><span class="hs-special">)</span><span>
|
||||
</span><a name="line-34"></a><span class="hs-identifier">findTooltip</span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">Nothing</span><span>
|
||||
</span><a name="line-35"></a><span>
|
||||
</span><a name="line-36"></a><span class="hs-comment">-- Generate Divs for the quiz</span><span>
|
||||
</span><a name="line-37"></a><span class="hs-identifier">makeQuiz</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Attr</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-identifier hs-type">Inline</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">Maybe</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-identifier hs-type">Inline</span><span class="hs-special">]</span><span class="hs-special">,</span><span class="hs-identifier hs-type">Attr</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-></span><span> </span><span class="hs-identifier hs-type">Block</span><span>
|
||||
</span><a name="line-38"></a><a name="makeQuiz"><a href="Text.Pandoc.Util.Filter.Quiz.html#makeQuiz"><span class="hs-identifier">makeQuiz</span></a></a><span> </span><span class="hs-special">(</span><a name="local-6989586621679043310"><a href="#local-6989586621679043310"><span class="hs-identifier">att</span></a></a><span class="hs-special">,</span><span> </span><a name="local-6989586621679043311"><a href="#local-6989586621679043311"><span class="hs-identifier">answer</span></a></a><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-var">Nothing</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">Div</span><span> </span><a href="#local-6989586621679043310"><span class="hs-identifier hs-var">att</span></a><span> </span><span class="hs-special">[</span><span class="hs-identifier hs-var">Plain</span><span> </span><a href="#local-6989586621679043311"><span class="hs-identifier hs-var">answer</span></a><span class="hs-special">]</span><span>
|
||||
</span><a name="line-39"></a><span class="hs-identifier">makeQuiz</span><span> </span><span class="hs-special">(</span><a name="local-6989586621679043312"><a href="#local-6989586621679043312"><span class="hs-identifier">att</span></a></a><span class="hs-special">,</span><span> </span><a name="local-6989586621679043313"><a href="#local-6989586621679043313"><span class="hs-identifier">answer</span></a></a><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-var">Just</span><span> </span><span class="hs-special">(</span><a name="local-6989586621679043314"><a href="#local-6989586621679043314"><span class="hs-identifier">tooltip</span></a></a><span class="hs-special">,</span><a name="local-6989586621679043315"><a href="#local-6989586621679043315"><span class="hs-identifier">a</span></a></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">Div</span><span> </span><a href="#local-6989586621679043312"><span class="hs-identifier hs-var">att</span></a><span> </span><span class="hs-special">[</span><span class="hs-identifier hs-var">Plain</span><span> </span><a href="#local-6989586621679043313"><span class="hs-identifier hs-var">answer</span></a><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-var">Div</span><span> </span><a href="#local-6989586621679043315"><span class="hs-identifier hs-var">a</span></a><span> </span><span class="hs-special">[</span><span class="hs-identifier hs-var">Plain</span><span> </span><a href="#local-6989586621679043314"><span class="hs-identifier hs-var">tooltip</span></a><span class="hs-special">]</span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-40"></a></pre></body></html>
|
65
doc/src/Text.Pandoc.Util.Filter.Styling.html
Normal file
65
doc/src/Text.Pandoc.Util.Filter.Styling.html
Normal file
@ -0,0 +1,65 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE ScopedTypeVariables #-}</span><span>
|
||||
</span><a name="line-2"></a><span>
|
||||
</span><a name="line-3"></a><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">Text</span><span class="hs-operator">.</span><span class="hs-identifier">Pandoc</span><span class="hs-operator">.</span><span class="hs-identifier">Util</span><span class="hs-operator">.</span><span class="hs-identifier">Filter</span><span class="hs-operator">.</span><span class="hs-identifier">Styling</span><span>
|
||||
</span><a name="line-4"></a><span> </span><span class="hs-special">(</span><a href="Text.Pandoc.Util.Filter.Styling.html#styling"><span class="hs-identifier hs-var">styling</span></a><span class="hs-special">,</span><span> </span><a href="Text.Pandoc.Util.Filter.Styling.html#inlineStyling"><span class="hs-identifier hs-var">inlineStyling</span></a><span class="hs-special">)</span><span>
|
||||
</span><a name="line-5"></a><span> </span><span class="hs-keyword">where</span><span>
|
||||
</span><a name="line-6"></a><span>
|
||||
</span><a name="line-7"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Text</span><span class="hs-operator">.</span><span class="hs-identifier">Pandoc</span><span class="hs-operator">.</span><span class="hs-identifier">JSON</span><span>
|
||||
</span><a name="line-8"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Data</span><span class="hs-operator">.</span><span class="hs-identifier">Monoid</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-operator hs-var"><></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
|
||||
</span><a name="line-9"></a><span class="hs-keyword">import</span><span> </span><a href="Text.Pandoc.Util.Filter.html"><span class="hs-identifier">Text</span><span class="hs-operator">.</span><span class="hs-identifier">Pandoc</span><span class="hs-operator">.</span><span class="hs-identifier">Util</span><span class="hs-operator">.</span><span class="hs-identifier">Filter</span></a><span>
|
||||
</span><a name="line-10"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Prelude</span><span> </span><span class="hs-keyword">hiding</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">div</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-var">span</span><span class="hs-special">)</span><span>
|
||||
</span><a name="line-11"></a><span>
|
||||
</span><a name="line-12"></a><span class="hs-comment">-- | Block-Styling</span><span>
|
||||
</span><a name="line-13"></a><span class="hs-comment">--</span><span>
|
||||
</span><a name="line-14"></a><span class="hs-comment">-- Special cases captured:</span><span>
|
||||
</span><a name="line-15"></a><span class="hs-comment">--</span><span>
|
||||
</span><a name="line-16"></a><span class="hs-comment">-- - #col turns a div into a floating-div for multiple columns</span><span>
|
||||
</span><a name="line-17"></a><span class="hs-comment">-- - CodeBlock gets attributes @data-trim@ and @data-noescape@</span><span>
|
||||
</span><a name="line-18"></a><span class="hs-comment">-- automatically</span><span>
|
||||
</span><a name="line-19"></a><span class="hs-comment">-- - .fragment and .frame work properly on divs</span><span>
|
||||
</span><a name="line-20"></a><span class="hs-identifier">styling</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Block</span><span> </span><span class="hs-glyph">-></span><span> </span><span class="hs-identifier hs-type">IO</span><span> </span><span class="hs-special">[</span><span class="hs-identifier hs-type">Block</span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-21"></a><a name="styling"><a href="Text.Pandoc.Util.Filter.Styling.html#styling"><span class="hs-identifier">styling</span></a></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">Div</span><span> </span><span class="hs-special">(</span><span class="hs-string">"col"</span><span class="hs-special">,</span><a name="local-6989586621679084969"><a href="#local-6989586621679084969"><span class="hs-identifier">att</span></a></a><span class="hs-special">,</span><a name="local-6989586621679084970"><a href="#local-6989586621679084970"><span class="hs-identifier">att'</span></a></a><span class="hs-special">)</span><span> </span><a name="local-6989586621679084971"><a href="#local-6989586621679084971"><span class="hs-identifier">inner</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">return</span><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-special">[</span><a href="Text.Pandoc.Util.Filter.html#toBlockHtml"><span class="hs-identifier hs-var">toBlockHtml</span></a><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-string">"<div style=\"float:left; margin-bottom:10px;\""</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-identifier hs-var">unwords</span><span> </span><a href="#local-6989586621679084972"><span class="hs-identifier hs-var">direct</span></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><a href="Text.Pandoc.Util.Filter.html#attToString"><span class="hs-identifier hs-var">attToString</span></a><span> </span><span class="hs-special">(</span><span class="hs-string">""</span><span class="hs-special">,</span><a href="#local-6989586621679084973"><span class="hs-identifier hs-var">css</span></a><span class="hs-special">,</span><a href="#local-6989586621679084970"><span class="hs-identifier hs-var">att'</span></a><span class="hs-special">)</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-string">">"</span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-22"></a><span> </span><span class="hs-operator hs-var">++</span><span> </span><a href="#local-6989586621679084971"><span class="hs-identifier hs-var">inner</span></a><span>
|
||||
</span><a name="line-23"></a><span> </span><span class="hs-operator hs-var">++</span><span> </span><span class="hs-special">[</span><a href="Text.Pandoc.Util.Filter.html#toBlockHtml"><span class="hs-identifier hs-var">toBlockHtml</span></a><span class="hs-string">"</div>"</span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-24"></a><span> </span><span class="hs-keyword">where</span><span>
|
||||
</span><a name="line-25"></a><span> </span><span class="hs-special">(</span><a name="local-6989586621679084972"><a href="#local-6989586621679084972"><span class="hs-identifier">direct</span></a></a><span class="hs-special">,</span><span> </span><a name="local-6989586621679084973"><a href="#local-6989586621679084973"><span class="hs-identifier">css</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Text.Pandoc.Util.Filter.html#classToRevealAttr"><span class="hs-identifier hs-var">classToRevealAttr</span></a><span> </span><a href="#local-6989586621679084969"><span class="hs-identifier hs-var">att</span></a><span>
|
||||
</span><a name="line-26"></a><span class="hs-identifier">styling</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">CodeBlock</span><span> </span><span class="hs-special">(</span><a name="local-6989586621679084974"><a href="#local-6989586621679084974"><span class="hs-identifier">id'</span></a></a><span class="hs-special">,</span><a name="local-6989586621679084975"><a href="#local-6989586621679084975"><span class="hs-identifier">att</span></a></a><span class="hs-special">,</span><a name="local-6989586621679084976"><a href="#local-6989586621679084976"><span class="hs-identifier">att'</span></a></a><span class="hs-special">)</span><span> </span><a name="local-6989586621679084977"><a href="#local-6989586621679084977"><span class="hs-identifier">inner</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">return</span><span>
|
||||
</span><a name="line-27"></a><span> </span><span class="hs-special">[</span><span class="hs-identifier hs-var">CodeBlock</span><span> </span><span class="hs-special">(</span><a href="#local-6989586621679084974"><span class="hs-identifier hs-var">id'</span></a><span class="hs-special">,</span><span> </span><a href="Text.Pandoc.Util.Filter.html#addToAtt"><span class="hs-identifier hs-var">addToAtt</span></a><span> </span><span class="hs-string">"data-trim"</span><span>
|
||||
</span><a name="line-28"></a><span> </span><span class="hs-operator hs-var">.</span><span> </span><a href="Text.Pandoc.Util.Filter.html#addToAtt"><span class="hs-identifier hs-var">addToAtt</span></a><span> </span><span class="hs-string">"data-noescape"</span><span>
|
||||
</span><a name="line-29"></a><span> </span><span class="hs-operator hs-var">$</span><span> </span><a href="#local-6989586621679084975"><span class="hs-identifier hs-var">att</span></a><span>
|
||||
</span><a name="line-30"></a><span> </span><span class="hs-special">,</span><span> </span><a href="#local-6989586621679084976"><span class="hs-identifier hs-var">att'</span></a><span class="hs-special">)</span><span>
|
||||
</span><a name="line-31"></a><span> </span><a href="#local-6989586621679084977"><span class="hs-identifier hs-var">inner</span></a><span class="hs-special">]</span><span>
|
||||
</span><a name="line-32"></a><span class="hs-identifier">styling</span><span> </span><a name="local-6989586621679084978"><a href="#local-6989586621679084978"><span class="hs-identifier">div</span></a></a><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="hs-identifier hs-var">Div</span><span> </span><span class="hs-special">(</span><a name="local-6989586621679084979"><a href="#local-6989586621679084979"><span class="hs-identifier">id'</span></a></a><span class="hs-special">,</span><a name="local-6989586621679084980"><a href="#local-6989586621679084980"><span class="hs-identifier">att</span></a></a><span class="hs-special">,</span><a name="local-6989586621679084981"><a href="#local-6989586621679084981"><span class="hs-identifier">att'</span></a></a><span class="hs-special">)</span><span> </span><a name="local-6989586621679084982"><a href="#local-6989586621679084982"><span class="hs-identifier">inner</span></a></a><span class="hs-special">)</span><span>
|
||||
</span><a name="line-33"></a><span> </span><span class="hs-glyph">|</span><span> </span><span class="hs-string">"fragment"</span><span> </span><span class="hs-special">`</span><span class="hs-identifier hs-var">elem</span><span class="hs-special">`</span><span> </span><a href="#local-6989586621679084980"><span class="hs-identifier hs-var">att</span></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">return</span><span> </span><span class="hs-special">[</span><span class="hs-identifier hs-var">Div</span><span> </span><span class="hs-special">(</span><a href="#local-6989586621679084979"><span class="hs-identifier hs-var">id'</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679084980"><span class="hs-identifier hs-var">att</span></a><span class="hs-special">,</span><span> </span><a href="Text.Pandoc.Util.Filter.html#addToStyle"><span class="hs-identifier hs-var">addToStyle</span></a><span> </span><span class="hs-string">"display: block;"</span><span> </span><a href="#local-6989586621679084981"><span class="hs-identifier hs-var">att'</span></a><span class="hs-special">)</span><span> </span><a href="#local-6989586621679084982"><span class="hs-identifier hs-var">inner</span></a><span class="hs-special">]</span><span>
|
||||
</span><a name="line-34"></a><span> </span><span class="hs-glyph">|</span><span> </span><span class="hs-string">"frame"</span><span> </span><span class="hs-special">`</span><span class="hs-identifier hs-var">elem</span><span class="hs-special">`</span><span> </span><a href="#local-6989586621679084980"><span class="hs-identifier hs-var">att</span></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">return</span><span> </span><span class="hs-special">[</span><span class="hs-identifier hs-var">Div</span><span> </span><span class="hs-special">(</span><a href="#local-6989586621679084979"><span class="hs-identifier hs-var">id'</span></a><span class="hs-special">,</span><span> </span><a href="Text.Pandoc.Util.Filter.html#addToAtt"><span class="hs-identifier hs-var">addToAtt</span></a><span> </span><span class="hs-string">"fragment"</span><span> </span><span class="hs-comment">--insert fragment</span><span>
|
||||
</span><a name="line-35"></a><span> </span><span class="hs-operator hs-var">.</span><span> </span><a href="Text.Pandoc.Util.Filter.html#addToAtt"><span class="hs-identifier hs-var">addToAtt</span></a><span> </span><span class="hs-string">"current-visible"</span><span> </span><span class="hs-comment">--insert current-visible</span><span>
|
||||
</span><a name="line-36"></a><span> </span><span class="hs-operator hs-var">.</span><span> </span><span class="hs-identifier hs-var">filter</span><span> </span><span class="hs-special">(</span><span class="hs-operator hs-var">/=</span><span> </span><span class="hs-string">"frame"</span><span class="hs-special">)</span><span> </span><span class="hs-comment">--remove frame</span><span>
|
||||
</span><a name="line-37"></a><span> </span><span class="hs-operator hs-var">$</span><span> </span><a href="#local-6989586621679084980"><span class="hs-identifier hs-var">att</span></a><span>
|
||||
</span><a name="line-38"></a><span> </span><span class="hs-special">,</span><span> </span><a href="Text.Pandoc.Util.Filter.html#addToStyle"><span class="hs-identifier hs-var">addToStyle</span></a><span> </span><span class="hs-string">"display: block;"</span><span> </span><a href="#local-6989586621679084981"><span class="hs-identifier hs-var">att'</span></a><span class="hs-special">)</span><span> </span><a href="#local-6989586621679084982"><span class="hs-identifier hs-var">inner</span></a><span class="hs-special">]</span><span>
|
||||
</span><a name="line-39"></a><span> </span><span class="hs-glyph">|</span><span> </span><span class="hs-identifier hs-var">otherwise</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">return</span><span> </span><span class="hs-special">[</span><a href="#local-6989586621679084978"><span class="hs-identifier hs-var">div</span></a><span class="hs-special">]</span><span>
|
||||
</span><a name="line-40"></a><span class="hs-identifier">styling</span><span> </span><a name="local-6989586621679084983"><a href="#local-6989586621679084983"><span class="hs-identifier">x</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">return</span><span> </span><span class="hs-special">[</span><a href="#local-6989586621679084983"><span class="hs-identifier hs-var">x</span></a><span class="hs-special">]</span><span>
|
||||
</span><a name="line-41"></a><span>
|
||||
</span><a name="line-42"></a><span>
|
||||
</span><a name="line-43"></a><span class="hs-comment">-- | Inline-Styling</span><span>
|
||||
</span><a name="line-44"></a><span class="hs-comment">--</span><span>
|
||||
</span><a name="line-45"></a><span class="hs-comment">-- Special cases captured:</span><span>
|
||||
</span><a name="line-46"></a><span class="hs-comment">--</span><span>
|
||||
</span><a name="line-47"></a><span class="hs-comment">-- - .fragment and .frame work properly on spans</span><span>
|
||||
</span><a name="line-48"></a><span class="hs-comment">-- - .vspace inside span adds a vertical space with @height=xxx@</span><span>
|
||||
</span><a name="line-49"></a><span class="hs-comment">-- - .hspace inside span adds a horizontal space with @width=xxx@</span><span>
|
||||
</span><a name="line-50"></a><span class="hs-identifier">inlineStyling</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Inline</span><span> </span><span class="hs-glyph">-></span><span> </span><span class="hs-identifier hs-type">Inline</span><span>
|
||||
</span><a name="line-51"></a><a name="inlineStyling"><a href="Text.Pandoc.Util.Filter.Styling.html#inlineStyling"><span class="hs-identifier">inlineStyling</span></a></a><span> </span><a name="local-6989586621679084984"><a href="#local-6989586621679084984"><span class="hs-identifier">span</span></a></a><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="hs-identifier hs-var">Span</span><span> </span><span class="hs-special">(</span><a name="local-6989586621679084985"><a href="#local-6989586621679084985"><span class="hs-identifier">id'</span></a></a><span class="hs-special">,</span><span> </span><a name="local-6989586621679084986"><a href="#local-6989586621679084986"><span class="hs-identifier">att</span></a></a><span class="hs-special">,</span><span> </span><a name="local-6989586621679084987"><a href="#local-6989586621679084987"><span class="hs-identifier">att'</span></a></a><span class="hs-special">)</span><span> </span><a name="local-6989586621679084988"><a href="#local-6989586621679084988"><span class="hs-identifier">inner</span></a></a><span class="hs-special">)</span><span>
|
||||
</span><a name="line-52"></a><span> </span><span class="hs-glyph">|</span><span> </span><span class="hs-string">"fragment"</span><span> </span><span class="hs-special">`</span><span class="hs-identifier hs-var">elem</span><span class="hs-special">`</span><span> </span><a href="#local-6989586621679084986"><span class="hs-identifier hs-var">att</span></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">Span</span><span> </span><span class="hs-special">(</span><a href="#local-6989586621679084985"><span class="hs-identifier hs-var">id'</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679084986"><span class="hs-identifier hs-var">att</span></a><span class="hs-special">,</span><span> </span><a href="Text.Pandoc.Util.Filter.html#addToStyle"><span class="hs-identifier hs-var">addToStyle</span></a><span> </span><span class="hs-string">"display: inline-block;"</span><span> </span><a href="#local-6989586621679084987"><span class="hs-identifier hs-var">att'</span></a><span class="hs-special">)</span><span> </span><a href="#local-6989586621679084988"><span class="hs-identifier hs-var">inner</span></a><span>
|
||||
</span><a name="line-53"></a><span> </span><span class="hs-glyph">|</span><span> </span><span class="hs-string">"frame"</span><span> </span><span class="hs-special">`</span><span class="hs-identifier hs-var">elem</span><span class="hs-special">`</span><span> </span><a href="#local-6989586621679084986"><span class="hs-identifier hs-var">att</span></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">Span</span><span> </span><span class="hs-special">(</span><a href="#local-6989586621679084985"><span class="hs-identifier hs-var">id'</span></a><span class="hs-special">,</span><span> </span><a href="Text.Pandoc.Util.Filter.html#addToAtt"><span class="hs-identifier hs-var">addToAtt</span></a><span> </span><span class="hs-string">"fragment"</span><span> </span><span class="hs-comment">--insert fragment</span><span>
|
||||
</span><a name="line-54"></a><span> </span><span class="hs-operator hs-var">.</span><span> </span><a href="Text.Pandoc.Util.Filter.html#addToAtt"><span class="hs-identifier hs-var">addToAtt</span></a><span> </span><span class="hs-string">"current-visible"</span><span> </span><span class="hs-comment">--insert current-visible</span><span>
|
||||
</span><a name="line-55"></a><span> </span><span class="hs-operator hs-var">.</span><span> </span><span class="hs-identifier hs-var">filter</span><span> </span><span class="hs-special">(</span><span class="hs-operator hs-var">/=</span><span> </span><span class="hs-string">"frame"</span><span class="hs-special">)</span><span> </span><span class="hs-comment">--remove frame</span><span>
|
||||
</span><a name="line-56"></a><span> </span><span class="hs-operator hs-var">$</span><span> </span><a href="#local-6989586621679084986"><span class="hs-identifier hs-var">att</span></a><span>
|
||||
</span><a name="line-57"></a><span> </span><span class="hs-special">,</span><span> </span><a href="Text.Pandoc.Util.Filter.html#addToStyle"><span class="hs-identifier hs-var">addToStyle</span></a><span> </span><span class="hs-string">"display: inline-block;"</span><span> </span><a href="#local-6989586621679084987"><span class="hs-identifier hs-var">att'</span></a><span class="hs-special">)</span><span> </span><a href="#local-6989586621679084988"><span class="hs-identifier hs-var">inner</span></a><span>
|
||||
</span><a name="line-58"></a><span> </span><span class="hs-glyph">|</span><span> </span><a href="#local-6989586621679084985"><span class="hs-identifier hs-var">id'</span></a><span> </span><span class="hs-operator hs-var">==</span><span> </span><span class="hs-string">"vspace"</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Text.Pandoc.Util.Filter.html#toHtml"><span class="hs-identifier hs-var">toHtml</span></a><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-string">"<div style=\"clear:both;\""</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-identifier hs-var">unwords</span><span> </span><a href="#local-6989586621679084989"><span class="hs-identifier hs-var">direct</span></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><a href="Text.Pandoc.Util.Filter.html#attToString"><span class="hs-identifier hs-var">attToString</span></a><span> </span><span class="hs-special">(</span><span class="hs-string">""</span><span class="hs-special">,</span><a href="#local-6989586621679084990"><span class="hs-identifier hs-var">css</span></a><span class="hs-special">,</span><a href="#local-6989586621679084987"><span class="hs-identifier hs-var">att'</span></a><span class="hs-special">)</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-string">"></div>"</span><span>
|
||||
</span><a name="line-59"></a><span> </span><span class="hs-glyph">|</span><span> </span><a href="#local-6989586621679084985"><span class="hs-identifier hs-var">id'</span></a><span> </span><span class="hs-operator hs-var">==</span><span> </span><span class="hs-string">"hspace"</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Text.Pandoc.Util.Filter.html#toHtml"><span class="hs-identifier hs-var">toHtml</span></a><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-string">"<span "</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-identifier hs-var">unwords</span><span> </span><a href="#local-6989586621679084989"><span class="hs-identifier hs-var">direct</span></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><a href="Text.Pandoc.Util.Filter.html#attToString"><span class="hs-identifier hs-var">attToString</span></a><span> </span><span class="hs-special">(</span><span class="hs-string">""</span><span class="hs-special">,</span><a href="#local-6989586621679084990"><span class="hs-identifier hs-var">css</span></a><span class="hs-special">,</span><a href="#local-6989586621679084987"><span class="hs-identifier hs-var">att'</span></a><span class="hs-special">)</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-string">"></span>"</span><span>
|
||||
</span><a name="line-60"></a><span> </span><span class="hs-glyph">|</span><span> </span><span class="hs-identifier hs-var">otherwise</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="#local-6989586621679084984"><span class="hs-identifier hs-var">span</span></a><span>
|
||||
</span><a name="line-61"></a><span> </span><span class="hs-keyword">where</span><span>
|
||||
</span><a name="line-62"></a><span> </span><span class="hs-special">(</span><a name="local-6989586621679084989"><a href="#local-6989586621679084989"><span class="hs-identifier">direct</span></a></a><span class="hs-special">,</span><span> </span><a name="local-6989586621679084990"><a href="#local-6989586621679084990"><span class="hs-identifier">css</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Text.Pandoc.Util.Filter.html#classToRevealAttr"><span class="hs-identifier hs-var">classToRevealAttr</span></a><span> </span><a href="#local-6989586621679084986"><span class="hs-identifier hs-var">att</span></a><span>
|
||||
</span><a name="line-63"></a><span class="hs-identifier">inlineStyling</span><span> </span><a name="local-6989586621679084991"><a href="#local-6989586621679084991"><span class="hs-identifier">x</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="#local-6989586621679084991"><span class="hs-identifier hs-var">x</span></a><span>
|
||||
</span><a name="line-64"></a><span>
|
||||
</span><a name="line-65"></a></pre></body></html>
|
103
doc/src/Text.Pandoc.Util.Filter.html
Normal file
103
doc/src/Text.Pandoc.Util.Filter.html
Normal file
@ -0,0 +1,103 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">Text</span><span class="hs-operator">.</span><span class="hs-identifier">Pandoc</span><span class="hs-operator">.</span><span class="hs-identifier">Util</span><span class="hs-operator">.</span><span class="hs-identifier">Filter</span><span>
|
||||
</span><a name="line-2"></a><span> </span><span class="hs-special">(</span><span> </span><a href="Text.Pandoc.Util.Filter.html#attToString"><span class="hs-identifier hs-var">attToString</span></a><span>
|
||||
</span><a name="line-3"></a><span> </span><span class="hs-special">,</span><span> </span><a href="Text.Pandoc.Util.Filter.html#revealjsSpecialAttrs"><span class="hs-identifier hs-var">revealjsSpecialAttrs</span></a><span>
|
||||
</span><a name="line-4"></a><span> </span><span class="hs-special">,</span><span> </span><a href="Text.Pandoc.Util.Filter.html#classToRevealAttr"><span class="hs-identifier hs-var">classToRevealAttr</span></a><span>
|
||||
</span><a name="line-5"></a><span> </span><span class="hs-special">,</span><span> </span><a href="Text.Pandoc.Util.Filter.html#toHtml"><span class="hs-identifier hs-var">toHtml</span></a><span>
|
||||
</span><a name="line-6"></a><span> </span><span class="hs-special">,</span><span> </span><a href="Text.Pandoc.Util.Filter.html#toBlockHtml"><span class="hs-identifier hs-var">toBlockHtml</span></a><span>
|
||||
</span><a name="line-7"></a><span> </span><span class="hs-special">,</span><span> </span><a href="Text.Pandoc.Util.Filter.html#addToAtt"><span class="hs-identifier hs-var">addToAtt</span></a><span>
|
||||
</span><a name="line-8"></a><span> </span><span class="hs-special">,</span><span> </span><a href="Text.Pandoc.Util.Filter.html#addToStyle"><span class="hs-identifier hs-var">addToStyle</span></a><span>
|
||||
</span><a name="line-9"></a><span> </span><span class="hs-special">)</span><span>
|
||||
</span><a name="line-10"></a><span> </span><span class="hs-keyword">where</span><span>
|
||||
</span><a name="line-11"></a><span>
|
||||
</span><a name="line-12"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Text</span><span class="hs-operator">.</span><span class="hs-identifier">Pandoc</span><span class="hs-operator">.</span><span class="hs-identifier">Definition</span><span>
|
||||
</span><a name="line-13"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Data</span><span class="hs-operator">.</span><span class="hs-identifier">Monoid</span><span>
|
||||
</span><a name="line-14"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Data</span><span class="hs-operator">.</span><span class="hs-identifier">List</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">partition</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-var">isInfixOf</span><span class="hs-special">)</span><span>
|
||||
</span><a name="line-15"></a><span>
|
||||
</span><a name="line-16"></a><span class="hs-comment">-- | adds a given String to the list if not in there; Does nothing if the</span><span>
|
||||
</span><a name="line-17"></a><span class="hs-comment">-- given String is already present.</span><span>
|
||||
</span><a name="line-18"></a><span class="hs-identifier">addToAtt</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Eq</span><span> </span><a href="#local-6989586621679076134"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-glyph">=></span><span> </span><a href="#local-6989586621679076134"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-glyph">-></span><span> </span><span class="hs-special">[</span><a href="#local-6989586621679076134"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">]</span><span> </span><span class="hs-glyph">-></span><span> </span><span class="hs-special">[</span><a href="#local-6989586621679076134"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">]</span><span>
|
||||
</span><a name="line-19"></a><a name="addToAtt"><a href="Text.Pandoc.Util.Filter.html#addToAtt"><span class="hs-identifier">addToAtt</span></a></a><span> </span><a name="local-6989586621679076135"><a href="#local-6989586621679076135"><span class="hs-identifier">toAdd</span></a></a><span> </span><span class="hs-special">(</span><a name="local-6989586621679076136"><a href="#local-6989586621679076136"><span class="hs-identifier">a</span></a></a><span class="hs-glyph">:</span><span class="hs-keyword">as</span><span class="hs-special">)</span><span>
|
||||
</span><a name="line-20"></a><span> </span><span class="hs-glyph">|</span><span> </span><a href="#local-6989586621679076136"><span class="hs-identifier hs-var">a</span></a><span> </span><span class="hs-operator hs-var">==</span><span> </span><a href="#local-6989586621679076135"><span class="hs-identifier hs-var">toAdd</span></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="#local-6989586621679076135"><span class="hs-identifier hs-var">toAdd</span></a><span class="hs-glyph">:</span><span class="hs-keyword">as</span><span>
|
||||
</span><a name="line-21"></a><span> </span><span class="hs-glyph">|</span><span> </span><span class="hs-identifier hs-var">otherwise</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="#local-6989586621679076136"><span class="hs-identifier hs-var">a</span></a><span class="hs-glyph">:</span><a href="Text.Pandoc.Util.Filter.html#addToAtt"><span class="hs-identifier hs-var">addToAtt</span></a><span> </span><a href="#local-6989586621679076135"><span class="hs-identifier hs-var">toAdd</span></a><span> </span><span class="hs-keyword">as</span><span>
|
||||
</span><a name="line-22"></a><span class="hs-identifier">addToAtt</span><span> </span><a name="local-6989586621679076138"><a href="#local-6989586621679076138"><span class="hs-identifier">toAdd</span></a></a><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><a href="#local-6989586621679076138"><span class="hs-identifier hs-var">toAdd</span></a><span class="hs-special">]</span><span>
|
||||
</span><a name="line-23"></a><span>
|
||||
</span><a name="line-24"></a><span class="hs-comment">-- | adds given String to List of key-value-pairs (like in 'Attr')</span><span>
|
||||
</span><a name="line-25"></a><span class="hs-comment">-- in the \"style\"-Key.</span><span>
|
||||
</span><a name="line-26"></a><span class="hs-comment">--</span><span>
|
||||
</span><a name="line-27"></a><span class="hs-comment">-- Useful when trying to add CSS-styles directly to (generated) elements</span><span>
|
||||
</span><a name="line-28"></a><span class="hs-identifier">addToStyle</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">String</span><span> </span><span class="hs-glyph">-></span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="hs-identifier hs-type">String</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">String</span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-></span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="hs-identifier hs-type">String</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">String</span><span class="hs-special">)</span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-29"></a><span class="hs-comment">-- we are looking for style and inject</span><span>
|
||||
</span><a name="line-30"></a><a name="addToStyle"><a href="Text.Pandoc.Util.Filter.html#addToStyle"><span class="hs-identifier">addToStyle</span></a></a><span> </span><a name="local-6989586621679076139"><a href="#local-6989586621679076139"><span class="hs-identifier">toAdd</span></a></a><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-string">"style"</span><span class="hs-special">,</span><a name="local-6989586621679076140"><a href="#local-6989586621679076140"><span class="hs-identifier">val</span></a></a><span class="hs-special">)</span><span class="hs-glyph">:</span><span class="hs-keyword">as</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-string">"style"</span><span class="hs-special">,</span><span> </span><span class="hs-keyword">if</span><span> </span><a href="#local-6989586621679076139"><span class="hs-identifier hs-var">toAdd</span></a><span> </span><span class="hs-special">`</span><span class="hs-identifier hs-var">isInfixOf</span><span class="hs-special">`</span><span> </span><a href="#local-6989586621679076140"><span class="hs-identifier hs-var">val</span></a><span> </span><span class="hs-keyword">then</span><span> </span><a href="#local-6989586621679076140"><span class="hs-identifier hs-var">val</span></a><span> </span><span class="hs-keyword">else</span><span> </span><a href="#local-6989586621679076140"><span class="hs-identifier hs-var">val</span></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-string">" "</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><a href="#local-6989586621679076139"><span class="hs-identifier hs-var">toAdd</span></a><span class="hs-special">)</span><span class="hs-glyph">:</span><span class="hs-keyword">as</span><span>
|
||||
</span><a name="line-31"></a><span class="hs-comment">-- if we land here the current one is not style -> skip</span><span>
|
||||
</span><a name="line-32"></a><span class="hs-identifier">addToStyle</span><span> </span><a name="local-6989586621679076271"><a href="#local-6989586621679076271"><span class="hs-identifier">toAdd</span></a></a><span> </span><span class="hs-special">(</span><a name="local-6989586621679076272"><a href="#local-6989586621679076272"><span class="hs-identifier">a</span></a></a><span class="hs-glyph">:</span><span class="hs-keyword">as</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="#local-6989586621679076272"><span class="hs-identifier hs-var">a</span></a><span class="hs-glyph">:</span><a href="Text.Pandoc.Util.Filter.html#addToStyle"><span class="hs-identifier hs-var">addToStyle</span></a><span> </span><a href="#local-6989586621679076271"><span class="hs-identifier hs-var">toAdd</span></a><span> </span><span class="hs-keyword">as</span><span>
|
||||
</span><a name="line-33"></a><span class="hs-comment">-- if we land here we have no more to skip -> add</span><span>
|
||||
</span><a name="line-34"></a><span class="hs-identifier">addToStyle</span><span> </span><a name="local-6989586621679076274"><a href="#local-6989586621679076274"><span class="hs-identifier">toAdd</span></a></a><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="hs-string">"style"</span><span class="hs-special">,</span><span> </span><a href="#local-6989586621679076274"><span class="hs-identifier hs-var">toAdd</span></a><span class="hs-special">)</span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-35"></a><span>
|
||||
</span><a name="line-36"></a><span class="hs-comment">-- | converts Attributes to String for usage in HTML</span><span>
|
||||
</span><a name="line-37"></a><span class="hs-comment">--</span><span>
|
||||
</span><a name="line-38"></a><span class="hs-comment">-- Also converts @width=xxx@ and @height=xxx@ to the</span><span>
|
||||
</span><a name="line-39"></a><span class="hs-comment">-- corresponding style-attributes</span><span>
|
||||
</span><a name="line-40"></a><span class="hs-identifier">attToString</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Attr</span><span> </span><span class="hs-glyph">-></span><span> </span><span class="hs-identifier hs-type">String</span><span>
|
||||
</span><a name="line-41"></a><a name="attToString"><a href="Text.Pandoc.Util.Filter.html#attToString"><span class="hs-identifier">attToString</span></a></a><span> </span><span class="hs-special">(</span><span class="hs-string">""</span><span class="hs-special">,</span><span> </span><a name="local-6989586621679076275"><a href="#local-6989586621679076275"><span class="hs-identifier">classes</span></a></a><span class="hs-special">,</span><span> </span><a name="local-6989586621679076276"><a href="#local-6989586621679076276"><span class="hs-identifier">kvpairs</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-string">"class=\""</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-identifier hs-var">unwords</span><span> </span><a href="#local-6989586621679076275"><span class="hs-identifier hs-var">classes</span></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-string">"\" "</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-identifier hs-var">unwords</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-special">(</span><a name="local-6989586621679076278"><a href="#local-6989586621679076278"><span class="hs-identifier">k</span></a></a><span class="hs-special">,</span><a name="local-6989586621679076279"><a href="#local-6989586621679076279"><span class="hs-identifier">v</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">-></span><span> </span><a href="#local-6989586621679076278"><span class="hs-identifier hs-var">k</span></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-string">"=\""</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><a href="#local-6989586621679076279"><span class="hs-identifier hs-var">v</span></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-string">"\""</span><span class="hs-special">)</span><span> </span><span class="hs-operator hs-var"><$></span><span> </span><a href="#local-6989586621679076277"><span class="hs-identifier hs-var">kvpairs'</span></a><span class="hs-special">)</span><span>
|
||||
</span><a name="line-42"></a><span> </span><span class="hs-keyword">where</span><span>
|
||||
</span><a name="line-43"></a><span> </span><a name="local-6989586621679076277"><a href="#local-6989586621679076277"><span class="hs-identifier">kvpairs'</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Text.Pandoc.Util.Filter.html#convertToStyle"><span class="hs-identifier hs-var">convertToStyle</span></a><span> </span><span class="hs-special">[</span><span class="hs-string">"width"</span><span class="hs-special">,</span><span class="hs-string">"height"</span><span class="hs-special">,</span><span class="hs-string">"transform"</span><span class="hs-special">]</span><span> </span><a href="#local-6989586621679076276"><span class="hs-identifier hs-var">kvpairs</span></a><span>
|
||||
</span><a name="line-44"></a><span class="hs-identifier">attToString</span><span> </span><span class="hs-special">(</span><a name="local-6989586621679076289"><a href="#local-6989586621679076289"><span class="hs-identifier">id'</span></a></a><span class="hs-special">,</span><span> </span><a name="local-6989586621679076290"><a href="#local-6989586621679076290"><span class="hs-identifier">classes</span></a></a><span class="hs-special">,</span><span> </span><a name="local-6989586621679076291"><a href="#local-6989586621679076291"><span class="hs-identifier">kvpairs</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-string">"id=\""</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><a href="#local-6989586621679076289"><span class="hs-identifier hs-var">id'</span></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-string">"\" class=\""</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-identifier hs-var">unwords</span><span> </span><a href="#local-6989586621679076290"><span class="hs-identifier hs-var">classes</span></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-string">"\" "</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-identifier hs-var">unwords</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-special">(</span><a name="local-6989586621679076293"><a href="#local-6989586621679076293"><span class="hs-identifier">k</span></a></a><span class="hs-special">,</span><a name="local-6989586621679076294"><a href="#local-6989586621679076294"><span class="hs-identifier">v</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">-></span><span> </span><a href="#local-6989586621679076293"><span class="hs-identifier hs-var">k</span></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-string">"=\""</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><a href="#local-6989586621679076294"><span class="hs-identifier hs-var">v</span></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-string">"\""</span><span class="hs-special">)</span><span> </span><span class="hs-operator hs-var"><$></span><span> </span><a href="#local-6989586621679076292"><span class="hs-identifier hs-var">kvpairs'</span></a><span class="hs-special">)</span><span>
|
||||
</span><a name="line-45"></a><span> </span><span class="hs-keyword">where</span><span>
|
||||
</span><a name="line-46"></a><span> </span><a name="local-6989586621679076292"><a href="#local-6989586621679076292"><span class="hs-identifier">kvpairs'</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Text.Pandoc.Util.Filter.html#convertToStyle"><span class="hs-identifier hs-var">convertToStyle</span></a><span> </span><span class="hs-special">[</span><span class="hs-string">"width"</span><span class="hs-special">,</span><span class="hs-string">"height"</span><span class="hs-special">,</span><span class="hs-string">"transform"</span><span class="hs-special">]</span><span> </span><a href="#local-6989586621679076291"><span class="hs-identifier hs-var">kvpairs</span></a><span>
|
||||
</span><a name="line-47"></a><span>
|
||||
</span><a name="line-48"></a><span class="hs-identifier">convertToStyle</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-identifier hs-type">String</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-></span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="hs-identifier hs-type">String</span><span class="hs-special">,</span><span class="hs-identifier hs-type">String</span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-></span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="hs-identifier hs-type">String</span><span class="hs-special">,</span><span class="hs-identifier hs-type">String</span><span class="hs-special">)</span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-49"></a><a name="convertToStyle"><a href="Text.Pandoc.Util.Filter.html#convertToStyle"><span class="hs-identifier">convertToStyle</span></a></a><span> </span><a name="local-6989586621679076295"><a href="#local-6989586621679076295"><span class="hs-identifier">keys</span></a></a><span> </span><a name="local-6989586621679076296"><a href="#local-6989586621679076296"><span class="hs-identifier">kvpairs</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-string">"style"</span><span class="hs-special">,</span><span> </span><a href="#local-6989586621679076300"><span class="hs-identifier hs-var">newstyle</span></a><span class="hs-special">)</span><span class="hs-glyph">:</span><a href="#local-6989586621679076299"><span class="hs-identifier hs-var">rest</span></a><span>
|
||||
</span><a name="line-50"></a><span> </span><span class="hs-keyword">where</span><span>
|
||||
</span><a name="line-51"></a><span> </span><a name="local-6989586621679076297"><a href="#local-6989586621679076297"><span class="hs-identifier">oldstyle</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="hs-identifier hs-var">filter</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-special">(</span><a name="local-6989586621679076301"><a href="#local-6989586621679076301"><span class="hs-identifier">k</span></a></a><span class="hs-special">,</span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-></span><span> </span><a href="#local-6989586621679076301"><span class="hs-identifier hs-var">k</span></a><span> </span><span class="hs-operator hs-var">==</span><span> </span><span class="hs-string">"style"</span><span class="hs-special">)</span><span> </span><a href="#local-6989586621679076296"><span class="hs-identifier hs-var">kvpairs</span></a><span> </span><span class="hs-keyword">of</span><span>
|
||||
</span><a name="line-52"></a><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="hs-identifier">_</span><span class="hs-special">,</span><a name="local-6989586621679076302"><a href="#local-6989586621679076302"><span class="hs-identifier">st</span></a></a><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-></span><span> </span><a href="#local-6989586621679076302"><span class="hs-identifier hs-var">st</span></a><span>
|
||||
</span><a name="line-53"></a><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">-></span><span> </span><span class="hs-string">""</span><span>
|
||||
</span><a name="line-54"></a><span> </span><a name="local-6989586621679076298"><a href="#local-6989586621679076298"><span class="hs-identifier">stylesToAdd</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">filter</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-special">(</span><a name="local-6989586621679076303"><a href="#local-6989586621679076303"><span class="hs-identifier">k</span></a></a><span class="hs-special">,</span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-></span><span> </span><a href="#local-6989586621679076303"><span class="hs-identifier hs-var">k</span></a><span> </span><span class="hs-special">`</span><span class="hs-identifier hs-var">elem</span><span class="hs-special">`</span><span> </span><a href="#local-6989586621679076295"><span class="hs-identifier hs-var">keys</span></a><span class="hs-special">)</span><span> </span><a href="#local-6989586621679076296"><span class="hs-identifier hs-var">kvpairs</span></a><span>
|
||||
</span><a name="line-55"></a><span> </span><a name="local-6989586621679076299"><a href="#local-6989586621679076299"><span class="hs-identifier">rest</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">filter</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-special">(</span><a name="local-6989586621679076304"><a href="#local-6989586621679076304"><span class="hs-identifier">k</span></a></a><span class="hs-special">,</span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-></span><span> </span><a href="#local-6989586621679076304"><span class="hs-identifier hs-var">k</span></a><span> </span><span class="hs-special">`</span><span class="hs-identifier hs-var">notElem</span><span class="hs-special">`</span><span> </span><a href="#local-6989586621679076295"><span class="hs-identifier hs-var">keys</span></a><span class="hs-special">)</span><span> </span><a href="#local-6989586621679076296"><span class="hs-identifier hs-var">kvpairs</span></a><span>
|
||||
</span><a name="line-56"></a><span> </span><a name="local-6989586621679076300"><a href="#local-6989586621679076300"><span class="hs-identifier">newstyle</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">concat</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-special">(</span><a name="local-6989586621679076305"><a href="#local-6989586621679076305"><span class="hs-identifier">k</span></a></a><span class="hs-special">,</span><a name="local-6989586621679076306"><a href="#local-6989586621679076306"><span class="hs-identifier">v</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">-></span><span> </span><a href="#local-6989586621679076305"><span class="hs-identifier hs-var">k</span></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-string">":"</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><a href="#local-6989586621679076306"><span class="hs-identifier hs-var">v</span></a><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-string">";"</span><span class="hs-special">)</span><span> </span><span class="hs-operator hs-var"><$></span><span> </span><a href="#local-6989586621679076298"><span class="hs-identifier hs-var">stylesToAdd</span></a><span class="hs-special">)</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><a href="#local-6989586621679076297"><span class="hs-identifier hs-var">oldstyle</span></a><span>
|
||||
</span><a name="line-57"></a><span>
|
||||
</span><a name="line-58"></a><span class="hs-comment">-- | revealjs has some special attributes that has to be</span><span>
|
||||
</span><a name="line-59"></a><span class="hs-comment">-- passed to the html, but Pandoc only allows</span><span>
|
||||
</span><a name="line-60"></a><span class="hs-comment">-- @key=value@-attributes, so we have to abuse</span><span>
|
||||
</span><a name="line-61"></a><span class="hs-comment">-- @.class@ to rewrite them.</span><span>
|
||||
</span><a name="line-62"></a><span class="hs-comment">--</span><span>
|
||||
</span><a name="line-63"></a><span class="hs-comment">-- The classes that get rewritten are listed here.</span><span>
|
||||
</span><a name="line-64"></a><span class="hs-comment">--</span><span>
|
||||
</span><a name="line-65"></a><span class="hs-comment">-- You probably want 'classToRevealAttr', as that</span><span>
|
||||
</span><a name="line-66"></a><span class="hs-comment">-- is a wrapper for splitting the class-attribute</span><span>
|
||||
</span><a name="line-67"></a><span class="hs-identifier">revealjsSpecialAttrs</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-identifier hs-type">String</span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-68"></a><a name="revealjsSpecialAttrs"><a href="Text.Pandoc.Util.Filter.html#revealjsSpecialAttrs"><span class="hs-identifier">revealjsSpecialAttrs</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span>
|
||||
</span><a name="line-69"></a><span> </span><span class="hs-special">[</span><span> </span><span class="hs-string">"data-markdown"</span><span>
|
||||
</span><a name="line-70"></a><span> </span><span class="hs-special">,</span><span> </span><span class="hs-string">"data-timing"</span><span>
|
||||
</span><a name="line-71"></a><span> </span><span class="hs-special">,</span><span> </span><span class="hs-string">"data-template"</span><span>
|
||||
</span><a name="line-72"></a><span> </span><span class="hs-special">,</span><span> </span><span class="hs-string">"data-autoplay"</span><span>
|
||||
</span><a name="line-73"></a><span> </span><span class="hs-special">,</span><span> </span><span class="hs-string">"data-prevent-swipe"</span><span>
|
||||
</span><a name="line-74"></a><span> </span><span class="hs-special">,</span><span> </span><span class="hs-string">"data-background-interactive"</span><span>
|
||||
</span><a name="line-75"></a><span> </span><span class="hs-special">,</span><span> </span><span class="hs-string">"data-trim"</span><span>
|
||||
</span><a name="line-76"></a><span> </span><span class="hs-special">,</span><span> </span><span class="hs-string">"data-noescape"</span><span>
|
||||
</span><a name="line-77"></a><span> </span><span class="hs-special">,</span><span> </span><span class="hs-string">"data-ignore"</span><span>
|
||||
</span><a name="line-78"></a><span> </span><span class="hs-special">,</span><span> </span><span class="hs-string">"controls"</span><span>
|
||||
</span><a name="line-79"></a><span> </span><span class="hs-special">]</span><span>
|
||||
</span><a name="line-80"></a><span>
|
||||
</span><a name="line-81"></a><span class="hs-comment">-- | revealjs has some special attributes that has to be</span><span>
|
||||
</span><a name="line-82"></a><span class="hs-comment">-- passed to the html, but Pandoc only allows</span><span>
|
||||
</span><a name="line-83"></a><span class="hs-comment">-- @key=value@-attributes, so we have to abuse</span><span>
|
||||
</span><a name="line-84"></a><span class="hs-comment">-- @.class@ to rewrite them.</span><span>
|
||||
</span><a name="line-85"></a><span class="hs-comment">--</span><span>
|
||||
</span><a name="line-86"></a><span class="hs-comment">-- This is a wrapper-function which just splits the list</span><span>
|
||||
</span><a name="line-87"></a><span class="hs-comment">-- into real classes and 'revealjsSpecialAttrs'</span><span>
|
||||
</span><a name="line-88"></a><span class="hs-identifier">classToRevealAttr</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-identifier hs-type">String</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-></span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-identifier hs-type">String</span><span class="hs-special">]</span><span class="hs-special">,</span><span class="hs-special">[</span><span class="hs-identifier hs-type">String</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
|
||||
</span><a name="line-89"></a><a name="classToRevealAttr"><a href="Text.Pandoc.Util.Filter.html#classToRevealAttr"><span class="hs-identifier">classToRevealAttr</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">partition</span><span> </span><span class="hs-special">(</span><span class="hs-special">`</span><span class="hs-identifier hs-var">elem</span><span class="hs-special">`</span><span> </span><a href="Text.Pandoc.Util.Filter.html#revealjsSpecialAttrs"><span class="hs-identifier hs-var">revealjsSpecialAttrs</span></a><span class="hs-special">)</span><span>
|
||||
</span><a name="line-90"></a><span>
|
||||
</span><a name="line-91"></a><span class="hs-comment">-- | small wrapper around @RawInline (Format "html")@</span><span>
|
||||
</span><a name="line-92"></a><span class="hs-comment">-- as this is less line-noise in the filters and the</span><span>
|
||||
</span><a name="line-93"></a><span class="hs-comment">-- intent is more clear.</span><span>
|
||||
</span><a name="line-94"></a><span class="hs-identifier">toHtml</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">String</span><span> </span><span class="hs-glyph">-></span><span> </span><span class="hs-identifier hs-type">Inline</span><span>
|
||||
</span><a name="line-95"></a><a name="toHtml"><a href="Text.Pandoc.Util.Filter.html#toHtml"><span class="hs-identifier">toHtml</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">RawInline</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">Format</span><span> </span><span class="hs-string">"html"</span><span class="hs-special">)</span><span>
|
||||
</span><a name="line-96"></a><span>
|
||||
</span><a name="line-97"></a><span>
|
||||
</span><a name="line-98"></a><span class="hs-comment">-- | small wrapper around @Raw (Format "html")@</span><span>
|
||||
</span><a name="line-99"></a><span class="hs-comment">-- as this is less line-noise in the filters and the</span><span>
|
||||
</span><a name="line-100"></a><span class="hs-comment">-- intent is more clear.</span><span>
|
||||
</span><a name="line-101"></a><span class="hs-identifier">toBlockHtml</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">String</span><span> </span><span class="hs-glyph">-></span><span> </span><span class="hs-identifier hs-type">Block</span><span>
|
||||
</span><a name="line-102"></a><a name="toBlockHtml"><a href="Text.Pandoc.Util.Filter.html#toBlockHtml"><span class="hs-identifier">toBlockHtml</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">RawBlock</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">Format</span><span> </span><span class="hs-string">"html"</span><span class="hs-special">)</span><span>
|
||||
</span><a name="line-103"></a></pre></body></html>
|
27
doc/src/highlight.js
Normal file
27
doc/src/highlight.js
Normal file
@ -0,0 +1,27 @@
|
||||
|
||||
var highlight = function (on) {
|
||||
return function () {
|
||||
var links = document.getElementsByTagName('a');
|
||||
for (var i = 0; i < links.length; i++) {
|
||||
var that = links[i];
|
||||
|
||||
if (this.href != that.href) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (on) {
|
||||
that.classList.add("hover-highlight");
|
||||
} else {
|
||||
that.classList.remove("hover-highlight");
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
window.onload = function () {
|
||||
var links = document.getElementsByTagName('a');
|
||||
for (var i = 0; i < links.length; i++) {
|
||||
links[i].onmouseover = highlight(true);
|
||||
links[i].onmouseout = highlight(false);
|
||||
}
|
||||
};
|
55
doc/src/style.css
Normal file
55
doc/src/style.css
Normal file
@ -0,0 +1,55 @@
|
||||
body {
|
||||
background-color: #fdf6e3;
|
||||
}
|
||||
|
||||
.hs-identifier {
|
||||
color: #073642;
|
||||
}
|
||||
|
||||
.hs-identifier.hs-var {
|
||||
}
|
||||
|
||||
.hs-identifier.hs-type {
|
||||
color: #5f5faf;
|
||||
}
|
||||
|
||||
.hs-keyword {
|
||||
color: #af005f;
|
||||
}
|
||||
|
||||
.hs-string, .hs-char {
|
||||
color: #cb4b16;
|
||||
}
|
||||
|
||||
.hs-number {
|
||||
color: #268bd2;
|
||||
}
|
||||
|
||||
.hs-operator {
|
||||
color: #d33682;
|
||||
}
|
||||
|
||||
.hs-glyph, .hs-special {
|
||||
color: #dc322f;
|
||||
}
|
||||
|
||||
.hs-comment {
|
||||
color: #8a8a8a;
|
||||
}
|
||||
|
||||
.hs-pragma {
|
||||
color: #2aa198;
|
||||
}
|
||||
|
||||
.hs-cpp {
|
||||
color: #859900;
|
||||
}
|
||||
|
||||
a:link, a:visited {
|
||||
text-decoration: none;
|
||||
border-bottom: 1px solid #eee8d5;
|
||||
}
|
||||
|
||||
a:hover, a.hover-highlight {
|
||||
background-color: #eee8d5;
|
||||
}
|
BIN
doc/synopsis.png
Normal file
BIN
doc/synopsis.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
@ -19,7 +19,7 @@ executable media
|
||||
ghc-options: -threaded -rtsopts -with-rtsopts=-N
|
||||
build-depends: base
|
||||
, pandoc-types
|
||||
, filepath
|
||||
, pandoc-slide-filter
|
||||
default-language: Haskell2010
|
||||
|
||||
executable cols
|
||||
@ -28,7 +28,7 @@ executable cols
|
||||
ghc-options: -threaded -rtsopts -with-rtsopts=-N
|
||||
build-depends: base
|
||||
, pandoc-types
|
||||
, filepath
|
||||
, pandoc-slide-filter
|
||||
default-language: Haskell2010
|
||||
|
||||
executable styling
|
||||
@ -37,6 +37,7 @@ executable styling
|
||||
ghc-options: -threaded -rtsopts -with-rtsopts=-N
|
||||
build-depends: base
|
||||
, pandoc-types
|
||||
, pandoc-slide-filter
|
||||
default-language: Haskell2010
|
||||
|
||||
executable quiz
|
||||
@ -45,6 +46,7 @@ executable quiz
|
||||
ghc-options: -threaded -rtsopts -with-rtsopts=-N
|
||||
build-depends: base
|
||||
, pandoc-types
|
||||
, pandoc-slide-filter
|
||||
default-language: Haskell2010
|
||||
|
||||
executable clean
|
||||
@ -53,8 +55,21 @@ executable clean
|
||||
ghc-options: -threaded -rtsopts -with-rtsopts=-N
|
||||
build-depends: base
|
||||
, pandoc-types
|
||||
, pandoc-slide-filter
|
||||
default-language: Haskell2010
|
||||
|
||||
library
|
||||
hs-source-dirs: src
|
||||
build-depends: base
|
||||
, pandoc-types
|
||||
, filepath
|
||||
default-language: Haskell2010
|
||||
exposed-modules: Text.Pandoc.Util.Filter
|
||||
, Text.Pandoc.Util.Filter.Cols
|
||||
, Text.Pandoc.Util.Filter.Media
|
||||
, Text.Pandoc.Util.Filter.Styling
|
||||
, Text.Pandoc.Util.Filter.Quiz
|
||||
|
||||
source-repository head
|
||||
type: git
|
||||
location: https://github.com/Drezil/pandoc-slide-filter
|
||||
|
102
src/Text/Pandoc/Util/Filter.hs
Normal file
102
src/Text/Pandoc/Util/Filter.hs
Normal file
@ -0,0 +1,102 @@
|
||||
module Text.Pandoc.Util.Filter
|
||||
( attToString
|
||||
, revealjsSpecialAttrs
|
||||
, classToRevealAttr
|
||||
, toHtml
|
||||
, toBlockHtml
|
||||
, addToAtt
|
||||
, addToStyle
|
||||
)
|
||||
where
|
||||
|
||||
import Text.Pandoc.Definition
|
||||
import Data.Monoid
|
||||
import Data.List (partition, isInfixOf)
|
||||
|
||||
-- | 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]
|
||||
addToAtt toAdd (a:as)
|
||||
| a == toAdd = toAdd:as
|
||||
| otherwise = a:addToAtt toAdd as
|
||||
addToAtt toAdd [] = [toAdd]
|
||||
|
||||
-- | adds given String to List of key-value-pairs (like in 'Attr')
|
||||
-- in the \"style\"-Key.
|
||||
--
|
||||
-- Useful when trying to add CSS-styles directly to (generated) elements
|
||||
addToStyle :: String -> [(String, String)] -> [(String, String)]
|
||||
-- we are looking for style and inject
|
||||
addToStyle toAdd (("style",val):as) = ("style", if toAdd `isInfixOf` val then val else val <> " " <> toAdd):as
|
||||
-- if we land here the current one is not style -> skip
|
||||
addToStyle toAdd (a:as) = a:addToStyle toAdd as
|
||||
-- if we land here we have no more to skip -> add
|
||||
addToStyle toAdd [] = [("style", toAdd)]
|
||||
|
||||
-- | converts Attributes to String for usage in HTML
|
||||
--
|
||||
-- Also converts @width=xxx@ and @height=xxx@ to the
|
||||
-- corresponding style-attributes
|
||||
attToString :: Attr -> String
|
||||
attToString ("", classes, kvpairs) = "class=\"" <> unwords classes <> "\" " <> unwords ((\(k,v) -> k <> "=\"" <> v <> "\"") <$> kvpairs')
|
||||
where
|
||||
kvpairs' = convertToStyle ["width","height","transform"] kvpairs
|
||||
attToString (id', classes, kvpairs) = "id=\"" <> id' <> "\" class=\"" <> unwords classes <> "\" " <> unwords ((\(k,v) -> k <> "=\"" <> v <> "\"") <$> kvpairs')
|
||||
where
|
||||
kvpairs' = convertToStyle ["width","height","transform"] kvpairs
|
||||
|
||||
convertToStyle :: [String] -> [(String,String)] -> [(String,String)]
|
||||
convertToStyle keys kvpairs = ("style", newstyle):rest
|
||||
where
|
||||
oldstyle = case filter (\(k,_) -> k == "style") kvpairs of
|
||||
[(_,st)] -> st
|
||||
_ -> ""
|
||||
stylesToAdd = filter (\(k,_) -> k `elem` keys) kvpairs
|
||||
rest = filter (\(k,_) -> k `notElem` keys) kvpairs
|
||||
newstyle = concat ((\(k,v) -> k <> ":" <> v <> ";") <$> stylesToAdd) <> oldstyle
|
||||
|
||||
-- | revealjs has some special attributes that has to be
|
||||
-- passed to the html, but Pandoc only allows
|
||||
-- @key=value@-attributes, so we have to abuse
|
||||
-- @.class@ to rewrite them.
|
||||
--
|
||||
-- The classes that get rewritten are listed here.
|
||||
--
|
||||
-- You probably want 'classToRevealAttr', as that
|
||||
-- is a wrapper for splitting the class-attribute
|
||||
revealjsSpecialAttrs :: [String]
|
||||
revealjsSpecialAttrs =
|
||||
[ "data-markdown"
|
||||
, "data-timing"
|
||||
, "data-template"
|
||||
, "data-autoplay"
|
||||
, "data-prevent-swipe"
|
||||
, "data-background-interactive"
|
||||
, "data-trim"
|
||||
, "data-noescape"
|
||||
, "data-ignore"
|
||||
, "controls"
|
||||
]
|
||||
|
||||
-- | revealjs has some special attributes that has to be
|
||||
-- passed to the html, but Pandoc only allows
|
||||
-- @key=value@-attributes, so we have to abuse
|
||||
-- @.class@ to rewrite them.
|
||||
--
|
||||
-- This is a wrapper-function which just splits the list
|
||||
-- into real classes and 'revealjsSpecialAttrs'
|
||||
classToRevealAttr :: [String] -> ([String],[String])
|
||||
classToRevealAttr = partition (`elem` revealjsSpecialAttrs)
|
||||
|
||||
-- | small wrapper around @RawInline (Format "html")@
|
||||
-- as this is less line-noise in the filters and the
|
||||
-- intent is more clear.
|
||||
toHtml :: String -> Inline
|
||||
toHtml = RawInline (Format "html")
|
||||
|
||||
|
||||
-- | small wrapper around @Raw (Format "html")@
|
||||
-- as this is less line-noise in the filters and the
|
||||
-- intent is more clear.
|
||||
toBlockHtml :: String -> Block
|
||||
toBlockHtml = RawBlock (Format "html")
|
78
src/Text/Pandoc/Util/Filter/Cols.hs
Normal file
78
src/Text/Pandoc/Util/Filter/Cols.hs
Normal file
@ -0,0 +1,78 @@
|
||||
{-# LANGUAGE ScopedTypeVariables #-}
|
||||
|
||||
-- | Conversion of lvl-x-headings to x-column-layouts in HTML
|
||||
-- especially for use in revealjs-slides
|
||||
module Text.Pandoc.Util.Filter.Cols
|
||||
(cols)
|
||||
where
|
||||
|
||||
import Text.Pandoc.JSON
|
||||
import Data.Monoid ((<>))
|
||||
import Text.Read (readMaybe)
|
||||
import Data.Maybe (fromMaybe)
|
||||
import Text.Pandoc.Util.Filter
|
||||
|
||||
-- | This filter makes multi-column-layouts out of lvl-x-headings
|
||||
--
|
||||
-- Syntax is
|
||||
--
|
||||
-- @
|
||||
-- ## a b
|
||||
-- @
|
||||
--
|
||||
-- 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 @\<div\>@:
|
||||
--
|
||||
-- @
|
||||
-- ## 2 5
|
||||
--
|
||||
-- \<div\>
|
||||
-- multiple things
|
||||
-- ```
|
||||
-- foo
|
||||
-- ```
|
||||
-- ![image](...)
|
||||
-- \</div\>
|
||||
--
|
||||
-- second column here with only 1 element.
|
||||
-- @
|
||||
cols :: [Block] -> [Block]
|
||||
cols (Header 2 attr [Str wa,Space,Str wb]:a:b:rest) =
|
||||
outerDiv:rest
|
||||
where
|
||||
wa' = fromMaybe 1 (readMaybe wa) :: Int
|
||||
wb' = fromMaybe 1 (readMaybe wb) :: Int
|
||||
total = wa' + wb'
|
||||
pa = (100*wa') `div` total
|
||||
pb = (100*wb') `div` total
|
||||
outerDiv = Div attr [ makeDiv pa a
|
||||
, makeDiv pb b
|
||||
, clearDiv
|
||||
]
|
||||
cols (Header 3 attr [Str wa,Space,Str wb,Space,Str wc]:a:b:c:rest) =
|
||||
outerDiv:rest
|
||||
where
|
||||
wa' = fromMaybe 1 (readMaybe wa) :: Int
|
||||
wb' = fromMaybe 1 (readMaybe wb) :: Int
|
||||
wc' = fromMaybe 1 (readMaybe wc) :: Int
|
||||
total = wa' + wb' + wc'
|
||||
pa = (100*wa') `div` total
|
||||
pb = (100*wb') `div` total
|
||||
pc = (100*wc') `div` total
|
||||
outerDiv = Div attr [ makeDiv pa a
|
||||
, makeDiv pb b
|
||||
, makeDiv pc c
|
||||
, clearDiv
|
||||
]
|
||||
cols x = x
|
||||
|
||||
makeDiv :: Int -> Block -> Block
|
||||
makeDiv width content = Div ("", [], [("style","width:" <> show width <> "%;float:left")]) [content]
|
||||
|
||||
clearDiv :: Block
|
||||
clearDiv = Div ("", [], [("style", "clear: both")]) [Plain [toHtml " "]]
|
158
src/Text/Pandoc/Util/Filter/Media.hs
Normal file
158
src/Text/Pandoc/Util/Filter/Media.hs
Normal file
@ -0,0 +1,158 @@
|
||||
{-# LANGUAGE ScopedTypeVariables #-}
|
||||
|
||||
module Text.Pandoc.Util.Filter.Media
|
||||
(media)
|
||||
where
|
||||
|
||||
import Text.Pandoc.JSON
|
||||
import Control.Exception
|
||||
import Data.Monoid ((<>))
|
||||
import Data.Char (toLower)
|
||||
import System.FilePath
|
||||
|
||||
import Text.Pandoc.Util.Filter
|
||||
|
||||
{-# ANN module "HLint: ignore Redundant $" #-} -- supress HLint-Warnings about $
|
||||
|
||||
-- | File-extensions that should be treated as audio
|
||||
audioExt :: [String]
|
||||
audioExt = ["mp3","aac"]
|
||||
|
||||
-- | File-extensions that should be treated as video
|
||||
videoExt :: [String]
|
||||
videoExt = [ "avi"
|
||||
, "mp4"
|
||||
, "mov"
|
||||
]
|
||||
|
||||
-- | File-extensions that should be treated as image
|
||||
imgExt :: [String]
|
||||
imgExt =
|
||||
[ "jpg"
|
||||
, "jpeg"
|
||||
, "png"
|
||||
, "gif"
|
||||
, "tif"
|
||||
, "tiff"
|
||||
, "bmp"
|
||||
, "svg"
|
||||
]
|
||||
|
||||
-- | File-extensions that should be treated as demo and will be included
|
||||
-- in an iframe
|
||||
demoExt :: [String]
|
||||
demoExt = ["html", "htm"]
|
||||
|
||||
-- | main media-plugin.
|
||||
--
|
||||
-- Will convert the following syntax
|
||||
--
|
||||
-- @
|
||||
-- ![](foo.aac){#audio}
|
||||
-- ![](foo.mp4){#video}
|
||||
-- ![](foo.png){#img}
|
||||
-- ![](foo.svg){#svg}
|
||||
-- ![](foo.html){#demo}
|
||||
-- @
|
||||
--
|
||||
-- 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]
|
||||
--audio
|
||||
media (Image (id',att,att') [] (filename,_))
|
||||
| id' == "audio" || checkExtension filename audioExt
|
||||
= return $ [toHtml $ "<audio " <> unwords direct <> " src=\"" <> filename <> "\"" <> attToString (idFilter "audio" id',css,att') <> "></audio>"]
|
||||
where
|
||||
(direct, css) = classToRevealAttr att
|
||||
media (Image (id',att,att') alt (filename,_))
|
||||
| id' == "audio" || checkExtension filename audioExt
|
||||
= return $ [toHtml $ "<figure><audio " <> unwords direct <> " src=\"" <> filename <> "\"" <> attToString (idFilter "audio" id',css,att') <> "></audio>"]
|
||||
<> [toHtml $ "<figcaption>"]
|
||||
<> alt
|
||||
<> [toHtml $ "</figcaption></figure>"]
|
||||
where
|
||||
(direct, css) = classToRevealAttr att
|
||||
--videos
|
||||
media (Image (id', att, att') [] (filename,_))
|
||||
| id' == "video" || checkExtension filename videoExt
|
||||
= return $ [toHtml $ "<video " <> unwords direct <> " src=\"" <> filename <> "\"" <> attToString (idFilter "video" id',css,att') <> "></video>"]
|
||||
where
|
||||
(direct, css) = classToRevealAttr att
|
||||
media (Image (id', att, att') alt (filename,_))
|
||||
| id' == "video" || checkExtension filename videoExt
|
||||
= return $ [toHtml $ "<figure>"]
|
||||
<> [toHtml $ "<video " <> unwords direct <> " src=\"" <> filename <> "\"" <> attToString (idFilter "video" id',css,att') <> "></video>"]
|
||||
<> [toHtml $ "<figcaption>"]
|
||||
<> alt
|
||||
<> [toHtml $ "</figcaption></figure>"]
|
||||
where
|
||||
(direct, css) = classToRevealAttr att
|
||||
--images
|
||||
media (Image (id', att, att') [] (filename,_))
|
||||
| id' == "img" || checkExtension filename imgExt
|
||||
= return $ [toHtml $ "<figure>"]
|
||||
<> [toHtml $ "<img " <> unwords direct <> " src=\"" <> filename <> "\"" <> attToString (idFilter "img" id',css,att') <> "></img>"]
|
||||
<> [toHtml $ "</figure>"]
|
||||
where
|
||||
(direct, css) = classToRevealAttr att
|
||||
media (Image (id', att, att') alt (filename,_))
|
||||
| id' == "img" || checkExtension filename imgExt
|
||||
= return $ [toHtml $ "<figure>"]
|
||||
<> [toHtml $ "<img " <> unwords direct <> " src=\"" <> filename <> "\"" <> attToString (idFilter "img" id',css,att') <> "></img>"]
|
||||
<> [toHtml $ "<figcaption>"]
|
||||
<> alt
|
||||
<> [toHtml $ "</figcaption></figure>"]
|
||||
where
|
||||
(direct, css) = classToRevealAttr att
|
||||
--load svg and dump it in
|
||||
media (Image (id', att, att') [] (filename,_))
|
||||
| id' == "svg"
|
||||
= handle (\(fileerror :: IOException) -> return [toHtml $ "Could not read file: " <> filename <> "<br />" <> show fileerror]) $
|
||||
do
|
||||
svg <- readFile filename
|
||||
return $ [toHtml $ "<figure " <> unwords direct <> " " <> attToString (idFilter "svg" id', css, att') <> ">"] -- use attributes on figure, as svg gets dumped in..
|
||||
<> [toHtml $ svg]
|
||||
<> [toHtml $ "</figure>"]
|
||||
where
|
||||
(direct, css) = classToRevealAttr att
|
||||
media (Image (id', att, att') alt (filename,_))
|
||||
| id' == "svg"
|
||||
= handle (\(fileerror :: IOException) -> return [toHtml $ "Could not read file: " <> filename <> "<br />" <> show fileerror]) $
|
||||
do
|
||||
svg <- readFile filename
|
||||
return $ [toHtml $ "<figure " <> unwords direct <> " " <> attToString (idFilter "svg" id', css, att') <> ">"] -- use attributes on figure, as svg gets dumped in..
|
||||
<> [toHtml $ svg]
|
||||
<> [toHtml $ "<figcaption>"]
|
||||
<> alt
|
||||
<> [toHtml $ "</figcaption></figure>"]
|
||||
where
|
||||
(direct, css) = classToRevealAttr att
|
||||
--html-demos etc. as IFrames
|
||||
media (Image (id', att, att') [] (filename,_))
|
||||
| id' == "demo" || checkExtension filename demoExt
|
||||
= return [toHtml $ "<iframe " <> unwords direct <> " src=\"" <> filename <> "?plugin\"" <> attToString (idFilter "demo" id', css, att') <> "></iframe>"]
|
||||
where
|
||||
(direct, css) = classToRevealAttr att
|
||||
media (Image (id', att, att') alt (filename,_))
|
||||
| id' == "demo" || checkExtension filename demoExt
|
||||
= return $ [toHtml $ "<figure>"]
|
||||
<> [toHtml $ "<iframe " <> unwords direct <> " src=\"" <> filename <> "?plugin\"" <> attToString (idFilter "demo" id', css, att') <> "></iframe>"]
|
||||
<> [toHtml $ "<figcaption>"]
|
||||
<> alt
|
||||
<> [toHtml $ "</figcaption></figure>"]
|
||||
where
|
||||
(direct, css) = classToRevealAttr att
|
||||
-- if not matched
|
||||
media x = return [x]
|
||||
|
||||
checkExtension :: String -> [String] -> Bool
|
||||
checkExtension fn exts = (fmap toLower . tail . takeExtension) fn `elem` exts
|
||||
|
||||
idFilter :: String -> String -> String
|
||||
idFilter a b
|
||||
| a == b = ""
|
||||
| otherwise = b
|
||||
|
39
src/Text/Pandoc/Util/Filter/Quiz.hs
Normal file
39
src/Text/Pandoc/Util/Filter/Quiz.hs
Normal file
@ -0,0 +1,39 @@
|
||||
{-# LANGUAGE ScopedTypeVariables #-}
|
||||
|
||||
module Text.Pandoc.Util.Filter.Quiz
|
||||
(quiz)
|
||||
where
|
||||
|
||||
import Text.Pandoc.JSON
|
||||
import Text.Pandoc.Walk
|
||||
import Data.Monoid ((<>))
|
||||
import Data.Maybe (isNothing, mapMaybe, listToMaybe)
|
||||
|
||||
-- Move bottom-Up through the structure, find quiz-answers and remove the
|
||||
-- incorrect formattet ones from the Block they came from.
|
||||
quiz :: Block -> [Block]
|
||||
quiz pb@(Plain b) = fmap makeQuiz (query findQuiz pb) <> [Plain (filter ((==) [] . findQuiz) b)]
|
||||
quiz pb@(Para b) = fmap makeQuiz (query findQuiz pb) <> [Plain (filter ((==) [] . findQuiz) b)]
|
||||
quiz x = [x]
|
||||
|
||||
-- If we have []{.answer} then we have a quiz-answer
|
||||
-- maybe with a tooltip
|
||||
findQuiz :: Inline -> [(Attr, [Inline], Maybe ([Inline],Attr))]
|
||||
findQuiz (Span attributes@(_, att, _) answerText)
|
||||
| "answer" `elem` att = [(attributes, answerText', tooltip)]
|
||||
where
|
||||
answerText' = filter (isNothing . findTooltip) answerText --filter everything that is a tooltip
|
||||
tooltip = listToMaybe $ mapMaybe findTooltip answerText --get the first span that is labled tooltip
|
||||
findQuiz _ = []
|
||||
|
||||
-- If we have []{.tooltip} we have a tooltip ;)
|
||||
-- we save the text and the attributes in a tuple
|
||||
findTooltip :: Inline -> Maybe ([Inline],Attr)
|
||||
findTooltip (Span attr@(_,att,_) tooltipText)
|
||||
| "tooltip" `elem` att = Just (tooltipText, attr)
|
||||
findTooltip _ = Nothing
|
||||
|
||||
-- Generate Divs for the quiz
|
||||
makeQuiz :: (Attr, [Inline], Maybe ([Inline],Attr)) -> Block
|
||||
makeQuiz (att, answer, Nothing) = Div att [Plain answer]
|
||||
makeQuiz (att, answer, Just (tooltip,a)) = Div att [Plain answer, Div a [Plain tooltip]]
|
64
src/Text/Pandoc/Util/Filter/Styling.hs
Normal file
64
src/Text/Pandoc/Util/Filter/Styling.hs
Normal file
@ -0,0 +1,64 @@
|
||||
{-# LANGUAGE ScopedTypeVariables #-}
|
||||
|
||||
module Text.Pandoc.Util.Filter.Styling
|
||||
(styling, inlineStyling)
|
||||
where
|
||||
|
||||
import Text.Pandoc.JSON
|
||||
import Data.Monoid ((<>))
|
||||
import Text.Pandoc.Util.Filter
|
||||
import Prelude hiding (div, span)
|
||||
|
||||
-- | Block-Styling
|
||||
--
|
||||
-- Special cases captured:
|
||||
--
|
||||
-- - #col turns a div into a floating-div for multiple columns
|
||||
-- - CodeBlock gets attributes @data-trim@ and @data-noescape@
|
||||
-- automatically
|
||||
-- - .fragment and .frame work properly on divs
|
||||
styling :: Block -> IO [Block]
|
||||
styling (Div ("col",att,att') inner) = return $ [toBlockHtml $ "<div style=\"float:left; margin-bottom:10px;\"" <> unwords direct <> attToString ("",css,att') <> ">"]
|
||||
++ inner
|
||||
++ [toBlockHtml"</div>"]
|
||||
where
|
||||
(direct, css) = classToRevealAttr att
|
||||
styling (CodeBlock (id',att,att') inner) = return
|
||||
[CodeBlock (id', addToAtt "data-trim"
|
||||
. addToAtt "data-noescape"
|
||||
$ att
|
||||
, att')
|
||||
inner]
|
||||
styling div@(Div (id',att,att') inner)
|
||||
| "fragment" `elem` att = return [Div (id', att, addToStyle "display: block;" att') inner]
|
||||
| "frame" `elem` att = return [Div (id', addToAtt "fragment" --insert fragment
|
||||
. addToAtt "current-visible" --insert current-visible
|
||||
. filter (/= "frame") --remove frame
|
||||
$ att
|
||||
, addToStyle "display: block;" att') inner]
|
||||
| otherwise = return [div]
|
||||
styling x = return [x]
|
||||
|
||||
|
||||
-- | Inline-Styling
|
||||
--
|
||||
-- Special cases captured:
|
||||
--
|
||||
-- - .fragment and .frame work properly on spans
|
||||
-- - .vspace inside span adds a vertical space with @height=xxx@
|
||||
-- - .hspace inside span adds a horizontal space with @width=xxx@
|
||||
inlineStyling :: Inline -> Inline
|
||||
inlineStyling span@(Span (id', att, att') inner)
|
||||
| "fragment" `elem` att = Span (id', att, addToStyle "display: inline-block;" att') inner
|
||||
| "frame" `elem` att = Span (id', addToAtt "fragment" --insert fragment
|
||||
. addToAtt "current-visible" --insert current-visible
|
||||
. filter (/= "frame") --remove frame
|
||||
$ att
|
||||
, addToStyle "display: inline-block;" att') inner
|
||||
| id' == "vspace" = toHtml $ "<div style=\"clear:both;\"" <> unwords direct <> attToString ("",css,att') <> "></div>"
|
||||
| id' == "hspace" = toHtml $ "<span " <> unwords direct <> attToString ("",css,att') <> "></span>"
|
||||
| otherwise = span
|
||||
where
|
||||
(direct, css) = classToRevealAttr att
|
||||
inlineStyling x = x
|
||||
|
Loading…
Reference in New Issue
Block a user