summaryrefslogtreecommitdiff
path: root/src/Hakyll
diff options
context:
space:
mode:
authorIvan N. Veselov <veselov@gmail.com>2012-08-02 16:02:25 +0300
committerIvan N. Veselov <veselov@gmail.com>2012-08-02 16:02:25 +0300
commitbc8821fa82614c1fff0e7ff0c296b4dab6f3d6a6 (patch)
treefec22c1c8153e920a80a03863667eb16df1ec880 /src/Hakyll
parentb37dc1b8347cc824f4d06e1446c049d67b9338df (diff)
downloadhakyll-bc8821fa82614c1fff0e7ff0c296b4dab6f3d6a6.tar.gz
Added support for Windows newlines in pages.
Otherwise, we are getting the following error message during page reading if some of the pages are prepared in Windows, which is somewhat confusing: hakyll: "page" (line 1, column 4): unexpected "\r" expecting "-", space or new-line
Diffstat (limited to 'src/Hakyll')
-rw-r--r--src/Hakyll/Web/Page/Read.hs9
1 files changed, 7 insertions, 2 deletions
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)