git.iko.soy/typeable/pandoc
on master help sign in
FromJSON/ToJSON instances for Reader, WriterOptions.

Depends on skylighting 0.3.5.

commit64472a468c9edbe118fa31c618a75a0e5522bbec authorJohn MacFarlane <jgm@berkeley.edu> dateThu 14 Sep 2017, 22:38 (9 years ago) parent5849b89
5 files changed+22−4
pandoc.cabal+2−2 src/Text/Pandoc/Extensions.hs+10 src/Text/Pandoc/Options.hs+8 stack.pkg.yaml+1−1 stack.yaml+1−1
pandoc.cabal+2−2
@@ -316,7 +316,7 @@ library
316316 tagsoup >= 0.13.7 && < 0.15,
317317 base64-bytestring >= 0.1 && < 1.1,
318318 zlib >= 0.5 && < 0.7,
319− skylighting >= 0.3.4.1 && < 0.4,
319+ skylighting >= 0.3.5 && < 0.4,
320320 data-default >= 0.4 && < 0.8,
321321 temporary >= 1.1 && < 1.3,
322322 blaze-html >= 0.5 && < 0.10,
@@ -553,7 +553,7 @@ test-suite test-pandoc
553553 filepath >= 1.1 && < 1.5,
554554 hslua >= 0.8 && < 0.9,
555555 process >= 1.2.3 && < 1.7,
556− skylighting >= 0.3.4.1 && < 0.4,
556+ skylighting >= 0.3.5 && < 0.4,
557557 temporary >= 1.1 && < 1.3,
558558 Diff >= 0.2 && < 0.4,
559559 tasty >= 0.11 && < 0.12,
src/Text/Pandoc/Extensions.hs+10
@@ -51,10 +51,16 @@ import Data.Typeable (Typeable)
5151import GHC.Generics (Generic)
5252import Text.Pandoc.Shared (safeRead)
5353import Text.Parsec
54+import Data.Aeson (ToJSON(..), FromJSON(..),
55+ genericToEncoding, defaultOptions)
5456
5557newtype Extensions = Extensions Integer
5658 deriving (Show, Read, Eq, Ord, Data, Typeable, Generic)
5759
60+instance ToJSON Extensions where
61+ toEncoding = genericToEncoding defaultOptions
62+instance FromJSON Extensions
63+
5864instance Monoid Extensions where
5965 mempty = Extensions 0
6066 mappend (Extensions a) (Extensions b) = Extensions (a .|. b)
@@ -148,6 +154,10 @@ data Extension =
148154 | Ext_spaced_reference_links -- ^ Allow space between two parts of ref link
149155 deriving (Show, Read, Enum, Eq, Ord, Bounded, Data, Typeable, Generic)
150156
157+instance ToJSON Extension where
158+ toEncoding = genericToEncoding defaultOptions
159+instance FromJSON Extension
160+
151161-- | Extensions to be used with pandoc-flavored markdown.
152162pandocExtensions :: Extensions
153163pandocExtensions = extensionsFromList
src/Text/Pandoc/Options.hs+8
@@ -68,6 +68,10 @@ data ReaderOptions = ReaderOptions{
6868 , readerTrackChanges :: TrackChanges
6969} deriving (Show, Read, Data, Typeable, Generic)
7070
71+instance ToJSON ReaderOptions where
72+ toEncoding = genericToEncoding defaultOptions
73+instance FromJSON ReaderOptions
74+
7175instance Default ReaderOptions
7276 where def = ReaderOptions{
7377 readerExtensions = emptyExtensions
@@ -221,6 +225,10 @@ data WriterOptions = WriterOptions
221225 , writerSyntaxMap :: SyntaxMap
222226 } deriving (Show, Data, Typeable, Generic)
223227
228+instance ToJSON WriterOptions where
229+ toEncoding = genericToEncoding defaultOptions
230+instance FromJSON WriterOptions
231+
224232instance Default WriterOptions where
225233 def = WriterOptions { writerTemplate = Nothing
226234 , writerVariables = []
stack.pkg.yaml+1−1
@@ -19,7 +19,7 @@ packages:
1919extra-deps:
2020- texmath-0.9.4.2
2121- hslua-0.8.0
22−- skylighting-0.3.4.1
22+- skylighting-0.3.5
2323- cmark-gfm-0.1.1
2424- QuickCheck-2.10.0.1
2525- tasty-quickcheck-0.9.1
stack.yaml+1−1
@@ -9,7 +9,7 @@ packages:
99extra-deps:
1010- texmath-0.9.4.2
1111- hslua-0.8.0
12−- skylighting-0.3.4.1
12+- skylighting-0.3.5
1313- cmark-gfm-0.1.1
1414- QuickCheck-2.10.0.1
1515- tasty-quickcheck-0.9.1