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 :: IO ()
main = do main = do
opts <- initOptions opts <- initOptions
maindir <- pwd
sh $ do sh $ do
argfile <- case file opts of argfile <- case file opts of
Nothing -> findMarkdownFiles Nothing -> findMarkdownFiles
@ -52,6 +53,7 @@ main = do
when (reveal opts) (toReveal (debug opts) argfile) when (reveal opts) (toReveal (debug opts) argfile)
when (pdf opts) (toPdf (debug opts) argfile) when (pdf opts) (toPdf (debug opts) argfile)
when (beamer opts) (toBeamer (debug opts) argfile) when (beamer opts) (toBeamer (debug opts) argfile)
cd maindir
-- | Find Markdown Files (skip hidden directories) -- | Find Markdown Files (skip hidden directories)
findMarkdownFiles :: Shell FilePath findMarkdownFiles :: Shell FilePath
@ -67,12 +69,14 @@ execcmd dbg dest cmd = do
ExitSuccess -> greenPrn "[DONE]" ExitSuccess -> greenPrn "[DONE]"
ExitFailure _ -> redPrn "[FAILED]" ExitFailure _ -> redPrn "[FAILED]"
toprefix :: FilePath -> FilePath
toprefix fpath = F.concat $ map (const "..") (filter (== ".") (splitDirectories (directory fpath)))
-- | Generate HTML format -- | Generate HTML format
toWeb :: Bool -> FilePath -> IO () toWeb :: Bool -> FilePath -> IO ()
toWeb dbg fpath = do toWeb dbg fpath = do
let dest = filename (replaceExtension fpath "html") let dest = filename (replaceExtension fpath "html")
pr :: FilePath pr = toprefix fpath
pr = F.concat $ map (const "..") (splitDirectories (directory fpath))
cmd = "pandoc -s -S --toc -mathjax -t html5 --smart " cmd = "pandoc -s -S --toc -mathjax -t html5 --smart "
<> "--css " <> format fp (pr </> "styling.css") <> " " <> "--css " <> format fp (pr </> "styling.css") <> " "
<> "-A " <> format fp (pr </> "footer.html") <> " " <> "-A " <> format fp (pr </> "footer.html") <> " "
@ -88,7 +92,7 @@ toReveal dbg fpath = do
|> flip addExtension "reveal" |> flip addExtension "reveal"
|> flip addExtension "html" |> flip addExtension "html"
pr :: FilePath pr :: FilePath
pr = F.concat $ map (const "..") (splitDirectories (directory fpath)) pr = toprefix fpath
template = pr </> "template-revealjs.html" template = pr </> "template-revealjs.html"
prt :: Text prt :: Text
prt = format fp pr prt = format fp pr
@ -107,7 +111,7 @@ toPdf dbg fpath = do
let dest = fpath |> filename let dest = fpath |> filename
|> dropExtension |> dropExtension
|> flip addExtension "pdf" |> flip addExtension "pdf"
pr = F.concat $ map (const "..") (splitDirectories (directory fpath)) pr = toprefix fpath
template = pr </> "template.latex" template = pr </> "template.latex"
cmd = "pandoc -s -S -N --toc " cmd = "pandoc -s -S -N --toc "
<> "--template=" <> format fp template <> " " <> "--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="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"> <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/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 --> <!-- For syntax highlighting -->
<link rel="stylesheet" href="../.reveal.js-3.2.0/lib/css/zenburn.css"> <link rel="stylesheet" href="../.reveal.js-3.2.0/lib/css/zenburn.css">
<!-- If the query includes 'print-pdf', use the PDF print sheet --> <!-- If the query includes 'print-pdf', use the PDF print sheet -->
@ -130,7 +130,7 @@
center: false, center: false,
// available themes are in /css/theme // available themes are in /css/theme
theme: Reveal.getQueryHash().theme || 'default', theme: Reveal.getQueryHash().theme || 'solarized',
// default/cube/page/concave/zoom/linear/fade/none // default/cube/page/concave/zoom/linear/fade/none
transition: Reveal.getQueryHash().transition || 'linear', transition: Reveal.getQueryHash().transition || 'linear',