diff options
| author | Albert Krewinkel <[email protected]> | 2022-10-19 19:07:56 +0200 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2022-12-16 10:43:01 -0800 |
| commit | db0232fc545913a9ea6e81d84fc5ee4d9cc8a185 (patch) | |
| tree | 39c7af038121b24b825b659007b9acf8a1c4df7e | |
| parent | 038df3b24c7413348795c28240f69def525277be (diff) | |
Format: add function `diffExtensions`.
| -rw-r--r-- | src/Text/Pandoc/Format.hs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Format.hs b/src/Text/Pandoc/Format.hs index 5e5829553..afd483577 100644 --- a/src/Text/Pandoc/Format.hs +++ b/src/Text/Pandoc/Format.hs @@ -12,6 +12,7 @@ module Text.Pandoc.Format ( FlavoredFormat (..) , ExtensionsConfig (..) , ExtensionsDiff (..) + , diffExtensions , parseFlavoredFormat , applyExtensionsDiff , getExtensionsConfig @@ -59,6 +60,14 @@ instance Monoid ExtensionsDiff where mempty = ExtensionsDiff mempty mempty mappend = (<>) +-- | Calculate the change set to get from one set of extensions to +-- another. +diffExtensions :: Extensions -> Extensions -> ExtensionsDiff +diffExtensions def actual = ExtensionsDiff + { extsToEnable = actual `disableExtensions` def + , extsToDisable = def `disableExtensions` actual + } + -- | Describes the properties of a format. data ExtensionsConfig = ExtensionsConfig { extsDefault :: Extensions -- ^ Extensions enabled by default |
