{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
import Presentation.Yeamer
import Presentation.Yeamer.Maths
import Text.Lucius
import Text.Hamlet
import Data.Foldable
import Data.Semigroup
import Data.Semigroup.Numbered
import Data.String (fromString)
import Data.Function (fix)
import Data.Time.Clock
import Data.Time.Clock.POSIX
import Data.Flat (Flat(..))
import qualified Diagrams.Prelude as Dia
import qualified Diagrams.Backend.Cairo as Dia
import Data.Function
main :: IO ()
main = yeamer . styling ([lucius|
body {
height: 100vh;
}
body {
color: white;
background-color: black;
font-size: 160%;
}
div {
height: 100%;
text-align: center;
}
pre {
text-align: left;
}
.headed-container {
height: 80%;
}
.vertical-concatenation {
display: flex;
flex-direction: column;
}
|] ()) $ do
"Heading"
======
"Simple test βpresentationβ"
"Code block"
====== [plaintext|
bla
blub
bli
blum
|]
"Some maths"
======
"Let's consider "<> π*π/(7-pi) $<>". This ensures"
<> maths[[ π₯ + π¦ β©΅ (-2*ΞΆ,99+π’)β«d Ο π§, ""β:πβͺ’9 ]
,[ π₯ - π¦ β©΅ 2786126792567 , ""β:πβͺ’3 ]]"."
<>"Furthermore, "<> ( 3β19 β©΅ Οβ©set π ) $<>" implies that"
<> maths[[ 37ββ"foo" β₯ π¦ββ(3.79,"bla") ]]","
<>"and therefore "<> (-Ο) $<>"."
"A slide with automatic grid layout"
====== do
"bla" β "bli" β "blo"
ββ
"blum" β "blubb"
"Image files"
====== do
imageFromDiagram (
Dia.circle 1 & Dia.lc Dia.red
)
ββ
"Plain circle"
imageFromFile "/usr/share/icons/HighContrast/256x256/apps/firefox.png"
ββ
"(Firefox logo)"
"Manual HTML, and cell-wise sequencing"
======
staticContent ([hamlet|
Static text
More text
More text
|]())
ββ
do "Click me!"
"You've clicked."
ββ
do "No, me!"
"You've clicked."
"Styling of inline elements"
====== styling ([lucius| .fattened {font-weight: bold; font-style: italic} |]())`id`
mconcat (zipWith ($)
(cycle [id, ("fattened"#%)])
(fromString<$>words"Click any of these words.") )
"The current time at the server"
====== do
t <- serverSide getCurrentTime
fromString $ show t
()<-"Hydra"
======
fix (\h -> "head" >>= \() -> h β h
ββ
h β h )
return ()
imageFromDiagram :: Dia.Diagram Dia.Cairo -> Presentation
imageFromDiagram dia = imageFromFileSupplier "png"
$ \tgtFile -> Dia.renderCairo tgtFile
(Dia.mkSizeSpec $ Just 640 Dia.^& Just 480) dia
filling :: Int -> String -> Presentation
filling n = fromString . concat . replicate n . (++" ")
instance Flat UTCTime where
decode = fmap (posixSecondsToUTCTime . realToFrac . (id::Double->Double)) decode
encode = encode . (id::Double->Double) . realToFrac . utcTimeToPOSIXSeconds
size = size . (id::Double->Double) . realToFrac . utcTimeToPOSIXSeconds