mirror of
https://github.com/jgm/pandoc.git
synced 2026-08-25 17:56:32 +00:00
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.
This commit is contained in:
@@ -180,7 +180,9 @@ doOpt (k',v) = do
|
||||
parseYAML v >>= \x -> return (\o -> o{ optTemplate = unpack <$> x })
|
||||
"variables" ->
|
||||
parseYAML v >>= \x -> return (\o -> o{ optVariables =
|
||||
optVariables o <> x })
|
||||
x <> optVariables o })
|
||||
-- Note: x comes first because <> for Context is left-biased union
|
||||
-- and we want to favor later default files. See #5988.
|
||||
"metadata" ->
|
||||
parseYAML v >>= \x -> return (\o -> o{ optMetadata = optMetadata o <>
|
||||
contextToMeta x })
|
||||
|
||||
Reference in New Issue
Block a user