summaryrefslogtreecommitdiff
path: root/src/Text/Hakyll/Page.hs
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2010-01-19 15:50:04 +0100
committerJasper Van der Jeugt <jaspervdj@gmail.com>2010-01-19 15:50:04 +0100
commitfe77089955dbf1002496e34824da13bfaf64a898 (patch)
tree8df1a154b5ae23e9e12045490ba49546dbf98b18 /src/Text/Hakyll/Page.hs
parentf5a6c4974d561e05b2882d38b54b45188ee31185 (diff)
downloadhakyll-fe77089955dbf1002496e34824da13bfaf64a898.tar.gz
Made page parser a little less strict.
Diffstat (limited to 'src/Text/Hakyll/Page.hs')
-rw-r--r--src/Text/Hakyll/Page.hs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Text/Hakyll/Page.hs b/src/Text/Hakyll/Page.hs
index 9c01801..d120443 100644
--- a/src/Text/Hakyll/Page.hs
+++ b/src/Text/Hakyll/Page.hs
@@ -8,6 +8,7 @@ module Text.Hakyll.Page
import qualified Data.Map as M
import qualified Data.List as L
+import Data.Char (isSpace)
import Data.Maybe (fromMaybe)
import Control.Parallel.Strategies (rdeepseq, ($|))
import Control.Monad.Reader (liftIO)
@@ -121,16 +122,16 @@ readSection renderFunction isFirst ls
| otherwise = body (tail ls)
where
isDelimiter' = isDelimiter (head ls)
- isNamedDelimiter = head ls `matchesRegex` "----* *[a-zA-Z][a-zA-Z]*"
+ isNamedDelimiter = head ls `matchesRegex` "----* *[a-zA-Z0-9][a-zA-Z0-9]*"
body ls' = [("body", renderFunction $ unlines ls')]
- readSimpleMetaData = map readPair
+ readSimpleMetaData = map readPair . filter (not . all isSpace)
readPair = trimPair . break (== ':')
trimPair (key, value) = (trim key, trim $ tail value)
readSectionMetaData [] = []
readSectionMetaData (header:value) =
- let key = substituteRegex "[^a-zA-Z]" "" header
+ let key = substituteRegex "[^a-zA-Z0-9]" "" header
in [(key, renderFunction $ unlines value)]
-- | Read a page from a file. Metadata is supported, and if the filename