This commit is contained in:
Yann Esposito 2016-03-25 18:04:27 +01:00
parent 65e2224958
commit 03c592cb7e
3 changed files with 10 additions and 6 deletions

View file

@ -41,6 +41,7 @@ initOptions = do
main :: IO ()
main = do
opts <- initOptions
maindir <- pwd
sh $ do
argfile <- case file opts of
Nothing -> findMarkdownFiles
@ -52,6 +53,7 @@ main = do
when (reveal opts) (toReveal (debug opts) argfile)
when (pdf opts) (toPdf (debug opts) argfile)
when (beamer opts) (toBeamer (debug opts) argfile)
cd maindir
-- | Find Markdown Files (skip hidden directories)
findMarkdownFiles :: Shell FilePath
@ -67,12 +69,14 @@ execcmd dbg dest cmd = do
ExitSuccess -> greenPrn "[DONE]"
ExitFailure _ -> redPrn "[FAILED]"
toprefix :: FilePath -> FilePath
toprefix fpath = F.concat $ map (const "..") (filter (== ".") (splitDirectories (directory fpath)))
-- | Generate HTML format
toWeb :: Bool -> FilePath -> IO ()
toWeb dbg fpath = do
let dest = filename (replaceExtension fpath "html")
pr :: FilePath
pr = F.concat $ map (const "..") (splitDirectories (directory fpath))
pr = toprefix fpath
cmd = "pandoc -s -S --toc -mathjax -t html5 --smart "
<> "--css " <> format fp (pr </> "styling.css") <> " "
<> "-A " <> format fp (pr </> "footer.html") <> " "
@ -88,7 +92,7 @@ toReveal dbg fpath = do
|> flip addExtension "reveal"
|> flip addExtension "html"
pr :: FilePath
pr = F.concat $ map (const "..") (splitDirectories (directory fpath))
pr = toprefix fpath
template = pr </> "template-revealjs.html"
prt :: Text
prt = format fp pr
@ -107,7 +111,7 @@ toPdf dbg fpath = do
let dest = fpath |> filename
|> dropExtension
|> flip addExtension "pdf"
pr = F.concat $ map (const "..") (splitDirectories (directory fpath))
pr = toprefix fpath
template = pr </> "template.latex"
cmd = "pandoc -s -S -N --toc "
<> "--template=" <> format fp template <> " "

Binary file not shown.

View file

@ -9,7 +9,7 @@
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" href="../.reveal.js-3.2.0/css/reveal.css">
<link rel="stylesheet" href="../.reveal.js-3.2.0/css/theme/default.css" id="theme">
<link rel="stylesheet" href="../.reveal.js-3.2.0/css/theme/solarized.css" id="theme">
<!-- For syntax highlighting -->
<link rel="stylesheet" href="../.reveal.js-3.2.0/lib/css/zenburn.css">
<!-- If the query includes 'print-pdf', use the PDF print sheet -->
@ -130,7 +130,7 @@
center: false,
// available themes are in /css/theme
theme: Reveal.getQueryHash().theme || 'default',
theme: Reveal.getQueryHash().theme || 'solarized',
// default/cube/page/concave/zoom/linear/fade/none
transition: Reveal.getQueryHash().transition || 'linear',