diff options
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/S5.hs | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/src/Text/Pandoc/S5.hs b/src/Text/Pandoc/S5.hs index 5658433ae..b17b052c5 100644 --- a/src/Text/Pandoc/S5.hs +++ b/src/Text/Pandoc/S5.hs @@ -31,6 +31,8 @@ Definitions for creation of S5 powerpoint-like HTML. module Text.Pandoc.S5 ( s5HeaderIncludes) where import Text.Pandoc.Shared ( readDataFile ) import System.FilePath ( (</>) ) +import Data.ByteString.UTF8 ( toString, fromString ) +import Data.ByteString.Base64 ( encode ) s5HeaderIncludes :: Maybe FilePath -> IO String s5HeaderIncludes datadir = do @@ -38,14 +40,17 @@ s5HeaderIncludes datadir = do j <- s5Javascript datadir return $ c ++ j -inCDATA :: String -> String -inCDATA s = "/*<![CDATA[*/\n" ++ s ++ "\n/*]]>*/\n" - s5Javascript :: Maybe FilePath -> IO String s5Javascript datadir = do js <- readDataFile datadir $ "s5" </> "default" </> "slides.min.js" return $ "<script type=\"text/javascript\">\n" ++ inCDATA js ++ "</script>\n" +inCDATA :: String -> String +inCDATA s = "/*<![CDATA[*/\n" ++ s ++ "\n/*]]>*/\n" + +base64 :: String -> String +base64 = toString . encode . fromString + s5CSS :: Maybe FilePath -> IO String s5CSS datadir = do s5CoreCSS <- readDataFile datadir $ "s5" </> "default" </> "s5-core.css" @@ -54,11 +59,11 @@ s5CSS datadir = do s5OperaCSS <- readDataFile datadir $ "s5" </> "default" </> "opera.css" s5OutlineCSS <- readDataFile datadir $ "s5" </> "default" </> "outline.css" s5PrintCSS <- readDataFile datadir $ "s5" </> "default" </> "print.css" - return $ "<style type=\"text/css\" media=\"projection\" id=\"slideProj\">\n" ++ - inCDATA (s5CoreCSS ++ "\n" ++ s5FramingCSS ++ "\n" ++ s5PrettyCSS) ++ - "</style>\n<style type=\"text/css\" media=\"screen\" id=\"outlineStyle\">\n" ++ - inCDATA s5OutlineCSS ++ - "</style>\n<style type=\"text/css\" media=\"print\" id=\"slidePrint\">\n" ++ - inCDATA s5PrintCSS ++ - "</style>\n<style type=\"text/css\" media=\"projection\" id=\"operaFix\">\n" ++ - inCDATA s5OperaCSS ++ "</style>\n" + return $ "<link rel=\"stylesheet\" type=\"text/css\" media=\"projection\" id=\"slideProj\" href=\"data:text/css;charset=utf-8;base64," ++ + base64 (s5CoreCSS ++ "\n" ++ s5FramingCSS ++ "\n" ++ s5PrettyCSS) ++ "\" />\n" ++ + "<link rel=\"stylesheet\" type=\"text/css\" media=\"screen\" id=\"outlineStyle\" href=\"data:text/css;charset=utf-8;base64," ++ + base64 s5OutlineCSS ++ "\" />\n" ++ + "<link rel=\"stylesheet\" type=\"text/css\" media=\"print\" id=\"slidePrint\" href=\"data:text/css;charset=utf-8;base64," ++ + base64 s5PrintCSS ++ "\" />\n" ++ + "<link rel=\"stylesheet\" type=\"text/css\" media=\"projection\" id=\"operaFix\" href=\"data:text/css;charset=utf-8;base64," ++ + base64 s5OperaCSS ++ "\" />\n" |