@@ -38,11 +38,11 @@ module Text.Pandoc.Filter
3838 ) where
3939
4040import Prelude
41−#ifdef AVOID_TEMPLATE_HASKELL
41+#ifdef DERIVE_JSON_VIA_TH
42+import Data.Aeson.TH (deriveJSON, defaultOptions)
43+#else
4244import Data.Aeson (FromJSON (..), ToJSON (..),
4345 defaultOptions, genericToEncoding)
44−#else
45−import Data.Aeson.TH (deriveJSON, defaultOptions)
4646#endif
4747import Data.Foldable (foldrM)
4848import GHC.Generics (Generic)
@@ -76,10 +76,10 @@ expandFilterPath :: Filter -> PandocIO Filter
7676expandFilterPath (LuaFilter fp) = LuaFilter <$> Path.expandFilterPath fp
7777expandFilterPath (JSONFilter fp) = JSONFilter <$> Path.expandFilterPath fp
7878
79−#ifdef AVOID_TEMPLATE_HASKELL
79+#ifdef DERIVE_JSON_VIA_TH
80+$(deriveJSON defaultOptions ''Filter)
81+#else
8082instance ToJSON Filter where
8183 toEncoding = genericToEncoding defaultOptions
8284instance FromJSON Filter
83−#else
84−$(deriveJSON defaultOptions ''Filter)
8585#endif