Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Filter out CRs, so everything still works on Windows.

Closes #8.
  • Loading branch information...
commit ca8d3079692b344a9979e7c6d877d5f1e7634df6 1 parent b5ded41
@jgm authored
Showing with 4 additions and 4 deletions.
  1. +1 −1  Yst/CSV.hs
  2. +1 −1  Yst/Render.hs
  3. +2 −2 Yst/Yaml.hs
View
2  Yst/CSV.hs
@@ -30,7 +30,7 @@ import System.IO.UTF8
#endif
readCSVFile :: FilePath -> IO Node
-readCSVFile f = catch (readFile f >>= return . csvToNode . parseCSV' f . stripBlanks)
+readCSVFile f = catch (readFile f >>= return . csvToNode . parseCSV' f . stripBlanks . filter (/='\r'))
(\e -> errorExit 11 ("Error parsing " ++ f ++ ": " ++ show e) >> return NNil)
parseCSV' :: FilePath -> String -> CSV
View
2  Yst/Render.hs
@@ -110,7 +110,7 @@ renderPage site page = do
todaysDate <- liftM utctDay getCurrentTime
rawContents <-
case sourceFile page of
- SourceFile sf -> readFile (srcDir </> sf)
+ SourceFile sf -> liftM (filter (/='\r')) $ readFile (srcDir </> sf)
TemplateFile tf -> do
templ <- getTemplate tf g
return $ render (setManyAttrib attrs templ)
View
4 Yst/Yaml.hs
@@ -25,7 +25,7 @@ import qualified Data.Yaml.Syck (unpackBuf, packBuf)
import Data.Time
import System.Locale (defaultTimeLocale)
import Codec.Binary.UTF8.String (encodeString, decodeString)
-import qualified Data.ByteString.Char8 as B (ByteString, readFile)
+import qualified Data.ByteString.Char8 as B (ByteString, readFile, filter)
-- Note: Syck isn't unicode aware, so we use parseYamlBytes and do our
-- own encoding and decoding.
@@ -39,7 +39,7 @@ packBuf :: String -> Buf
packBuf = Data.Yaml.Syck.packBuf . encodeString
readYamlFile :: FilePath -> IO Node
-readYamlFile f = catch (B.readFile f >>= parseYamlBytes >>= return . yamlNodeToNode)
+readYamlFile f = catch (B.readFile f >>= parseYamlBytes . B.filter (/='\r') >>= return . yamlNodeToNode)
(\e -> errorExit 11 ("Error parsing " ++ f ++ ": " ++ show e) >> return NNil)
yamlNodeToNode :: YamlNode -> Node
Please sign in to comment.
Something went wrong with that request. Please try again.