FromJSON/ToJSON instances for Reader, WriterOptions.
Depends on skylighting 0.3.5.
This commit is contained in:
parent
5849b89e52
commit
64472a468c
5 changed files with 22 additions and 4 deletions
|
@ -316,7 +316,7 @@ library
|
|||
tagsoup >= 0.13.7 && < 0.15,
|
||||
base64-bytestring >= 0.1 && < 1.1,
|
||||
zlib >= 0.5 && < 0.7,
|
||||
skylighting >= 0.3.4.1 && < 0.4,
|
||||
skylighting >= 0.3.5 && < 0.4,
|
||||
data-default >= 0.4 && < 0.8,
|
||||
temporary >= 1.1 && < 1.3,
|
||||
blaze-html >= 0.5 && < 0.10,
|
||||
|
@ -553,7 +553,7 @@ test-suite test-pandoc
|
|||
filepath >= 1.1 && < 1.5,
|
||||
hslua >= 0.8 && < 0.9,
|
||||
process >= 1.2.3 && < 1.7,
|
||||
skylighting >= 0.3.4.1 && < 0.4,
|
||||
skylighting >= 0.3.5 && < 0.4,
|
||||
temporary >= 1.1 && < 1.3,
|
||||
Diff >= 0.2 && < 0.4,
|
||||
tasty >= 0.11 && < 0.12,
|
||||
|
|
|
@ -51,10 +51,16 @@ import Data.Typeable (Typeable)
|
|||
import GHC.Generics (Generic)
|
||||
import Text.Pandoc.Shared (safeRead)
|
||||
import Text.Parsec
|
||||
import Data.Aeson (ToJSON(..), FromJSON(..),
|
||||
genericToEncoding, defaultOptions)
|
||||
|
||||
newtype Extensions = Extensions Integer
|
||||
deriving (Show, Read, Eq, Ord, Data, Typeable, Generic)
|
||||
|
||||
instance ToJSON Extensions where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
instance FromJSON Extensions
|
||||
|
||||
instance Monoid Extensions where
|
||||
mempty = Extensions 0
|
||||
mappend (Extensions a) (Extensions b) = Extensions (a .|. b)
|
||||
|
@ -148,6 +154,10 @@ data Extension =
|
|||
| Ext_spaced_reference_links -- ^ Allow space between two parts of ref link
|
||||
deriving (Show, Read, Enum, Eq, Ord, Bounded, Data, Typeable, Generic)
|
||||
|
||||
instance ToJSON Extension where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
instance FromJSON Extension
|
||||
|
||||
-- | Extensions to be used with pandoc-flavored markdown.
|
||||
pandocExtensions :: Extensions
|
||||
pandocExtensions = extensionsFromList
|
||||
|
|
|
@ -68,6 +68,10 @@ data ReaderOptions = ReaderOptions{
|
|||
, readerTrackChanges :: TrackChanges
|
||||
} deriving (Show, Read, Data, Typeable, Generic)
|
||||
|
||||
instance ToJSON ReaderOptions where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
instance FromJSON ReaderOptions
|
||||
|
||||
instance Default ReaderOptions
|
||||
where def = ReaderOptions{
|
||||
readerExtensions = emptyExtensions
|
||||
|
@ -221,6 +225,10 @@ data WriterOptions = WriterOptions
|
|||
, writerSyntaxMap :: SyntaxMap
|
||||
} deriving (Show, Data, Typeable, Generic)
|
||||
|
||||
instance ToJSON WriterOptions where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
instance FromJSON WriterOptions
|
||||
|
||||
instance Default WriterOptions where
|
||||
def = WriterOptions { writerTemplate = Nothing
|
||||
, writerVariables = []
|
||||
|
|
|
@ -19,7 +19,7 @@ packages:
|
|||
extra-deps:
|
||||
- texmath-0.9.4.2
|
||||
- hslua-0.8.0
|
||||
- skylighting-0.3.4.1
|
||||
- skylighting-0.3.5
|
||||
- cmark-gfm-0.1.1
|
||||
- QuickCheck-2.10.0.1
|
||||
- tasty-quickcheck-0.9.1
|
||||
|
|
|
@ -9,7 +9,7 @@ packages:
|
|||
extra-deps:
|
||||
- texmath-0.9.4.2
|
||||
- hslua-0.8.0
|
||||
- skylighting-0.3.4.1
|
||||
- skylighting-0.3.5
|
||||
- cmark-gfm-0.1.1
|
||||
- QuickCheck-2.10.0.1
|
||||
- tasty-quickcheck-0.9.1
|
||||
|
|
Loading…
Reference in a new issue