From 1fe97422630d4aa5644d55b0b3b41b0978b7fea0 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 20 Oct 2019 22:49:04 -0700 Subject: Changes to build with new doctemplates/doclayout. The new version of doctemplates adds many features to pandoc's templating system, while remaining backwards-compatible. New features include partials and filters. Using template filters, one can lay out data in enumerated lists and tables. Templates are now layout-sensitive: so, for example, if a text with soft line breaks is interpolated near the end of a line, the text will break and wrap naturally. This makes the templating system much more suitable for programatically generating markdown or other plain-text files from metadata. --- src/Text/Pandoc/App/Opt.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/Text/Pandoc/App') diff --git a/src/Text/Pandoc/App/Opt.hs b/src/Text/Pandoc/App/Opt.hs index 4c08e3074..7216fa1ed 100644 --- a/src/Text/Pandoc/App/Opt.hs +++ b/src/Text/Pandoc/App/Opt.hs @@ -33,6 +33,7 @@ import Text.Pandoc.Options (TopLevelDivision (TopLevelDefault), ObfuscationMethod (NoObfuscation), CiteMethod (Citeproc)) import Text.Pandoc.Shared (camelCaseToHyphenated) +import Text.DocLayout (render) import Text.DocTemplates (Context(..), Val(..)) import Data.Text (Text, unpack) import qualified Data.Text as T @@ -405,7 +406,7 @@ valToMetaVal :: Val Text -> MetaValue valToMetaVal (MapVal (Context m)) = MetaMap . M.mapKeys unpack . M.map valToMetaVal $ m valToMetaVal (ListVal xs) = MetaList $ map valToMetaVal xs -valToMetaVal (SimpleVal t) = MetaString (unpack t) +valToMetaVal (SimpleVal d) = MetaString (unpack $ render Nothing d) valToMetaVal NullVal = MetaString "" -- see https://github.com/jgm/pandoc/pull/4083 -- cgit v1.2.3