summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Hakyll/Web/CompressCss.hs4
-rw-r--r--src/Hakyll/Web/Page/Read.hs9
2 files changed, 9 insertions, 4 deletions
diff --git a/src/Hakyll/Web/CompressCss.hs b/src/Hakyll/Web/CompressCss.hs
index 090fe10..52b5396 100644
--- a/src/Hakyll/Web/CompressCss.hs
+++ b/src/Hakyll/Web/CompressCss.hs
@@ -31,12 +31,12 @@ compressCss = compressSeparators
compressSeparators :: String -> String
compressSeparators = replaceAll "; *}" (const "}")
. replaceAll " *([{};:]) *" (take 1 . dropWhile isSpace)
- . replaceAll ";;*" (const ";")
+ . replaceAll ";+" (const ";")
-- | Compresses all whitespace.
--
compressWhitespace :: String -> String
-compressWhitespace = replaceAll "[ \t\n][ \t\n]*" (const " ")
+compressWhitespace = replaceAll "[ \t\n\r]+" (const " ")
-- | Function that strips CSS comments away.
--
diff --git a/src/Hakyll/Web/Page/Read.hs b/src/Hakyll/Web/Page/Read.hs
index 1c3eab7..40a4cd5 100644
--- a/src/Hakyll/Web/Page/Read.hs
+++ b/src/Hakyll/Web/Page/Read.hs
@@ -4,10 +4,10 @@ module Hakyll.Web.Page.Read
( readPage
) where
-import Control.Applicative ((<$>), (<*>), (<*))
+import Control.Applicative ((<$>), (<*>), (<*), (<|>))
import qualified Data.Map as M
-import Text.Parsec.Char (alphaNum, anyChar, char, newline, oneOf, string)
+import Text.Parsec.Char (alphaNum, anyChar, char, oneOf, string)
import Text.Parsec.Combinator (choice, many1, manyTill, option, skipMany1)
import Text.Parsec.Prim (many, parse, skipMany, (<?>))
import Text.Parsec.String (Parser)
@@ -19,6 +19,11 @@ import Hakyll.Web.Page.Internal
inlineSpace :: Parser Char
inlineSpace = oneOf ['\t', ' '] <?> "space"
+-- | Parse Windows newlines as well (i.e. "\n" or "\r\n")
+newline :: Parser String
+newline = string "\n" -- Unix
+ <|> string "\r\n" -- DOS
+
-- | Parse a single metadata field
--
metadataField :: Parser (String, String)