summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text/Hakyll/Page.hs7
-rw-r--r--src/Text/Hakyll/Render/Internal.hs4
2 files changed, 6 insertions, 5 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
diff --git a/src/Text/Hakyll/Render/Internal.hs b/src/Text/Hakyll/Render/Internal.hs
index 89a2709..d0b5814 100644
--- a/src/Text/Hakyll/Render/Internal.hs
+++ b/src/Text/Hakyll/Render/Internal.hs
@@ -13,7 +13,7 @@ import qualified Data.Map as M
import Text.Hakyll.Context (Context, ContextManipulation)
import Control.Monad.Reader (liftIO)
import Data.List (isPrefixOf, foldl')
-import Data.Char (isAlpha)
+import Data.Char (isAlphaNum)
import Data.Maybe (fromMaybe)
import Control.Parallel.Strategies (rdeepseq, ($|))
@@ -33,7 +33,7 @@ substitute escaper string context
| otherwise = head string : substitute' tail'
where
tail' = tail string
- (key, rest) = span isAlpha tail'
+ (key, rest) = span isAlphaNum tail'
replacement = fromMaybe ('$' : key) $ M.lookup key context
substituteKey = replacement ++ substitute' rest
substitute' str = substitute escaper str context