git.iko.soy/typeable/pandoc
on master help sign in
Ensure that later default file values for `variable` replace earlier ones.

The semigroup instance for doctemplates Context does a left-biased union on the underlying Map. That means that if you union `{a: 1}` and `{a: 2}`, you get `{a: 1}`. This commit causes pandoc to do the operation in the opposite order, so that later default files take precedence in the values they assign to keys. See #5988.

commit71fab252d5d6066fb6be585246738773121bee5f authorJohn MacFarlane <jgm@berkeley.edu> dateSun 22 Dec 2019, 22:01 (7 years ago) parent7ba55d7
1 file changed+3−1
src/Text/Pandoc/App/Opt.hs+3−1
src/Text/Pandoc/App/Opt.hs+3−1
@@ -180,7 +180,9 @@ doOpt (k',v) = do
180180 parseYAML v >>= \x -> return (\o -> o{ optTemplate = unpack <$> x })
181181 "variables" ->
182182 parseYAML v >>= \x -> return (\o -> o{ optVariables =
183− optVariables o <> x })
183+ x <> optVariables o })
184+ -- Note: x comes first because <> for Context is left-biased union
185+ -- and we want to favor later default files. See #5988.
184186 "metadata" ->
185187 parseYAML v >>= \x -> return (\o -> o{ optMetadata = optMetadata o <>
186188 contextToMeta x })