packages feed

Slides 0.1.0.7 → 0.1.0.8

raw patch · 4 files changed

+11/−4 lines, 4 files

Files

Slides.cabal view
@@ -1,5 +1,5 @@ name:                Slides
-version:             0.1.0.7
+version:             0.1.0.8
 synopsis:            Generate slides from Haskell code
 description:         Make presentations in Haskell with diagrams
 license:             MIT
src/Slides/Presentation.hs view
@@ -65,6 +65,7 @@ import Slides.Common
 import Slides.Sequencing
 import Slides.Internal
+import System.IO (openFile, utf8, hSetEncoding, hPutStr, IOMode(WriteMode), hFlush, hClose)
 
 class Renderable a where
     render :: a -> String
@@ -103,4 +104,9 @@ 
 -- | Render a Presentation to an HTML file with UTF8 encoding.
 writeToFile :: FilePath -> Presentation -> IO ()
-writeToFile path = writeFile path . render
+writeToFile path pres = do
+    file <- openFile path WriteMode
+    hSetEncoding file utf8
+    hPutStr file (render pres)
+    hFlush file
+    hClose file
test/Test.hs view
@@ -20,7 +20,8 @@                         UnfoldList Immediate [
                             "These lines will unfold one by one.",
                             "You can use some markdown in these strings like _this_ or *this* \
-                            \or __this__ or **this**."
+                            \or __this__ or **this**.",
+                            "unicodešđčćž"
                         ]
                     ],
                     List [
test/index.html view
@@ -15,4 +15,4 @@     page-break-after: always;
 }
 
-</style></head><body><div class="slide"><h2>Title</h2><h3>Example</h3></div><div class="slide"><h2>Title</h2><h3>Example</h3><ul><li>These lines will unfold one by one.</li></ul></div><div class="slide"><h2>Title</h2><h3>Example</h3><ul><li>These lines will unfold one by one.</li><li>You can use some markdown in these strings like <i>this</i> or <i>this</i> or <b>this</b> or <b>this</b>.</li></ul></div><div class="slide"><h2>Title</h2><ul><li>This list will be shown in place of the previous title-list-diagram.</li><li>This item will be shown immediately with the last one.</li></ul></div><div class="slide"><h2>Another slide</h2><ul><li>Some text describing stuff.</li><li>More text.</li></ul></div></body>+</style></head><body><div class="slide"><h2>Title</h2><h3>Example</h3></div><div class="slide"><h2>Title</h2><h3>Example</h3><ul><li>These lines will unfold one by one.</li></ul></div><div class="slide"><h2>Title</h2><h3>Example</h3><ul><li>These lines will unfold one by one.</li><li>You can use some markdown in these strings like <i>this</i> or <i>this</i> or <b>this</b> or <b>this</b>.</li></ul></div><div class="slide"><h2>Title</h2><h3>Example</h3><ul><li>These lines will unfold one by one.</li><li>You can use some markdown in these strings like <i>this</i> or <i>this</i> or <b>this</b> or <b>this</b>.</li><li>unicodešđčćž</li></ul></div><div class="slide"><h2>Title</h2><ul><li>This list will be shown in place of the previous title-list-diagram.</li><li>This item will be shown immediately with the last one.</li></ul></div><div class="slide"><h2>Another slide</h2><ul><li>Some text describing stuff.</li><li>More text.</li></ul></div></body>