From 4d244168a7d39b0064765213d0f0949b048f9a0d Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 26 Feb 2013 10:41:03 -0700 Subject: 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 --- --- src/Hakyll/Core/Provider/Metadata.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/Hakyll') 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 -------------------------------------------------------------------------------- -- cgit v1.2.3