summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Jones <pjones@pmade.com>2013-02-26 10:41:03 -0700
committerPeter Jones <pjones@pmade.com>2013-02-26 10:41:03 -0700
commit4d244168a7d39b0064765213d0f0949b048f9a0d (patch)
tree54231f2c216db429ad5b35538bf288ff1c94d584
parent151c142960d41833f72d0ac06ee5710a42639384 (diff)
downloadhakyll-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.hs5
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
--------------------------------------------------------------------------------