Commit 9b29be54 authored by Henrik Tramberend's avatar Henrik Tramberend
Browse files

Fix MathJax embedding

parent 13b1c067
......@@ -17,10 +17,15 @@ $endif$
<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="$revealjs-url$/css/reveal.css">
<style type="text/css">code{white-space: pre;}</style>
$if(quotes)$
<style type="text/css">q { quotes: "“" "”" "‘" "’"; }</style>
$endif$
<style type="text/css">
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
div.line-block{white-space: pre-line;}
div.column{display: inline-block; vertical-align: top; width: 50%;}
$if(quotes)$
q { quotes: "“" "”" "‘" "’"; }
$endif$
</style>
$if(highlighting-css)$
<style type="text/css">
$highlighting-css$
......@@ -35,19 +40,13 @@ $endif$
$for(css)$
<link rel="stylesheet" href="$css$"/>
$endfor$
<!-- Printing and PDF exports -->
<!-- Printing and PDF exports -->
<script>
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
if (window.location.search.match( /print-pdf/gi )) {
link.href = '$revealjs-url$/css/print/pdf.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
window.print();
} else {
link.href = '$revealjs-url$/css/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
}
link.href = window.location.search.match( /print-pdf/gi ) ? '$revealjs-url$/css/print/pdf.css' : '$revealjs-url$/css/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
<!--[if lt IE 9]>
<script src="$revealjs-url$/lib/js/html5shiv.js"></script>
......@@ -88,7 +87,7 @@ $endif$
$endif$
$if(toc)$
<section id="$idprefix$TOC">
$toc$
$table-of-contents$
</section>
$endif$
......@@ -235,15 +234,24 @@ $endif$
$if(maxScale)$
maxScale: $maxScale$,
$endif$
$if(mathjax)$
math: {
mathjax: '$decker-support-dir$/MathJax-2.7/MathJax.js',
config: 'TeX-AMS_HTML',
},
$endif$
// Optional reveal.js plugins
dependencies: [
{ src: '$revealjs-url$/lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: '$revealjs-url$/plugin/zoom-js/zoom.js', async: true },
$if(notes-server)$
$if(notes-server)$
{ src: '$revealjs-url$/socket.io/socker.io.js', async: true },
{ src: '$revealjs-url$/plugin/notes-server/client.js', async: true },
$endif$
$endif$
$if(mathjax)$
{ src: '$revealjs-url$/plugin/math/math.js', async: true },
$endif$
{ src: '$revealjs-url$/plugin/notes/notes.js', async: true }
]
});
......
......@@ -37,8 +37,8 @@ import Data.List as List
import Data.List.Extra as List
import qualified Data.Map.Lazy as Map
import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Encoding as E
import qualified Data.Text.IO as T
import qualified Data.Yaml as Y
import Development.Shake
import Development.Shake.FilePath as SFP
......@@ -56,10 +56,10 @@ import qualified Text.Mustache as M
import qualified Text.Mustache.Types as MT
import Text.Pandoc
import Text.Pandoc.Builder
import Text.Pandoc.Highlighting
import Text.Pandoc.PDF
import Text.Pandoc.Shared
import Text.Pandoc.Walk
import Text.Pandoc.Highlighting
import Watch
runShakeInContext :: ActionContext -> ShakeOptions -> Rules () -> IO ()
......@@ -169,14 +169,19 @@ markdownToHtmlDeck markdownFile out = do
readAndProcessMarkdown markdownFile (Disposition Deck Html) >>=
writePandocFile "revealjs" options out
runIOQuietly :: PandocIO a -> IO (Either PandocError a)
runIOQuietly act = runIO (setVerbosity ERROR >> act)
writePandocFile :: String -> WriterOptions -> FilePath -> Pandoc -> Action ()
writePandocFile fmt options out pandoc =
liftIO $ do
case getWriter fmt of
Right (TextWriter writePandoc, _) -> do
runIO (writePandoc options pandoc) >>= handleError >>= T.writeFile out
runIOQuietly (writePandoc options pandoc) >>= handleError >>=
T.writeFile out
Right (ByteStringWriter writePandoc, _) -> do
runIO (writePandoc options pandoc) >>= handleError >>= LB.writeFile out
runIOQuietly (writePandoc options pandoc) >>= handleError >>=
LB.writeFile out
Left e -> throw $ PandocException e
versionCheck :: Meta -> Action ()
......@@ -314,7 +319,9 @@ markdownToPdfPage markdownFile out = do
pandocMakePdf :: WriterOptions -> FilePath -> Pandoc -> Action ()
pandocMakePdf options out pandoc = do
liftIO $ do
result <- runIO (makePDF "pdflatex" [] writeLaTeX options pandoc) >>= handleError
result <-
runIOQuietly (makePDF "pdflatex" [] writeLaTeX options pandoc) >>=
handleError
case result of
Left errMsg -> throw $ PandocException (show errMsg)
Right pdf -> liftIO $ LB.writeFile out pdf
......@@ -370,8 +377,7 @@ readMetaMarkdown markdownFile = do
-- use mustache to substitute
let substituted = substituteMetaData markdown mustacheMeta
-- read markdown with substitutions again
let Pandoc _ blocks =
readMarkdownOrThrow pandocReaderOpts substituted
let Pandoc _ blocks = readMarkdownOrThrow pandocReaderOpts substituted
case combinedMeta of
(MetaMap m) -> do
versionCheck (Meta m)
......
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