Format: add function diffExtensions.

This commit is contained in:
Albert Krewinkel
2022-12-16 10:43:01 -08:00
committed by John MacFarlane
parent 038df3b24c
commit db0232fc54
+9
View File
@@ -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