Skip to content

Commit

Permalink
Make env interpolation work for to and from fields...
Browse files Browse the repository at this point in the history
...in defaults files. These can contain paths of custom readers and
writers. See #8024.
  • Loading branch information
jgm committed Sep 16, 2024
1 parent 5e3011f commit 56854c2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/Text/Pandoc/App/Opt.hs
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,9 @@ resolveVarsInOpt :: forall m. (PandocMonad m, MonadIO m)
=> Opt -> StateT DefaultsState m Opt
resolveVarsInOpt
opt@Opt
{ optTemplate = oTemplate
{ optTo = oTo
, optFrom = oFrom
, optTemplate = oTemplate
, optMetadataFiles = oMetadataFiles
, optOutputFile = oOutputFile
, optInputFiles = oInputFiles
Expand All @@ -334,6 +336,8 @@ resolveVarsInOpt
, optHighlightStyle = oHighlightStyle
}
= do
oTo' <- mapM (fmap T.pack . resolveVars . T.unpack) oTo
oFrom' <- mapM (fmap T.pack . resolveVars . T.unpack) oFrom
oTemplate' <- mapM resolveVars oTemplate
oMetadataFiles' <- mapM resolveVars oMetadataFiles
oOutputFile' <- mapM resolveVars oOutputFile
Expand All @@ -358,7 +362,9 @@ resolveVarsInOpt
oCitationAbbreviations' <- mapM resolveVars oCitationAbbreviations
oPdfEngine' <- mapM resolveVars oPdfEngine
oHighlightStyle' <- mapM (fmap T.pack . resolveVars . T.unpack) oHighlightStyle
return opt{ optTemplate = oTemplate'
return opt{ optTo = oTo'
, optFrom = oFrom'
, optTemplate = oTemplate'
, optMetadataFiles = oMetadataFiles'
, optOutputFile = oOutputFile'
, optInputFiles = oInputFiles'
Expand Down

0 comments on commit 56854c2

Please sign in to comment.