fixed small bug

This commit is contained in:
Yann Esposito (Yogsototh) 2016-03-25 21:39:12 +01:00
parent 03c592cb7e
commit ac140a4e29
9 changed files with 269 additions and 28 deletions

BIN
README.beamer.pdf Normal file

Binary file not shown.

View file

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html>
<head>
<meta charset="utf-8">
<meta name="generator" content="pandoc">

View file

@ -12,8 +12,8 @@ Just launch.
## Dependencies
- [pandoc](http://pandoc.org)
- [XeLaTeX](http://xelatex.org)
- [pandoc](http://pandoc.org) -- Tested with pandoc 1.15.0.6
- [XeLaTeX](http://xelatex.org) -- Tested with XeTeX 3.14159265-2.6-0.99992 (TeX Live 2015)
- [metropolis](https://github.com/matze/mtheme)
Beamer theme (working forked version here:
[`https://github.com/yogsototh/mtheme`](https://github.com/yogsototh/mtheme))

Binary file not shown.

87
README.reveal.html Normal file
View file

@ -0,0 +1,87 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title></title>
<meta name="description" content="">
<meta name="apple-mobile-web-app-capable" content="yes" />
<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/metropolis.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 -->
<script>
document.write( '<link rel="stylesheet" href=".reveal.js-3.2.0/css/print/' +
( window.location.search.match( /print-pdf/gi ) ? 'pdf' : 'paper' ) +
'.css" type="text/css" media="print">' );
</script>
<!--[if lt IE 9]>
<script src=".reveal.js-3.2.0/lib/js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<div class="reveal">
<!-- Any section element inside of this container is displayed as a slide -->
<div class="slides">
<section>
<h1></h1>
<p>
<h4></h4>
</p>
</section>
<section id="no-brainer-markdown-to-html-pdf" class="level1">
<h1>No Brainer Markdown to HTML &amp; PDF</h1>
<p>Given a tree of markdown file, generate an HTML and PDF generated file for each. Just launch.</p>
<pre><code>./compile.sh</code></pre>
<section id="dependencies" class="level2">
<h2>Dependencies</h2>
<ul>
<li><a href="http://pandoc.org">pandoc</a></li>
<li><a href="http://xelatex.org">XeLaTeX</a></li>
<li><a href="https://github.com/matze/mtheme">metropolis</a> Beamer theme (working forked version here: <a href="https://github.com/yogsototh/mtheme"><code>https://github.com/yogsototh/mtheme</code></a>)</li>
</ul>
</section>
</section>
</div>
<script src=".reveal.js-3.2.0/lib/js/head.min.js"></script>
<script src=".reveal.js-3.2.0/js/reveal.js"></script>
<script>
// Full list of configuration options available here:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
controls: true,
progress: true,
history: true,
center: false,
// available themes are in /css/theme
theme: Reveal.getQueryHash().theme || 'metropolis',
// default/cube/page/concave/zoom/linear/fade/none
transition: Reveal.getQueryHash().transition || 'linear',
// Optional libraries used to extend on reveal.js
dependencies: [
{ src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'plugin/markdown/showdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: 'plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } },
{ src: 'plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } }
]
});
</script>
</body>
</html>

View file

@ -9,6 +9,7 @@ import qualified Filesystem.Path as F
import Prelude hiding (FilePath)
import System.Console.ANSI
import Turtle
import Data.Maybe (isJust,fromJust)
-- Command Line Options
data Options =
@ -47,7 +48,7 @@ main = do
Nothing -> findMarkdownFiles
Just someFile -> return someFile
liftIO $ do
when (debug opts) (yellowPrn ("-- " <> format fp argfile <> " --"))
yellowPrn ("-- " <> format fp argfile <> " --")
cd (directory argfile)
when (web opts) (toWeb (debug opts) argfile)
when (reveal opts) (toReveal (debug opts) argfile)
@ -57,7 +58,11 @@ main = do
-- | Find Markdown Files (skip hidden directories)
findMarkdownFiles :: Shell FilePath
findMarkdownFiles = fgrep (invert (prefix "./.")) $ find (has ".md") "."
findMarkdownFiles = do
fic <- find (has ".md") "." & fgrep (invert (prefix "./."))
let mf = stripPrefix "./" fic
_ <- guard (isJust mf)
return (fromJust mf)
-- | basic exec command with debug option and colors DONE or FAILED status
execcmd :: Bool -> FilePath -> Text -> IO ()
@ -70,7 +75,7 @@ execcmd dbg dest cmd = do
ExitFailure _ -> redPrn "[FAILED]"
toprefix :: FilePath -> FilePath
toprefix fpath = F.concat $ map (const "..") (filter (== ".") (splitDirectories (directory fpath)))
toprefix fpath = F.concat $ map (const "..") (filter (/= "./") (splitDirectories (directory fpath)))
-- | Generate HTML format
toWeb :: Bool -> FilePath -> IO ()
@ -87,10 +92,10 @@ toWeb dbg fpath = do
-- | Generate HTML Reveal.js Presentation
toReveal :: Bool -> FilePath -> IO ()
toReveal dbg fpath = do
let dest = fpath |> filename
|> dropExtension
|> flip addExtension "reveal"
|> flip addExtension "html"
let dest = fpath & filename
& dropExtension
& flip addExtension "reveal"
& flip addExtension "html"
pr :: FilePath
pr = toprefix fpath
template = pr </> "template-revealjs.html"
@ -108,9 +113,9 @@ toReveal dbg fpath = do
-- | Generate PDF Document using XeLaTeX
toPdf :: Bool -> FilePath -> IO ()
toPdf dbg fpath = do
let dest = fpath |> filename
|> dropExtension
|> flip addExtension "pdf"
let dest = fpath & filename
& dropExtension
& flip addExtension "pdf"
pr = toprefix fpath
template = pr </> "template.latex"
cmd = "pandoc -s -S -N --toc "
@ -127,16 +132,16 @@ toPdf dbg fpath = do
-- | Generate Beamer Presentation PDF
toBeamer :: Bool -> FilePath -> IO ()
toBeamer dbg fpath = do
mslideLevel <- fold (fpath |> filename
|> input
|> grep (prefix "slide_level: ")
|> sed (prefix "slide_level: " *> star digit))
mslideLevel <- fold (fpath & filename
& input
& grep (prefix "slide_level: ")
& sed (prefix "slide_level: " *> star digit))
Fold.head
let slideLevel = maybe "2" (\l -> if l == "" then "2" else l) mslideLevel
dest = fpath |> filename
|> dropExtension
|> flip addExtension "beamer"
|> flip addExtension "pdf"
dest = fpath & filename
& dropExtension
& flip addExtension "beamer"
& flip addExtension "pdf"
cmd :: Text
cmd = "pandoc -s -S -N "
<> "-t beamer "
@ -168,13 +173,6 @@ redPrn = prnColor Red
yellowPrn :: Text -> IO ()
yellowPrn = prnColor Yellow
-- | Helper to make code look a lot more (->) in Clojure
-- Generally humans, prefer to read function applied in the order
-- from left to right not in the reverse order.
-- This operator can be found in F# and Elm
(|>) :: a -> (a -> b) -> b
(|>) v fn = fn v
-- # Grep Files helper
-- | Same as grep put to be used after find or ls

View file

@ -0,0 +1,156 @@
% Beamer Color Theme using the Solarized Palette,
% http://ethanschoonover.com/solarized.
%
% Copyright 2012 Jeffrey B. Arnold
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <http://www.gnu.org/licenses/>.
\ProvidesPackage{beamercolorthemesolarized}[2013/10/11 1.0.1 Solarized color theme for beamer]
\RequirePackage{etoolbox}
\RequirePackage{kvoptions}
%% This is ugly. First time using options and conditionals in LaTeX
\SetupKeyvalOptions{
family=solarized,
prefix=solarized@,
}
\DeclareBoolOption[false]{dark}
\DeclareComplementaryOption{light}{dark}
\DeclareStringOption[yellow]{accent}[yellow]
\ProcessKeyvalOptions*
% Solarized palette
\definecolor{solarizedBase03}{HTML}{002B36}
\definecolor{solarizedBase02}{HTML}{073642}
\definecolor{solarizedBase01}{HTML}{586e75}
\definecolor{solarizedBase00}{HTML}{657b83}
\definecolor{solarizedBase0}{HTML}{839496}
\definecolor{solarizedBase1}{HTML}{93a1a1}
\definecolor{solarizedBase2}{HTML}{EEE8D5}
\definecolor{solarizedBase3}{HTML}{FDF6E3}
\definecolor{solarizedYellow}{HTML}{B58900}
\definecolor{solarizedOrange}{HTML}{CB4B16}
\definecolor{solarizedRed}{HTML}{DC322F}
\definecolor{solarizedMagenta}{HTML}{D33682}
\definecolor{solarizedViolet}{HTML}{6C71C4}
\definecolor{solarizedBlue}{HTML}{268BD2}
\definecolor{solarizedCyan}{HTML}{2AA198}
\definecolor{solarizedGreen}{HTML}{859900}
% Set Accent color
% Ugly. Should be done with a switch
\ifdefstring{\solarized@accent}{yellow}{
\colorlet{solarizedAccent}{solarizedYellow}
}{}
\ifdefstring{\solarized@accent}{orange}{
\colorlet{solarizedAccent}{solarizedOrange}
}{}
\ifdefstring{\solarized@accent}{red}{
\colorlet{solarizedAccent}{solarizedRed}
}{}
\ifdefstring{\solarized@accent}{magenta}{
\colorlet{solarizedAccent}{solarizedMagenta}
}{}
\ifdefstring{\solarized@accent}{violet}{
\colorlet{solarizedAccent}{solarizedViolet}
}{}
\ifdefstring{\solarized@accent}{blue}{
\colorlet{solarizedAccent}{solarizedBlue}
}{}
\ifdefstring{\solarized@accent}{cyan}{
\colorlet{solarizedAccent}{solarizedCyan}
}{}
\ifdefstring{\solarized@accent}{green}{
\colorlet{solarizedAccent}{solarizedGreen}
}{}
%% Set base colors for dark or light versions
%% Dark
% Switch between light and dark themes using the method in the CSS
% stylesheet http://ethanschoonover.com/solarized
\ifboolexpe{ bool {solarized@dark}}{
\colorlet{solarizedRebase03}{solarizedBase03}
\colorlet{solarizedRebase02}{solarizedBase02}
\colorlet{solarizedRebase01}{solarizedBase01}
\colorlet{solarizedRebase00}{solarizedBase00}
\colorlet{solarizedRebase0}{solarizedBase0}
\colorlet{solarizedRebase1}{solarizedBase1}
\colorlet{solarizedRebase2}{solarizedBase2}
\colorlet{solarizedRebase3}{solarizedBase3}
}{
%% Light
\colorlet{solarizedRebase03}{solarizedBase3}
\colorlet{solarizedRebase02}{solarizedBase2}
\colorlet{solarizedRebase01}{solarizedBase1}
\colorlet{solarizedRebase00}{solarizedBase0}
\colorlet{solarizedRebase0}{solarizedBase00}
\colorlet{solarizedRebase1}{solarizedBase01}
\colorlet{solarizedRebase2}{solarizedBase02}
\colorlet{solarizedRebase3}{solarizedBase03}
}
\mode<presentation>
\setbeamercolor{normal text}{fg=solarizedRebase0, bg=solarizedRebase03}
\setbeamercolor{alerted text}{fg=solarizedAccent}
% based css pre element
\setbeamercolor{example text}{fg=solarizedRebase1, bg=solarizedRebase02}
% Header and footer from CSS
\setbeamercolor{footline}{bg=solarizedRebase02,fg=solarizedRebase01}
\setbeamercolor{headline}{bg=solarizedRebase01,fg=solarizedRebase1}
% Titles
\setbeamercolor*{titlelike}{fg=solarizedAccent}
\setbeamercolor*{frametitle}{fg=solarizedAccent}
\setbeamercolor*{title}{fg=solarizedAccent}
% Structure elements use css style for header
\setbeamercolor*{structure}{bg=solarizedRebase01, fg=solarizedRebase1}
% Do not mess with subtle colors in palette. I don't like it.
\setbeamercolor*{palette primary}{bg=solarizedRebase01, fg=solarizedRebase1}
\setbeamercolor*{palette secondary}{bg=solarizedRebase01, fg=solarizedRebase1}
\setbeamercolor*{palette tertiary}{bg=solarizedRebase01, fg=solarizedRebase1}
\setbeamercolor*{palette quaternary}{bg=solarizedRebase01, fg=solarizedRebase1}
% Make Blocks slightly lighter/darker
\setbeamercolor{block title}{fg=solarizedAccent, bg=solarizedRebase02}
%\setbeamercolor{block title alerted}{}
%\setbeamercolor{block title example}{}
\setbeamercolor{block body}{parent=normal text, bg=solarizedRebase02}
% \setbeamercolor{block body alerted}{}
% \setbeamercolor{block body example}{}
% same as footline
% Set Sidebar and footline to use the css style for footer
\setbeamercolor*{sidebar}{parent=headline}
\setbeamercolor*{palette sidebar primary}{fg=solarizedRebase01, fg=solarizedRebase1}
\setbeamercolor*{palette sidebar secondary}{fg=solarizedRebase01, fg=solarizedRebase1}
\setbeamercolor*{palette sidebar tertiary}{fg=solarizedRebase01, fg=solarizedRebase1}
\setbeamercolor*{palette sidebar quaternary}{fg=solarizedRebase01, fg=solarizedRebase1}
% border-color for headings
\setbeamercolor{separation line}{fg=solarizedRebase0}
\setbeamercolor{fine separation line}{fg=solarizedRebase0}
\setbeamercolor*{section in sidebar shaded}{parent=palette sidebar primary}
% a.hover.navlink in CSS
\setbeamercolor*{section in sidebar}{parent=palette sidebar primary, fg=solarizedRebase02}
\setbeamercolor*{subsection in sidebar}{parent=section in sidebar}
\setbeamercolor*{subsection in sidebar shaded}{parent=section in sidebar shaded}
\mode
<all>

BIN
druid/druid.beamer.pdf Normal file

Binary file not shown.

Binary file not shown.