Commit 1f22fcc4 authored by Henrik Tramberend's avatar Henrik Tramberend
Browse files

Bump stack to lts-9.18

parent e120c720
......@@ -2,11 +2,11 @@ decker := $(shell stack path | grep local-install-root | sed "s/local-install-ro
zip := $(shell mktemp -u)
build:
stack build -j 8 --fast --haddock-deps
stack build -j 8 --fast
@(cd resource; zip -qr $(zip) example support template; cat $(zip) >> $(decker); rm $(zip))
watch:
stack test -j 8 --fast --haddock-deps --file-watch
stack test -j 8 --fast --file-watch
docs: build
stack hoogle -- generate --local
......
provisioning: Copy
\ No newline at end of file
provisioning: SymLink
\ No newline at end of file
......@@ -72,7 +72,7 @@ hasAnyClass :: [String] -> Block -> Bool
hasAnyClass which = isJust . firstClass which
firstClass :: [String] -> Block -> Maybe String
firstClass which block = listToMaybe $ filter ((flip hasClass) block) which
firstClass which block = listToMaybe $ filter (`hasClass` block) which
-- | Slide layouts are rows of one ore more columns.
data RowLayout = RowLayout
......@@ -124,12 +124,11 @@ renderRow areaMap (MultiColumn areas) =
renderColumn :: (Int, [Block]) -> Block
renderColumn (i, blocks) =
let grow =
maybe (1 :: Int) Prelude.id $
lookup "grow" (blockKeyvals blocks) >>= readMaybe
fromMaybe (1 :: Int) $ lookup "grow" (blockKeyvals blocks) >>= readMaybe
in Div
( ""
, ["grow-" ++ show grow, "column", "column-" ++ show i]
, (blockKeyvals blocks))
, blockKeyvals blocks)
blocks
blockKeyvals :: [Block] -> [(String, String)]
......@@ -139,7 +138,7 @@ blockKeyvals (first:_) =
blockKeyvals [] = []
renderLayout :: AreaMap -> RowLayout -> [Block]
renderLayout areaMap l = catMaybes $ map (renderRow areaMap) (rows l)
renderLayout areaMap l = mapMaybe (renderRow areaMap) (rows l)
slideAreas :: [String] -> [Block] -> AreaMap
slideAreas names blocks =
......@@ -217,7 +216,7 @@ zapImages inline = inline
-- Transform inline image or video elements within the header line with
-- background attributes of the respective section.
setSlideBackground :: Slide -> Slide
setSlideBackground slide@((Header 1 (headerId, headerClasses, headerAttributes) inlines), slideBody) =
setSlideBackground slide@(Header 1 (headerId, headerClasses, headerAttributes) inlines, slideBody) =
case query allImages inlines of
Image (_, imageClasses, imageAttributes) _ (imageSrc, _):_ ->
( Header
......@@ -277,7 +276,7 @@ mapSlides func (Pandoc meta blocks) =
slideBlocks = split (keepDelimsL $ whenElt isSlideHeader) blocks
slides = map extractHeader $ filter (not . null) slideBlocks
extractHeader (header@(Header 1 _ _):bs) = (header, bs)
extractHeader (rule@(HorizontalRule):bs) = (rule, bs)
extractHeader (rule@HorizontalRule:bs) = (rule, bs)
extractHeader slide =
throw $
PandocException $ "Error extracting slide header: \n" ++ show slide
......
......@@ -20,7 +20,7 @@ import System.Directory (createDirectoryIfMissing, doesFileExist)
import System.FilePath.Posix
import Text.Blaze.Html.Renderer.String
import Text.Blaze.Html5 as H ((!), canvas, div, script, toValue)
import Text.Blaze.Html5.Attributes as A (class_, lang, id, src)
import Text.Blaze.Html5.Attributes as A (class_, id, lang, src)
import Text.Pandoc
import Text.Pandoc.Walk
import Text.Printf
......@@ -133,13 +133,16 @@ shakeCompile ext source attr = do
renderedCodeExtensions :: [String]
renderedCodeExtensions = [".dot", ".gnuplot", ".tex", ".js"]
restrictKeys :: Ord a1 => Map.Map a1 a -> Set.Set a1 -> Map.Map a1 a
restrictKeys m s = Map.filterWithKey (\k _ -> k `Set.member` s) m
-- | Selects a processor based on a list of CSS class names. The first processor
-- that is mentioned in that list is returned.
findProcessor :: [String] -> Maybe Processor
findProcessor classes
| "render" `elem` classes = listToMaybe $ Map.elems matching
where
matching = Map.restrictKeys processors (Set.fromList classes)
matching = restrictKeys processors (Set.fromList classes)
findProcessor _ = Nothing
-- | Appends `.svg` to file urls with extensions that belong to a known render
......@@ -181,7 +184,7 @@ writeCodeIfChanged code ext = do
let basepath = "code" </> (concat $ intersperse "-" ["code", crc])
let path = projectDir </> basepath <.> ext
lift $
withShakeLock $
withShakeLock $ www
liftIO $
unlessM (System.Directory.doesFileExist path) $ do
createDirectoryIfMissing True (takeDirectory path)
......@@ -200,10 +203,14 @@ appendScripts pandoc@(Pandoc meta blocks) = do
renderScript (ScriptURI language uri) =
RawBlock (Format "html") $
renderHtml $
H.script ! class_ "generated decker" ! lang (toValue language) ! src (toValue uri) $
H.script ! class_ "generated decker" ! lang (toValue language) !
src (toValue uri) $
""
renderScript (ScriptSource language source) = do
RawBlock (Format "html") $
printf "<script class=\"generated decker\" lang=\"%s\">%s</script>" language source
printf
"<script class=\"generated decker\" lang=\"%s\">%s</script>"
language
source
-- renderHtml $
-- H.script ! class_ "generated decker" ! lang = language $ preEscapedToHtml source
......@@ -2,5 +2,4 @@ flags: {}
packages:
- '.'
extra-deps:
- containers-0.5.8.1
resolver: lts-9.9
resolver: lts-9.18
......@@ -212,3 +212,64 @@ Some more Text
##
Some more Text
# Questions
## Question 1 {.answer .wrong}
Some more Text or images
### Some text
![](lösung.png)
## Question 2 {.question}
1. Some more Text or images
2. This is the answer
Marc ist Imperator.
------
# Three Columns {layout="columns"}
## Unten {.bottom}
::: {.col30} unten drunter ist auch mehr Platz. Bis zum Rand. :::
## Oben {.top}
Oben drüber ist mehr PLatz. Bis zum Rand.
## Links {.left grow="2"}
Lalla
## Rechts {.right grow="5"}
Lalla
## Center {.center grow="10"}
Lalla
------
# Column Syntax
## Top 1 {.split}
- Lall
- Fasel
## \
- Lall
- Fasel
----
# Bilder und Figures
![](pacman-perfect-game.mp4){width=50% .}
\ No newline at end of file
......@@ -5,7 +5,9 @@ title: Image, Audio and Video Handling
# Local Image
![](include/06-metal.png)
![Caption](include/06-metal.png)
# Local Image 50%
......@@ -13,7 +15,7 @@ title: Image, Audio and Video Handling
# Local Video Autoplay
![](movie.mp4){data-autoplay="1"}
![Caption](movie.mp4){data-autoplay="1"}
# Local Video 50%
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment