Copyright | © 2022-2024 Albert Krewinkel |
---|---|
License | GPL-2.0-or-later |
Maintainer | Albert Krewinkel <pandoc@tarleb.com> |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Handling of format specifiers for input and output.
Synopsis
- data FlavoredFormat = FlavoredFormat {}
- data ExtensionsConfig = ExtensionsConfig {}
- data ExtensionsDiff = ExtensionsDiff {}
- diffExtensions :: Extensions -> Extensions -> ExtensionsDiff
- parseFlavoredFormat :: PandocMonad m => Text -> m FlavoredFormat
- applyExtensionsDiff :: PandocMonad m => ExtensionsConfig -> FlavoredFormat -> m Extensions
- getExtensionsConfig :: Text -> ExtensionsConfig
- formatFromFilePaths :: [FilePath] -> Maybe FlavoredFormat
Documentation
data FlavoredFormat Source #
Format specifier with the format's name and the lists of extensions to be enabled or disabled.
Instances
Show FlavoredFormat Source # | |
Defined in Text.Pandoc.Format showsPrec :: Int -> FlavoredFormat -> ShowS # show :: FlavoredFormat -> String # showList :: [FlavoredFormat] -> ShowS # |
data ExtensionsConfig Source #
Describes the properties of a format.
ExtensionsConfig | |
|
Instances
Monoid ExtensionsConfig Source # | |
Defined in Text.Pandoc.Format | |
Semigroup ExtensionsConfig Source # | |
Defined in Text.Pandoc.Format (<>) :: ExtensionsConfig -> ExtensionsConfig -> ExtensionsConfig # sconcat :: NonEmpty ExtensionsConfig -> ExtensionsConfig # stimes :: Integral b => b -> ExtensionsConfig -> ExtensionsConfig # | |
Show ExtensionsConfig Source # | |
Defined in Text.Pandoc.Format showsPrec :: Int -> ExtensionsConfig -> ShowS # show :: ExtensionsConfig -> String # showList :: [ExtensionsConfig] -> ShowS # |
data ExtensionsDiff Source #
Changes to a set of extensions, i.e., list of extensions to be enabled or disabled.
Instances
Monoid ExtensionsDiff Source # | |
Defined in Text.Pandoc.Format mappend :: ExtensionsDiff -> ExtensionsDiff -> ExtensionsDiff # mconcat :: [ExtensionsDiff] -> ExtensionsDiff # | |
Semigroup ExtensionsDiff Source # | |
Defined in Text.Pandoc.Format (<>) :: ExtensionsDiff -> ExtensionsDiff -> ExtensionsDiff # sconcat :: NonEmpty ExtensionsDiff -> ExtensionsDiff # stimes :: Integral b => b -> ExtensionsDiff -> ExtensionsDiff # | |
Show ExtensionsDiff Source # | |
Defined in Text.Pandoc.Format showsPrec :: Int -> ExtensionsDiff -> ShowS # show :: ExtensionsDiff -> String # showList :: [ExtensionsDiff] -> ShowS # |
diffExtensions :: Extensions -> Extensions -> ExtensionsDiff Source #
Calculate the change set to get from one set of extensions to another.
parseFlavoredFormat :: PandocMonad m => Text -> m FlavoredFormat Source #
Parse a format-specifying string into a markup format and the change set to the format's extensions. Throws an error if the spec cannot be parsed or contains an unknown extension.
applyExtensionsDiff :: PandocMonad m => ExtensionsConfig -> FlavoredFormat -> m Extensions Source #
Apply the extension changes in the format spec to the extensions given in the format's extensions configuration. Throws an error in case of an unknown or unsupported extension.
getExtensionsConfig :: Text -> ExtensionsConfig Source #
Returns the extensions configuration of a format.
formatFromFilePaths :: [FilePath] -> Maybe FlavoredFormat Source #
Determines default format based on file extensions; uses the format of the first extension that's associated with a format.
Examples:
formatFromFilePaths ["text.unknown", "no-extension"]
Nothing
formatFromFilePaths ["my.md", "other.rst"]
Just "markdown"