diff options
author | John MacFarlane <fiddlosopher@gmail.com> | 2013-09-08 12:04:47 -0700 |
---|---|---|
committer | John MacFarlane <fiddlosopher@gmail.com> | 2013-09-08 12:04:47 -0700 |
commit | c78557f3ca333d9ae925fdcb8a7c03199f5e47fd (patch) | |
tree | f37cd1e4f9a562cd0a736f976c583cf668c0c455 /src/Text/Pandoc | |
parent | f8ecda0152990f4e1c7a6b5f45cecdefe5ac54f5 (diff) | |
download | pandoc-c78557f3ca333d9ae925fdcb8a7c03199f5e47fd.tar.gz |
Templates: more consistent behavior of `$for$`.
When `foo` is not a list, `$for(foo)$...$endfor$` should behave like
$if(foo)$...$endif$. So if `foo` resolves to "", no output should
be produced.
See pandoc-templates#39.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Templates.hs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Templates.hs b/src/Text/Pandoc/Templates.hs index 22a44e735..7f744c7e1 100644 --- a/src/Text/Pandoc/Templates.hs +++ b/src/Text/Pandoc/Templates.hs @@ -212,7 +212,7 @@ iter var' template sep = Template $ \val -> unTemplate Just (Array vec) -> mconcat $ intersperse sep $ map (setVar template var') $ toList vec - Just x -> setVar template var' x + Just x -> cond var' (setVar template var' x) mempty Nothing -> mempty) val setVar :: Template -> Variable -> Value -> Template |