{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE OverloadedStrings #-}
module Text.Pandoc.Extensions ( Extension(..)
, Extensions
, emptyExtensions
, extensionsFromList
, parseFormatSpec
, extensionEnabled
, enableExtension
, disableExtension
, getDefaultExtensions
, getAllExtensions
, pandocExtensions
, plainExtensions
, strictExtensions
, phpMarkdownExtraExtensions
, githubMarkdownExtensions
, multimarkdownExtensions )
where
import Data.Bits (clearBit, setBit, testBit, (.|.))
import Data.Data (Data)
import qualified Data.Text as T
import Data.Typeable (Typeable)
import GHC.Generics (Generic)
import Safe (readMay)
import Text.Parsec
import Data.Aeson.TH (deriveJSON, defaultOptions)
newtype Extensions = Extensions Integer
deriving (Int -> Extensions -> ShowS
[Extensions] -> ShowS
Extensions -> String
(Int -> Extensions -> ShowS)
-> (Extensions -> String)
-> ([Extensions] -> ShowS)
-> Show Extensions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Extensions] -> ShowS
$cshowList :: [Extensions] -> ShowS
show :: Extensions -> String
$cshow :: Extensions -> String
showsPrec :: Int -> Extensions -> ShowS
$cshowsPrec :: Int -> Extensions -> ShowS
Show, ReadPrec [Extensions]
ReadPrec Extensions
Int -> ReadS Extensions
ReadS [Extensions]
(Int -> ReadS Extensions)
-> ReadS [Extensions]
-> ReadPrec Extensions
-> ReadPrec [Extensions]
-> Read Extensions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Extensions]
$creadListPrec :: ReadPrec [Extensions]
readPrec :: ReadPrec Extensions
$creadPrec :: ReadPrec Extensions
readList :: ReadS [Extensions]
$creadList :: ReadS [Extensions]
readsPrec :: Int -> ReadS Extensions
$creadsPrec :: Int -> ReadS Extensions
Read, Extensions -> Extensions -> Bool
(Extensions -> Extensions -> Bool)
-> (Extensions -> Extensions -> Bool) -> Eq Extensions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Extensions -> Extensions -> Bool
$c/= :: Extensions -> Extensions -> Bool
== :: Extensions -> Extensions -> Bool
$c== :: Extensions -> Extensions -> Bool
Eq, Eq Extensions
Eq Extensions
-> (Extensions -> Extensions -> Ordering)
-> (Extensions -> Extensions -> Bool)
-> (Extensions -> Extensions -> Bool)
-> (Extensions -> Extensions -> Bool)
-> (Extensions -> Extensions -> Bool)
-> (Extensions -> Extensions -> Extensions)
-> (Extensions -> Extensions -> Extensions)
-> Ord Extensions
Extensions -> Extensions -> Bool
Extensions -> Extensions -> Ordering
Extensions -> Extensions -> Extensions
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Extensions -> Extensions -> Extensions
$cmin :: Extensions -> Extensions -> Extensions
max :: Extensions -> Extensions -> Extensions
$cmax :: Extensions -> Extensions -> Extensions
>= :: Extensions -> Extensions -> Bool
$c>= :: Extensions -> Extensions -> Bool
> :: Extensions -> Extensions -> Bool
$c> :: Extensions -> Extensions -> Bool
<= :: Extensions -> Extensions -> Bool
$c<= :: Extensions -> Extensions -> Bool
< :: Extensions -> Extensions -> Bool
$c< :: Extensions -> Extensions -> Bool
compare :: Extensions -> Extensions -> Ordering
$ccompare :: Extensions -> Extensions -> Ordering
$cp1Ord :: Eq Extensions
Ord, Typeable Extensions
DataType
Constr
Typeable Extensions
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Extensions -> c Extensions)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Extensions)
-> (Extensions -> Constr)
-> (Extensions -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Extensions))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c Extensions))
-> ((forall b. Data b => b -> b) -> Extensions -> Extensions)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Extensions -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Extensions -> r)
-> (forall u. (forall d. Data d => d -> u) -> Extensions -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> Extensions -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Extensions -> m Extensions)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Extensions -> m Extensions)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Extensions -> m Extensions)
-> Data Extensions
Extensions -> DataType
Extensions -> Constr
(forall b. Data b => b -> b) -> Extensions -> Extensions
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Extensions -> c Extensions
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Extensions
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Extensions -> u
forall u. (forall d. Data d => d -> u) -> Extensions -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Extensions -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Extensions -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Extensions -> m Extensions
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Extensions -> m Extensions
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Extensions
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Extensions -> c Extensions
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Extensions)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Extensions)
$cExtensions :: Constr
$tExtensions :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Extensions -> m Extensions
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Extensions -> m Extensions
gmapMp :: (forall d. Data d => d -> m d) -> Extensions -> m Extensions
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Extensions -> m Extensions
gmapM :: (forall d. Data d => d -> m d) -> Extensions -> m Extensions
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Extensions -> m Extensions
gmapQi :: Int -> (forall d. Data d => d -> u) -> Extensions -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Extensions -> u
gmapQ :: (forall d. Data d => d -> u) -> Extensions -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Extensions -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Extensions -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Extensions -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Extensions -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Extensions -> r
gmapT :: (forall b. Data b => b -> b) -> Extensions -> Extensions
$cgmapT :: (forall b. Data b => b -> b) -> Extensions -> Extensions
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Extensions)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Extensions)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Extensions)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Extensions)
dataTypeOf :: Extensions -> DataType
$cdataTypeOf :: Extensions -> DataType
toConstr :: Extensions -> Constr
$ctoConstr :: Extensions -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Extensions
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Extensions
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Extensions -> c Extensions
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Extensions -> c Extensions
$cp1Data :: Typeable Extensions
Data, Typeable, (forall x. Extensions -> Rep Extensions x)
-> (forall x. Rep Extensions x -> Extensions) -> Generic Extensions
forall x. Rep Extensions x -> Extensions
forall x. Extensions -> Rep Extensions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Extensions x -> Extensions
$cfrom :: forall x. Extensions -> Rep Extensions x
Generic)
instance Semigroup Extensions where
(Extensions Integer
a) <> :: Extensions -> Extensions -> Extensions
<> (Extensions Integer
b) = Integer -> Extensions
Extensions (Integer
a Integer -> Integer -> Integer
forall a. Bits a => a -> a -> a
.|. Integer
b)
instance Monoid Extensions where
mempty :: Extensions
mempty = Integer -> Extensions
Extensions Integer
0
mappend :: Extensions -> Extensions -> Extensions
mappend = Extensions -> Extensions -> Extensions
forall a. Semigroup a => a -> a -> a
(<>)
extensionsFromList :: [Extension] -> Extensions
extensionsFromList :: [Extension] -> Extensions
extensionsFromList = (Extension -> Extensions -> Extensions)
-> Extensions -> [Extension] -> Extensions
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr Extension -> Extensions -> Extensions
enableExtension Extensions
emptyExtensions
emptyExtensions :: Extensions
emptyExtensions :: Extensions
emptyExtensions = Integer -> Extensions
Extensions Integer
0
extensionEnabled :: Extension -> Extensions -> Bool
extensionEnabled :: Extension -> Extensions -> Bool
extensionEnabled Extension
x (Extensions Integer
exts) = Integer -> Int -> Bool
forall a. Bits a => a -> Int -> Bool
testBit Integer
exts (Extension -> Int
forall a. Enum a => a -> Int
fromEnum Extension
x)
enableExtension :: Extension -> Extensions -> Extensions
enableExtension :: Extension -> Extensions -> Extensions
enableExtension Extension
x (Extensions Integer
exts) = Integer -> Extensions
Extensions (Integer -> Int -> Integer
forall a. Bits a => a -> Int -> a
setBit Integer
exts (Extension -> Int
forall a. Enum a => a -> Int
fromEnum Extension
x))
disableExtension :: Extension -> Extensions -> Extensions
disableExtension :: Extension -> Extensions -> Extensions
disableExtension Extension
x (Extensions Integer
exts) = Integer -> Extensions
Extensions (Integer -> Int -> Integer
forall a. Bits a => a -> Int -> a
clearBit Integer
exts (Extension -> Int
forall a. Enum a => a -> Int
fromEnum Extension
x))
data Extension =
Ext_abbreviations
| Ext_all_symbols_escapable
| Ext_amuse
| Ext_angle_brackets_escapable
| Ext_ascii_identifiers
| Ext_auto_identifiers
| Ext_autolink_bare_uris
| Ext_backtick_code_blocks
| Ext_blank_before_blockquote
|
| Ext_bracketed_spans
| Ext_citations
| Ext_compact_definition_lists
| Ext_definition_lists
| Ext_east_asian_line_breaks
| Ext_emoji
| Ext_empty_paragraphs
| Ext_epub_html_exts
| Ext_escaped_line_breaks
| Ext_example_lists
| Ext_fancy_lists
| Ext_fenced_code_attributes
| Ext_fenced_code_blocks
| Ext_fenced_divs
|
| Ext_four_space_rule
| Ext_gfm_auto_identifiers
| Ext_grid_tables
| Ext_hard_line_breaks
|
| Ext_ignore_line_breaks
| Ext_implicit_figures
|
| Ext_inline_code_attributes
| Ext_inline_notes
| Ext_intraword_underscores
| Ext_latex_macros
| Ext_line_blocks
| Ext_link_attributes
| Ext_lists_without_preceding_blankline
| Ext_literate_haskell
| Ext_markdown_attribute
| Ext_markdown_in_html_blocks
|
| Ext_mmd_link_attributes
| Ext_mmd_title_block
| Ext_multiline_tables
| Ext_native_divs
| Ext_native_spans
| Ext_native_numbering
| Ext_ntb
| Ext_old_dashes
| Ext_pandoc_title_block
| Ext_pipe_tables
| Ext_raw_attribute
| Ext_raw_html
| Ext_raw_tex
| Ext_raw_markdown
| Ext_shortcut_reference_links
| Ext_simple_tables
| Ext_smart
|
| Ext_spaced_reference_links
| Ext_startnum
| Ext_strikeout
| Ext_subscript
| Ext_superscript
| Ext_styles
| Ext_task_lists
| Ext_table_captions
| Ext_tex_math_dollars
| Ext_tex_math_double_backslash
| Ext_tex_math_single_backslash
| Ext_yaml_metadata_block
| Ext_gutenberg
| Ext_attributes
deriving (Int -> Extension -> ShowS
[Extension] -> ShowS
Extension -> String
(Int -> Extension -> ShowS)
-> (Extension -> String)
-> ([Extension] -> ShowS)
-> Show Extension
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Extension] -> ShowS
$cshowList :: [Extension] -> ShowS
show :: Extension -> String
$cshow :: Extension -> String
showsPrec :: Int -> Extension -> ShowS
$cshowsPrec :: Int -> Extension -> ShowS
Show, ReadPrec [Extension]
ReadPrec Extension
Int -> ReadS Extension
ReadS [Extension]
(Int -> ReadS Extension)
-> ReadS [Extension]
-> ReadPrec Extension
-> ReadPrec [Extension]
-> Read Extension
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Extension]
$creadListPrec :: ReadPrec [Extension]
readPrec :: ReadPrec Extension
$creadPrec :: ReadPrec Extension
readList :: ReadS [Extension]
$creadList :: ReadS [Extension]
readsPrec :: Int -> ReadS Extension
$creadsPrec :: Int -> ReadS Extension
Read, Int -> Extension
Extension -> Int
Extension -> [Extension]
Extension -> Extension
Extension -> Extension -> [Extension]
Extension -> Extension -> Extension -> [Extension]
(Extension -> Extension)
-> (Extension -> Extension)
-> (Int -> Extension)
-> (Extension -> Int)
-> (Extension -> [Extension])
-> (Extension -> Extension -> [Extension])
-> (Extension -> Extension -> [Extension])
-> (Extension -> Extension -> Extension -> [Extension])
-> Enum Extension
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: Extension -> Extension -> Extension -> [Extension]
$cenumFromThenTo :: Extension -> Extension -> Extension -> [Extension]
enumFromTo :: Extension -> Extension -> [Extension]
$cenumFromTo :: Extension -> Extension -> [Extension]
enumFromThen :: Extension -> Extension -> [Extension]
$cenumFromThen :: Extension -> Extension -> [Extension]
enumFrom :: Extension -> [Extension]
$cenumFrom :: Extension -> [Extension]
fromEnum :: Extension -> Int
$cfromEnum :: Extension -> Int
toEnum :: Int -> Extension
$ctoEnum :: Int -> Extension
pred :: Extension -> Extension
$cpred :: Extension -> Extension
succ :: Extension -> Extension
$csucc :: Extension -> Extension
Enum, Extension -> Extension -> Bool
(Extension -> Extension -> Bool)
-> (Extension -> Extension -> Bool) -> Eq Extension
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Extension -> Extension -> Bool
$c/= :: Extension -> Extension -> Bool
== :: Extension -> Extension -> Bool
$c== :: Extension -> Extension -> Bool
Eq, Eq Extension
Eq Extension
-> (Extension -> Extension -> Ordering)
-> (Extension -> Extension -> Bool)
-> (Extension -> Extension -> Bool)
-> (Extension -> Extension -> Bool)
-> (Extension -> Extension -> Bool)
-> (Extension -> Extension -> Extension)
-> (Extension -> Extension -> Extension)
-> Ord Extension
Extension -> Extension -> Bool
Extension -> Extension -> Ordering
Extension -> Extension -> Extension
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Extension -> Extension -> Extension
$cmin :: Extension -> Extension -> Extension
max :: Extension -> Extension -> Extension
$cmax :: Extension -> Extension -> Extension
>= :: Extension -> Extension -> Bool
$c>= :: Extension -> Extension -> Bool
> :: Extension -> Extension -> Bool
$c> :: Extension -> Extension -> Bool
<= :: Extension -> Extension -> Bool
$c<= :: Extension -> Extension -> Bool
< :: Extension -> Extension -> Bool
$c< :: Extension -> Extension -> Bool
compare :: Extension -> Extension -> Ordering
$ccompare :: Extension -> Extension -> Ordering
$cp1Ord :: Eq Extension
Ord, Extension
Extension -> Extension -> Bounded Extension
forall a. a -> a -> Bounded a
maxBound :: Extension
$cmaxBound :: Extension
minBound :: Extension
$cminBound :: Extension
Bounded, , Typeable, (forall x. Extension -> Rep Extension x)
-> (forall x. Rep Extension x -> Extension) -> Generic Extension
forall x. Rep Extension x -> Extension
forall x. Extension -> Rep Extension x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Extension x -> Extension
$cfrom :: forall x. Extension -> Rep Extension x
Generic)
pandocExtensions :: Extensions
pandocExtensions :: Extensions
pandocExtensions = [Extension] -> Extensions
extensionsFromList
[ Extension
Ext_footnotes
, Extension
Ext_inline_notes
, Extension
Ext_pandoc_title_block
, Extension
Ext_yaml_metadata_block
, Extension
Ext_table_captions
, Extension
Ext_implicit_figures
, Extension
Ext_simple_tables
, Extension
Ext_multiline_tables
, Extension
Ext_grid_tables
, Extension
Ext_pipe_tables
, Extension
Ext_citations
, Extension
Ext_raw_tex
, Extension
Ext_raw_html
, Extension
Ext_tex_math_dollars
, Extension
Ext_latex_macros
, Extension
Ext_fenced_code_blocks
, Extension
Ext_fenced_code_attributes
, Extension
Ext_backtick_code_blocks
, Extension
Ext_inline_code_attributes
, Extension
Ext_raw_attribute
, Extension
Ext_markdown_in_html_blocks
, Extension
Ext_native_divs
, Extension
Ext_fenced_divs
, Extension
Ext_native_spans
, Extension
Ext_bracketed_spans
, Extension
Ext_escaped_line_breaks
, Extension
Ext_fancy_lists
, Extension
Ext_startnum
, Extension
Ext_definition_lists
, Extension
Ext_example_lists
, Extension
Ext_all_symbols_escapable
, Extension
Ext_intraword_underscores
, Extension
Ext_blank_before_blockquote
, Extension
Ext_blank_before_header
, Extension
Ext_space_in_atx_header
, Extension
Ext_strikeout
, Extension
Ext_superscript
, Extension
Ext_subscript
, Extension
Ext_task_lists
, Extension
Ext_auto_identifiers
, Extension
Ext_header_attributes
, Extension
Ext_link_attributes
, Extension
Ext_implicit_header_references
, Extension
Ext_line_blocks
, Extension
Ext_shortcut_reference_links
, Extension
Ext_smart
]
plainExtensions :: Extensions
plainExtensions :: Extensions
plainExtensions = [Extension] -> Extensions
extensionsFromList
[ Extension
Ext_table_captions
, Extension
Ext_implicit_figures
, Extension
Ext_simple_tables
, Extension
Ext_multiline_tables
, Extension
Ext_grid_tables
, Extension
Ext_latex_macros
, Extension
Ext_fancy_lists
, Extension
Ext_startnum
, Extension
Ext_definition_lists
, Extension
Ext_example_lists
, Extension
Ext_intraword_underscores
, Extension
Ext_blank_before_blockquote
, Extension
Ext_blank_before_header
, Extension
Ext_strikeout
]
phpMarkdownExtraExtensions :: Extensions
= [Extension] -> Extensions
extensionsFromList
[ Extension
Ext_footnotes
, Extension
Ext_pipe_tables
, Extension
Ext_raw_html
, Extension
Ext_markdown_attribute
, Extension
Ext_fenced_code_blocks
, Extension
Ext_definition_lists
, Extension
Ext_intraword_underscores
, Extension
Ext_header_attributes
, Extension
Ext_link_attributes
, Extension
Ext_abbreviations
, Extension
Ext_shortcut_reference_links
, Extension
Ext_spaced_reference_links
]
githubMarkdownExtensions :: Extensions
githubMarkdownExtensions :: Extensions
githubMarkdownExtensions = [Extension] -> Extensions
extensionsFromList
[ Extension
Ext_pipe_tables
, Extension
Ext_raw_html
, Extension
Ext_native_divs
, Extension
Ext_auto_identifiers
, Extension
Ext_gfm_auto_identifiers
, Extension
Ext_autolink_bare_uris
, Extension
Ext_strikeout
, Extension
Ext_task_lists
, Extension
Ext_emoji
, Extension
Ext_fenced_code_blocks
, Extension
Ext_backtick_code_blocks
]
multimarkdownExtensions :: Extensions
multimarkdownExtensions :: Extensions
multimarkdownExtensions = [Extension] -> Extensions
extensionsFromList
[ Extension
Ext_pipe_tables
, Extension
Ext_raw_html
, Extension
Ext_markdown_attribute
, Extension
Ext_mmd_link_attributes
, Extension
Ext_tex_math_double_backslash
, Extension
Ext_tex_math_dollars
, Extension
Ext_intraword_underscores
, Extension
Ext_mmd_title_block
, Extension
Ext_footnotes
, Extension
Ext_definition_lists
, Extension
Ext_all_symbols_escapable
, Extension
Ext_implicit_header_references
, Extension
Ext_shortcut_reference_links
, Extension
Ext_auto_identifiers
, Extension
Ext_mmd_header_identifiers
, Extension
Ext_implicit_figures
, Extension
Ext_superscript
, Extension
Ext_subscript
, Extension
Ext_backtick_code_blocks
, Extension
Ext_spaced_reference_links
, Extension
Ext_raw_attribute
]
strictExtensions :: Extensions
strictExtensions :: Extensions
strictExtensions = [Extension] -> Extensions
extensionsFromList
[ Extension
Ext_raw_html
, Extension
Ext_shortcut_reference_links
, Extension
Ext_spaced_reference_links
]
getDefaultExtensions :: T.Text -> Extensions
getDefaultExtensions :: Text -> Extensions
getDefaultExtensions Text
"markdown_strict" = Extensions
strictExtensions
getDefaultExtensions Text
"markdown_phpextra" = Extensions
phpMarkdownExtraExtensions
getDefaultExtensions Text
"markdown_mmd" = Extensions
multimarkdownExtensions
getDefaultExtensions Text
"markdown_github" = Extensions
githubMarkdownExtensions Extensions -> Extensions -> Extensions
forall a. Semigroup a => a -> a -> a
<>
[Extension] -> Extensions
extensionsFromList
[ Extension
Ext_all_symbols_escapable
, Extension
Ext_backtick_code_blocks
, Extension
Ext_fenced_code_blocks
, Extension
Ext_space_in_atx_header
, Extension
Ext_intraword_underscores
, Extension
Ext_lists_without_preceding_blankline
, Extension
Ext_shortcut_reference_links
]
getDefaultExtensions Text
"markdown" = Extensions
pandocExtensions
getDefaultExtensions Text
"ipynb" =
[Extension] -> Extensions
extensionsFromList
[ Extension
Ext_all_symbols_escapable
, Extension
Ext_pipe_tables
, Extension
Ext_raw_html
, Extension
Ext_fenced_code_blocks
, Extension
Ext_auto_identifiers
, Extension
Ext_gfm_auto_identifiers
, Extension
Ext_backtick_code_blocks
, Extension
Ext_autolink_bare_uris
, Extension
Ext_space_in_atx_header
, Extension
Ext_intraword_underscores
, Extension
Ext_strikeout
, Extension
Ext_task_lists
, Extension
Ext_lists_without_preceding_blankline
, Extension
Ext_shortcut_reference_links
, Extension
Ext_tex_math_dollars
]
getDefaultExtensions Text
"muse" = [Extension] -> Extensions
extensionsFromList
[Extension
Ext_amuse,
Extension
Ext_auto_identifiers]
getDefaultExtensions Text
"plain" = Extensions
plainExtensions
getDefaultExtensions Text
"gfm" = [Extension] -> Extensions
extensionsFromList
[ Extension
Ext_pipe_tables
, Extension
Ext_raw_html
, Extension
Ext_native_divs
, Extension
Ext_auto_identifiers
, Extension
Ext_gfm_auto_identifiers
, Extension
Ext_autolink_bare_uris
, Extension
Ext_strikeout
, Extension
Ext_task_lists
, Extension
Ext_emoji
]
getDefaultExtensions Text
"commonmark" = [Extension] -> Extensions
extensionsFromList
[Extension
Ext_raw_html]
getDefaultExtensions Text
"commonmark_x" = [Extension] -> Extensions
extensionsFromList
[ Extension
Ext_pipe_tables
, Extension
Ext_raw_html
, Extension
Ext_auto_identifiers
, Extension
Ext_strikeout
, Extension
Ext_task_lists
, Extension
Ext_emoji
, Extension
Ext_pipe_tables
, Extension
Ext_raw_html
, Extension
Ext_raw_tex
, Extension
Ext_smart
, Extension
Ext_tex_math_dollars
, Extension
Ext_superscript
, Extension
Ext_subscript
, Extension
Ext_definition_lists
, Extension
Ext_footnotes
, Extension
Ext_fancy_lists
, Extension
Ext_fenced_divs
, Extension
Ext_bracketed_spans
, Extension
Ext_raw_attribute
, Extension
Ext_implicit_header_references
, Extension
Ext_attributes
, Extension
Ext_fenced_code_attributes
]
getDefaultExtensions Text
"org" = [Extension] -> Extensions
extensionsFromList
[Extension
Ext_citations,
Extension
Ext_auto_identifiers]
getDefaultExtensions Text
"html" = [Extension] -> Extensions
extensionsFromList
[Extension
Ext_auto_identifiers,
Extension
Ext_native_divs,
Extension
Ext_line_blocks,
Extension
Ext_native_spans]
getDefaultExtensions Text
"html4" = Text -> Extensions
getDefaultExtensions Text
"html"
getDefaultExtensions Text
"html5" = Text -> Extensions
getDefaultExtensions Text
"html"
getDefaultExtensions Text
"epub" = [Extension] -> Extensions
extensionsFromList
[Extension
Ext_raw_html,
Extension
Ext_native_divs,
Extension
Ext_native_spans,
Extension
Ext_epub_html_exts]
getDefaultExtensions Text
"epub2" = Text -> Extensions
getDefaultExtensions Text
"epub"
getDefaultExtensions Text
"epub3" = Text -> Extensions
getDefaultExtensions Text
"epub"
getDefaultExtensions Text
"latex" = [Extension] -> Extensions
extensionsFromList
[Extension
Ext_smart,
Extension
Ext_latex_macros,
Extension
Ext_auto_identifiers]
getDefaultExtensions Text
"beamer" = [Extension] -> Extensions
extensionsFromList
[Extension
Ext_smart,
Extension
Ext_latex_macros,
Extension
Ext_auto_identifiers]
getDefaultExtensions Text
"context" = [Extension] -> Extensions
extensionsFromList
[Extension
Ext_smart,
Extension
Ext_auto_identifiers]
getDefaultExtensions Text
"textile" = [Extension] -> Extensions
extensionsFromList
[Extension
Ext_old_dashes,
Extension
Ext_smart,
Extension
Ext_raw_html,
Extension
Ext_auto_identifiers]
getDefaultExtensions Text
"opml" = Extensions
pandocExtensions
getDefaultExtensions Text
_ = [Extension] -> Extensions
extensionsFromList
[Extension
Ext_auto_identifiers]
getAllExtensions :: T.Text -> Extensions
getAllExtensions :: Text -> Extensions
getAllExtensions Text
f = Extensions
universalExtensions Extensions -> Extensions -> Extensions
forall a. Semigroup a => a -> a -> a
<> Text -> Extensions
forall t. (Eq t, IsString t) => t -> Extensions
getAll Text
f
where
autoIdExtensions :: Extensions
autoIdExtensions = [Extension] -> Extensions
extensionsFromList
[ Extension
Ext_auto_identifiers
, Extension
Ext_gfm_auto_identifiers
, Extension
Ext_ascii_identifiers
]
universalExtensions :: Extensions
universalExtensions = [Extension] -> Extensions
extensionsFromList
[ Extension
Ext_east_asian_line_breaks ]
allMarkdownExtensions :: Extensions
allMarkdownExtensions =
Extensions
pandocExtensions Extensions -> Extensions -> Extensions
forall a. Semigroup a => a -> a -> a
<> Extensions
autoIdExtensions Extensions -> Extensions -> Extensions
forall a. Semigroup a => a -> a -> a
<>
[Extension] -> Extensions
extensionsFromList
[ Extension
Ext_old_dashes
, Extension
Ext_angle_brackets_escapable
, Extension
Ext_lists_without_preceding_blankline
, Extension
Ext_four_space_rule
, Extension
Ext_spaced_reference_links
, Extension
Ext_hard_line_breaks
, Extension
Ext_ignore_line_breaks
, Extension
Ext_east_asian_line_breaks
, Extension
Ext_emoji
, Extension
Ext_tex_math_single_backslash
, Extension
Ext_tex_math_double_backslash
, Extension
Ext_markdown_attribute
, Extension
Ext_mmd_title_block
, Extension
Ext_abbreviations
, Extension
Ext_autolink_bare_uris
, Extension
Ext_mmd_link_attributes
, Extension
Ext_mmd_header_identifiers
, Extension
Ext_compact_definition_lists
, Extension
Ext_gutenberg
, Extension
Ext_smart
, Extension
Ext_literate_haskell
]
getAll :: t -> Extensions
getAll t
"markdown_strict" = Extensions
allMarkdownExtensions
getAll t
"markdown_phpextra" = Extensions
allMarkdownExtensions
getAll t
"markdown_mmd" = Extensions
allMarkdownExtensions
getAll t
"markdown_github" = Extensions
allMarkdownExtensions
getAll t
"markdown" = Extensions
allMarkdownExtensions
getAll t
"ipynb" = Extensions
allMarkdownExtensions Extensions -> Extensions -> Extensions
forall a. Semigroup a => a -> a -> a
<> [Extension] -> Extensions
extensionsFromList
[ Extension
Ext_raw_markdown ]
getAll t
"docx" = Extensions
autoIdExtensions Extensions -> Extensions -> Extensions
forall a. Semigroup a => a -> a -> a
<> [Extension] -> Extensions
extensionsFromList
[ Extension
Ext_empty_paragraphs
, Extension
Ext_styles
]
getAll t
"opendocument" = [Extension] -> Extensions
extensionsFromList
[ Extension
Ext_empty_paragraphs
, Extension
Ext_native_numbering
]
getAll t
"odt" = t -> Extensions
getAll t
"opendocument" Extensions -> Extensions -> Extensions
forall a. Semigroup a => a -> a -> a
<> Extensions
autoIdExtensions
getAll t
"muse" = Extensions
autoIdExtensions Extensions -> Extensions -> Extensions
forall a. Semigroup a => a -> a -> a
<>
[Extension] -> Extensions
extensionsFromList
[ Extension
Ext_amuse ]
getAll t
"asciidoc" = Extensions
autoIdExtensions
getAll t
"plain" = Extensions
allMarkdownExtensions
getAll t
"gfm" = t -> Extensions
getAll t
"commonmark"
getAll t
"commonmark" =
Extensions
autoIdExtensions Extensions -> Extensions -> Extensions
forall a. Semigroup a => a -> a -> a
<>
[Extension] -> Extensions
extensionsFromList
[ Extension
Ext_pipe_tables
, Extension
Ext_autolink_bare_uris
, Extension
Ext_strikeout
, Extension
Ext_task_lists
, Extension
Ext_emoji
, Extension
Ext_raw_html
, Extension
Ext_raw_tex
, Extension
Ext_implicit_figures
, Extension
Ext_hard_line_breaks
, Extension
Ext_smart
, Extension
Ext_tex_math_dollars
, Extension
Ext_superscript
, Extension
Ext_subscript
, Extension
Ext_definition_lists
, Extension
Ext_footnotes
, Extension
Ext_fancy_lists
, Extension
Ext_fenced_divs
, Extension
Ext_bracketed_spans
, Extension
Ext_raw_attribute
, Extension
Ext_implicit_header_references
, Extension
Ext_attributes
, Extension
Ext_fenced_code_attributes
]
getAll t
"commonmark_x" = t -> Extensions
getAll t
"commonmark"
getAll t
"org" = Extensions
autoIdExtensions Extensions -> Extensions -> Extensions
forall a. Semigroup a => a -> a -> a
<>
[Extension] -> Extensions
extensionsFromList
[ Extension
Ext_citations
, Extension
Ext_smart
]
getAll t
"html" = Extensions
autoIdExtensions Extensions -> Extensions -> Extensions
forall a. Semigroup a => a -> a -> a
<>
[Extension] -> Extensions
extensionsFromList
[ Extension
Ext_native_divs
, Extension
Ext_line_blocks
, Extension
Ext_native_spans
, Extension
Ext_empty_paragraphs
, Extension
Ext_raw_html
, Extension
Ext_raw_tex
, Extension
Ext_task_lists
, Extension
Ext_tex_math_dollars
, Extension
Ext_tex_math_single_backslash
, Extension
Ext_tex_math_double_backslash
, Extension
Ext_literate_haskell
, Extension
Ext_epub_html_exts
, Extension
Ext_smart
]
getAll t
"html4" = t -> Extensions
getAll t
"html"
getAll t
"html5" = t -> Extensions
getAll t
"html"
getAll t
"epub" = t -> Extensions
getAll t
"html"
getAll t
"epub2" = t -> Extensions
getAll t
"epub"
getAll t
"epub3" = t -> Extensions
getAll t
"epub"
getAll t
"latex" = Extensions
autoIdExtensions Extensions -> Extensions -> Extensions
forall a. Semigroup a => a -> a -> a
<>
[Extension] -> Extensions
extensionsFromList
[ Extension
Ext_smart
, Extension
Ext_latex_macros
, Extension
Ext_raw_tex
, Extension
Ext_task_lists
, Extension
Ext_literate_haskell
]
getAll t
"beamer" = t -> Extensions
getAll t
"latex"
getAll t
"context" = Extensions
autoIdExtensions Extensions -> Extensions -> Extensions
forall a. Semigroup a => a -> a -> a
<>
[Extension] -> Extensions
extensionsFromList
[ Extension
Ext_smart
, Extension
Ext_raw_tex
, Extension
Ext_ntb
]
getAll t
"textile" = Extensions
autoIdExtensions Extensions -> Extensions -> Extensions
forall a. Semigroup a => a -> a -> a
<>
[Extension] -> Extensions
extensionsFromList
[ Extension
Ext_old_dashes
, Extension
Ext_smart
, Extension
Ext_raw_tex
]
getAll t
"opml" = Extensions
allMarkdownExtensions
getAll t
"twiki" = Extensions
autoIdExtensions Extensions -> Extensions -> Extensions
forall a. Semigroup a => a -> a -> a
<>
[Extension] -> Extensions
extensionsFromList
[ Extension
Ext_smart ]
getAll t
"vimwiki" = Extensions
autoIdExtensions
getAll t
"dokuwiki" = Extensions
autoIdExtensions
getAll t
"tikiwiki" = Extensions
autoIdExtensions
getAll t
"rst" = Extensions
autoIdExtensions Extensions -> Extensions -> Extensions
forall a. Semigroup a => a -> a -> a
<>
[Extension] -> Extensions
extensionsFromList
[ Extension
Ext_smart
, Extension
Ext_literate_haskell
]
getAll t
"mediawiki" = Extensions
autoIdExtensions Extensions -> Extensions -> Extensions
forall a. Semigroup a => a -> a -> a
<>
[Extension] -> Extensions
extensionsFromList
[ Extension
Ext_smart ]
getAll t
_ = Extensions
forall a. Monoid a => a
mempty
parseFormatSpec :: T.Text
-> Either ParseError (T.Text, [Extension], [Extension])
parseFormatSpec :: Text -> Either ParseError (Text, [Extension], [Extension])
parseFormatSpec = Parsec Text () (Text, [Extension], [Extension])
-> String
-> Text
-> Either ParseError (Text, [Extension], [Extension])
forall s t a.
Stream s Identity t =>
Parsec s () a -> String -> s -> Either ParseError a
parse Parsec Text () (Text, [Extension], [Extension])
forall u. ParsecT Text u Identity (Text, [Extension], [Extension])
formatSpec String
""
where formatSpec :: ParsecT Text u Identity (Text, [Extension], [Extension])
formatSpec = do
String
name <- ParsecT Text u Identity String
forall u. ParsecT Text u Identity String
formatName
([Extension]
extsToEnable, [Extension]
extsToDisable) <- (([Extension], [Extension])
-> (([Extension], [Extension]) -> ([Extension], [Extension]))
-> ([Extension], [Extension]))
-> ([Extension], [Extension])
-> [([Extension], [Extension]) -> ([Extension], [Extension])]
-> ([Extension], [Extension])
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl (((([Extension], [Extension]) -> ([Extension], [Extension]))
-> ([Extension], [Extension]) -> ([Extension], [Extension]))
-> ([Extension], [Extension])
-> (([Extension], [Extension]) -> ([Extension], [Extension]))
-> ([Extension], [Extension])
forall a b c. (a -> b -> c) -> b -> a -> c
flip (([Extension], [Extension]) -> ([Extension], [Extension]))
-> ([Extension], [Extension]) -> ([Extension], [Extension])
forall a b. (a -> b) -> a -> b
($)) ([],[]) ([([Extension], [Extension]) -> ([Extension], [Extension])]
-> ([Extension], [Extension]))
-> ParsecT
Text
u
Identity
[([Extension], [Extension]) -> ([Extension], [Extension])]
-> ParsecT Text u Identity ([Extension], [Extension])
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
ParsecT
Text
u
Identity
(([Extension], [Extension]) -> ([Extension], [Extension]))
-> ParsecT
Text
u
Identity
[([Extension], [Extension]) -> ([Extension], [Extension])]
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m [a]
many ParsecT
Text
u
Identity
(([Extension], [Extension]) -> ([Extension], [Extension]))
forall u.
ParsecT
Text
u
Identity
(([Extension], [Extension]) -> ([Extension], [Extension]))
extMod
(Text, [Extension], [Extension])
-> ParsecT Text u Identity (Text, [Extension], [Extension])
forall (m :: * -> *) a. Monad m => a -> m a
return (String -> Text
T.pack String
name, [Extension] -> [Extension]
forall a. [a] -> [a]
reverse [Extension]
extsToEnable, [Extension] -> [Extension]
forall a. [a] -> [a]
reverse [Extension]
extsToDisable)
formatName :: ParsecT Text u Identity String
formatName = ParsecT Text u Identity Char -> ParsecT Text u Identity String
forall s (m :: * -> *) t u a.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m [a]
many1 (ParsecT Text u Identity Char -> ParsecT Text u Identity String)
-> ParsecT Text u Identity Char -> ParsecT Text u Identity String
forall a b. (a -> b) -> a -> b
$ String -> ParsecT Text u Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m Char
noneOf String
"-+"
extMod :: ParsecT
Text
u
Identity
(([Extension], [Extension]) -> ([Extension], [Extension]))
extMod = do
Char
polarity <- String -> ParsecT Text u Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m Char
oneOf String
"-+"
String
name <- ParsecT Text u Identity Char -> ParsecT Text u Identity String
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m [a]
many (ParsecT Text u Identity Char -> ParsecT Text u Identity String)
-> ParsecT Text u Identity Char -> ParsecT Text u Identity String
forall a b. (a -> b) -> a -> b
$ String -> ParsecT Text u Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m Char
noneOf String
"-+"
Extension
ext <- case String -> Maybe Extension
forall a. Read a => String -> Maybe a
readMay (String
"Ext_" String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
name) of
Just Extension
n -> Extension -> ParsecT Text u Identity Extension
forall (m :: * -> *) a. Monad m => a -> m a
return Extension
n
Maybe Extension
Nothing
| String
name String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== String
"lhs" -> Extension -> ParsecT Text u Identity Extension
forall (m :: * -> *) a. Monad m => a -> m a
return Extension
Ext_literate_haskell
| Bool
otherwise -> String -> ParsecT Text u Identity Extension
forall (m :: * -> *) a. MonadFail m => String -> m a
Prelude.fail (String -> ParsecT Text u Identity Extension)
-> String -> ParsecT Text u Identity Extension
forall a b. (a -> b) -> a -> b
$
String
"Unknown extension: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
name
(([Extension], [Extension]) -> ([Extension], [Extension]))
-> ParsecT
Text
u
Identity
(([Extension], [Extension]) -> ([Extension], [Extension]))
forall (m :: * -> *) a. Monad m => a -> m a
return ((([Extension], [Extension]) -> ([Extension], [Extension]))
-> ParsecT
Text
u
Identity
(([Extension], [Extension]) -> ([Extension], [Extension])))
-> (([Extension], [Extension]) -> ([Extension], [Extension]))
-> ParsecT
Text
u
Identity
(([Extension], [Extension]) -> ([Extension], [Extension]))
forall a b. (a -> b) -> a -> b
$ \([Extension]
extsToEnable, [Extension]
extsToDisable) ->
case Char
polarity of
Char
'+' -> (Extension
ext Extension -> [Extension] -> [Extension]
forall a. a -> [a] -> [a]
: [Extension]
extsToEnable, [Extension]
extsToDisable)
Char
_ -> ([Extension]
extsToEnable, Extension
ext Extension -> [Extension] -> [Extension]
forall a. a -> [a] -> [a]
: [Extension]
extsToDisable)
$(deriveJSON defaultOptions ''Extension)
$(deriveJSON defaultOptions ''Extensions)