@@ -45,6 +45,8 @@ module Text.Pandoc.Options ( module Text.Pandoc.Extensions
4545 , def
4646 , isEnabled
4747 ) where
48+import Data.Aeson (ToJSON(..), FromJSON(..),
49+ genericToEncoding, defaultOptions)
4850import Data.Data (Data)
4951import Data.Default
5052import qualified Data.Set as Set
@@ -104,17 +106,29 @@ data HTMLMathMethod = PlainMath
104106 | KaTeX String String -- url of stylesheet and katex.js
105107 deriving (Show, Read, Eq, Data, Typeable, Generic)
106108
109+instance ToJSON HTMLMathMethod where
110+ toEncoding = genericToEncoding defaultOptions
111+instance FromJSON HTMLMathMethod
112+
107113data CiteMethod = Citeproc -- use citeproc to render them
108114 | Natbib -- output natbib cite commands
109115 | Biblatex -- output biblatex cite commands
110116 deriving (Show, Read, Eq, Data, Typeable, Generic)
111117
118+instance ToJSON CiteMethod where
119+ toEncoding = genericToEncoding defaultOptions
120+instance FromJSON CiteMethod
121+
112122-- | Methods for obfuscating email addresses in HTML.
113123data ObfuscationMethod = NoObfuscation
114124 | ReferenceObfuscation
115125 | JavascriptObfuscation
116126 deriving (Show, Read, Eq, Data, Typeable, Generic)
117127
128+instance ToJSON ObfuscationMethod where
129+ toEncoding = genericToEncoding defaultOptions
130+instance FromJSON ObfuscationMethod
131+
118132-- | Varieties of HTML slide shows.
119133data HTMLSlideVariant = S5Slides
120134 | SlidySlides
@@ -124,18 +138,30 @@ data HTMLSlideVariant = S5Slides
124138 | NoSlides
125139 deriving (Show, Read, Eq, Data, Typeable, Generic)
126140
141+instance ToJSON HTMLSlideVariant where
142+ toEncoding = genericToEncoding defaultOptions
143+instance FromJSON HTMLSlideVariant
144+
127145-- | Options for accepting or rejecting MS Word track-changes.
128146data TrackChanges = AcceptChanges
129147 | RejectChanges
130148 | AllChanges
131149 deriving (Show, Read, Eq, Data, Typeable, Generic)
132150
151+instance ToJSON TrackChanges where
152+ toEncoding = genericToEncoding defaultOptions
153+instance FromJSON TrackChanges
154+
133155-- | Options for wrapping text in the output.
134156data WrapOption = WrapAuto -- ^ Automatically wrap to width
135157 | WrapNone -- ^ No non-semantic newlines
136158 | WrapPreserve -- ^ Preserve wrapping of input source
137159 deriving (Show, Read, Eq, Data, Typeable, Generic)
138160
161+instance ToJSON WrapOption where
162+ toEncoding = genericToEncoding defaultOptions
163+instance FromJSON WrapOption
164+
139165-- | Options defining the type of top-level headers.
140166data TopLevelDivision = TopLevelPart -- ^ Top-level headers become parts
141167 | TopLevelChapter -- ^ Top-level headers become chapters
@@ -144,12 +170,20 @@ data TopLevelDivision = TopLevelPart -- ^ Top-level headers become parts
144170 -- heuristics
145171 deriving (Show, Read, Eq, Data, Typeable, Generic)
146172
173+instance ToJSON TopLevelDivision where
174+ toEncoding = genericToEncoding defaultOptions
175+instance FromJSON TopLevelDivision
176+
147177-- | Locations for footnotes and references in markdown output
148178data ReferenceLocation = EndOfBlock -- ^ End of block
149179 | EndOfSection -- ^ prior to next section header (or end of document)
150180 | EndOfDocument -- ^ at end of document
151181 deriving (Show, Read, Eq, Data, Typeable, Generic)
152182
183+instance ToJSON ReferenceLocation where
184+ toEncoding = genericToEncoding defaultOptions
185+instance FromJSON ReferenceLocation
186+
153187-- | Options for writers
154188data WriterOptions = WriterOptions
155189 { writerTemplate :: Maybe String -- ^ Template to use