@@ -45,6 +45,8 @@ module Text.Pandoc.Options ( module Text.Pandoc.Extensions
46 , isEnabled
46 , isEnabled
48+import Data.Aeson (ToJSON(..), FromJSON(..),
49+ genericToEncoding, defaultOptions)
48import Data.Data (Data)
50import Data.Data (Data)
49import Data.Default
51import Data.Default
50import qualified Data.Set as Set
52import qualified Data.Set as Set
@@ -104,17 +106,29 @@ data HTMLMathMethod = PlainMath
104 | KaTeX String String -- url of stylesheet and katex.js
106 | KaTeX String String -- url of stylesheet and katex.js
105 deriving (Show, Read, Eq, Data, Typeable, Generic)
107 deriving (Show, Read, Eq, Data, Typeable, Generic)
109+instance ToJSON HTMLMathMethod where
110+ toEncoding = genericToEncoding defaultOptions
111+instance FromJSON HTMLMathMethod
107data CiteMethod = Citeproc -- use citeproc to render them
113data CiteMethod = Citeproc -- use citeproc to render them
108 | Natbib -- output natbib cite commands
114 | Natbib -- output natbib cite commands
109 | Biblatex -- output biblatex cite commands
115 | Biblatex -- output biblatex cite commands
110 deriving (Show, Read, Eq, Data, Typeable, Generic)
116 deriving (Show, Read, Eq, Data, Typeable, Generic)
118+instance ToJSON CiteMethod where
119+ toEncoding = genericToEncoding defaultOptions
120+instance FromJSON CiteMethod
112-- | Methods for obfuscating email addresses in HTML.
122-- | Methods for obfuscating email addresses in HTML.
113data ObfuscationMethod = NoObfuscation
123data ObfuscationMethod = NoObfuscation
114 | ReferenceObfuscation
124 | ReferenceObfuscation
115 | JavascriptObfuscation
125 | JavascriptObfuscation
116 deriving (Show, Read, Eq, Data, Typeable, Generic)
126 deriving (Show, Read, Eq, Data, Typeable, Generic)
128+instance ToJSON ObfuscationMethod where
129+ toEncoding = genericToEncoding defaultOptions
130+instance FromJSON ObfuscationMethod
118-- | Varieties of HTML slide shows.
132-- | Varieties of HTML slide shows.
119data HTMLSlideVariant = S5Slides
133data HTMLSlideVariant = S5Slides
120 | SlidySlides
134 | SlidySlides
@@ -124,18 +138,30 @@ data HTMLSlideVariant = S5Slides
124 | NoSlides
138 | NoSlides
125 deriving (Show, Read, Eq, Data, Typeable, Generic)
139 deriving (Show, Read, Eq, Data, Typeable, Generic)
141+instance ToJSON HTMLSlideVariant where
142+ toEncoding = genericToEncoding defaultOptions
143+instance FromJSON HTMLSlideVariant
127-- | Options for accepting or rejecting MS Word track-changes.
145-- | Options for accepting or rejecting MS Word track-changes.
128data TrackChanges = AcceptChanges
146data TrackChanges = AcceptChanges
129 | RejectChanges
147 | RejectChanges
130 | AllChanges
148 | AllChanges
131 deriving (Show, Read, Eq, Data, Typeable, Generic)
149 deriving (Show, Read, Eq, Data, Typeable, Generic)
151+instance ToJSON TrackChanges where
152+ toEncoding = genericToEncoding defaultOptions
153+instance FromJSON TrackChanges
133-- | Options for wrapping text in the output.
155-- | Options for wrapping text in the output.
134data WrapOption = WrapAuto -- ^ Automatically wrap to width
156data WrapOption = WrapAuto -- ^ Automatically wrap to width
135 | WrapNone -- ^ No non-semantic newlines
157 | WrapNone -- ^ No non-semantic newlines
136 | WrapPreserve -- ^ Preserve wrapping of input source
158 | WrapPreserve -- ^ Preserve wrapping of input source
137 deriving (Show, Read, Eq, Data, Typeable, Generic)
159 deriving (Show, Read, Eq, Data, Typeable, Generic)
161+instance ToJSON WrapOption where
162+ toEncoding = genericToEncoding defaultOptions
163+instance FromJSON WrapOption
139-- | Options defining the type of top-level headers.
165-- | Options defining the type of top-level headers.
140data TopLevelDivision = TopLevelPart -- ^ Top-level headers become parts
166data TopLevelDivision = TopLevelPart -- ^ Top-level headers become parts
141 | TopLevelChapter -- ^ Top-level headers become chapters
167 | TopLevelChapter -- ^ Top-level headers become chapters
@@ -144,12 +170,20 @@ data TopLevelDivision = TopLevelPart -- ^ Top-level headers become parts
144 -- heuristics
170 -- heuristics
145 deriving (Show, Read, Eq, Data, Typeable, Generic)
171 deriving (Show, Read, Eq, Data, Typeable, Generic)
173+instance ToJSON TopLevelDivision where
174+ toEncoding = genericToEncoding defaultOptions
175+instance FromJSON TopLevelDivision
147-- | Locations for footnotes and references in markdown output
177-- | Locations for footnotes and references in markdown output
148data ReferenceLocation = EndOfBlock -- ^ End of block
178data ReferenceLocation = EndOfBlock -- ^ End of block
149 | EndOfSection -- ^ prior to next section header (or end of document)
179 | EndOfSection -- ^ prior to next section header (or end of document)
150 | EndOfDocument -- ^ at end of document
180 | EndOfDocument -- ^ at end of document
151 deriving (Show, Read, Eq, Data, Typeable, Generic)
181 deriving (Show, Read, Eq, Data, Typeable, Generic)
183+instance ToJSON ReferenceLocation where
184+ toEncoding = genericToEncoding defaultOptions
185+instance FromJSON ReferenceLocation
153-- | Options for writers
187-- | Options for writers
154data WriterOptions = WriterOptions
188data WriterOptions = WriterOptions
155 { writerTemplate :: Maybe String -- ^ Template to use
189 { writerTemplate :: Maybe String -- ^ Template to use