blob: c5789ed27798fddd901cb9e051ad8d2c977640ef (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
--------------------------------------------------------------------------------
-- | Parser utilities
module Hakyll.Core.Util.Parser
( metadataKey
, reservedKeys
) where
--------------------------------------------------------------------------------
import Control.Applicative ((<$>), (<*>), (<|>))
import Control.Monad (mzero)
import qualified Text.Parsec as P
import Text.Parsec.String (Parser)
--------------------------------------------------------------------------------
metadataKey :: Parser String
metadataKey = do
i <- (:) <$> P.letter <*> (P.many $ P.alphaNum <|> P.oneOf "_-.")
if i `elem` reservedKeys then mzero else return i
--------------------------------------------------------------------------------
reservedKeys :: [String]
reservedKeys = ["if", "else", "endif", "for", "sep", "endfor", "partial"]
|