diff options
author | Peter Jones <pjones@pmade.com> | 2013-02-26 10:41:03 -0700 |
---|---|---|
committer | Peter Jones <pjones@pmade.com> | 2013-02-26 10:41:03 -0700 |
commit | 4d244168a7d39b0064765213d0f0949b048f9a0d (patch) | |
tree | 54231f2c216db429ad5b35538bf288ff1c94d584 | |
parent | 151c142960d41833f72d0ac06ee5710a42639384 (diff) | |
download | hakyll-4d244168a7d39b0064765213d0f0949b048f9a0d.tar.gz |
Ignore initial whitespace in a continuation line for a metadata field
When parsing a metadata field that spans several lines skip over the
initial whitespace on each line. This allows alignment of metadata
fields:
---
description: A long description that would look better if it
spanned multiple lines and was indented
---
-rw-r--r-- | src/Hakyll/Core/Provider/Metadata.hs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/Hakyll/Core/Provider/Metadata.hs b/src/Hakyll/Core/Provider/Metadata.hs index 276483b..ee07e9f 100644 --- a/src/Hakyll/Core/Provider/Metadata.hs +++ b/src/Hakyll/Core/Provider/Metadata.hs @@ -9,6 +9,7 @@ module Hakyll.Core.Provider.Metadata import Control.Applicative import Control.Arrow (second) import qualified Data.ByteString.Char8 as BC +import Data.List (intercalate) import qualified Data.Map as M import System.IO as IO import Text.Parsec ((<?>)) @@ -94,9 +95,9 @@ metadataField = do P.skipMany1 inlineSpace <?> "space followed by metadata for: " ++ key value <- P.manyTill P.anyChar newline trailing' <- P.many trailing - return (key, trim $ value ++ concat trailing') + return (key, trim $ value ++ intercalate " " trailing') where - trailing = (++) <$> P.many1 inlineSpace <*> P.manyTill P.anyChar newline + trailing = P.many1 inlineSpace *> P.manyTill P.anyChar newline -------------------------------------------------------------------------------- |