git.iko.soy/typeable/pandoc
on master help sign in
Renamed processIn -> processWith, queryIn -> queryWith.
720e9cefiddlosopher
README+4−4
@@ -1242,7 +1242,7 @@ import Text.Pandoc
1242import Data.Char (toUpper)
1242import Data.Char (toUpper)
1243
1243
1244transform :: [Inline] -> [Inline]
1244transform :: [Inline] -> [Inline]
1245−transform (Emph xs : ys) = processIn capStr xs ++ transform ys
1245+transform (Emph xs : ys) = processWith capStr xs ++ transform ys
1246transform (x : ys) = x : transform ys
1246transform (x : ys) = x : transform ys
1247transform [] = []
1247transform [] = []
1248
1248
@@ -1255,19 +1255,19 @@ Here `transform` converts a whole list of `Inline` elements to another
1255such list. The key clause is
1255such list. The key clause is
1256
1256
1257~~~ {.haskell}
1257~~~ {.haskell}
1258−transform (Emph xs : ys) = processIn capStr xs ++ transform ys
1258+transform (Emph xs : ys) = processWith capStr xs ++ transform ys
1259~~~
1259~~~
1260
1260
1261This applies the `capStr` function recursively to all inlines in the
1261This applies the `capStr` function recursively to all inlines in the
1262list of emphasized inlines and puts the transformed list in place
1262list of emphasized inlines and puts the transformed list in place
1263of the original. `capStr` is a simple `Inline` transformation that
1263of the original. `capStr` is a simple `Inline` transformation that
1264capitalizes `Str` elements and leaves everything else alone. The
1264capitalizes `Str` elements and leaves everything else alone. The
1265−function `processIn`, defined in `Text.Pandoc.Definition`, uses some
1265+function `processWith`, defined in `Text.Pandoc.Definition`, uses some
1266`Data.Generics` magic to apply its argument (here `capStr`) to every
1266`Data.Generics` magic to apply its argument (here `capStr`) to every
1267`Inline` element in a list, including elements that are deeply buried in
1267`Inline` element in a list, including elements that are deeply buried in
1268other elements. Thus
1268other elements. Thus
1269
1269
1270− processIn captStr [Str "one", Strong [Str "two", Space]] ==>
1270+ processWith captStr [Str "one", Strong [Str "two", Space]] ==>
1271 [Str "ONE", Strong [Str "TWO", Space]]
1271 [Str "ONE", Strong [Str "TWO", Space]]
1272
1272
1273There are other sample plugins in the `plugins` subdirectory of the
1273There are other sample plugins in the `plugins` subdirectory of the
Text/Pandoc/Definition.hs+11−11
@@ -129,22 +129,22 @@ data Inline
129 deriving (Show, Eq, Read, Typeable, Data)
129 deriving (Show, Eq, Read, Typeable, Data)
130
130
131-- | Applies a transformation on @a@s to matching elements in a @b@.
131-- | Applies a transformation on @a@s to matching elements in a @b@.
132−processIn :: (Data a, Data b) => (a -> a) -> b -> b
132+processWith :: (Data a, Data b) => (a -> a) -> b -> b
133−processIn f = everywhere (mkT f)
133+processWith f = everywhere (mkT f)
134
134
135−-- | Like 'processIn', but with monadic transformations.
135+-- | Like 'processWith', but with monadic transformations.
136−processInM :: (Monad m, Data a, Data b) => (a -> m a) -> b -> m b
136+processWithM :: (Monad m, Data a, Data b) => (a -> m a) -> b -> m b
137−processInM f = everywhereM (mkM f)
137+processWithM f = everywhereM (mkM f)
138
138
139-- | Runs a query on matching @a@ elements in a @c@.
139-- | Runs a query on matching @a@ elements in a @c@.
140−queryIn :: (Data a, Data c) => (a -> [b]) -> c -> [b]
140+queryWith :: (Data a, Data c) => (a -> [b]) -> c -> [b]
141−queryIn f = everything (++) ([] `mkQ` f)
141+queryWith f = everything (++) ([] `mkQ` f)
142
142
143−{-# DEPRECATED processPandoc "Use processIn instead" #-}
143+{-# DEPRECATED processPandoc "Use processWith instead" #-}
144processPandoc :: Data a => (a -> a) -> Pandoc -> Pandoc
144processPandoc :: Data a => (a -> a) -> Pandoc -> Pandoc
145−processPandoc = processIn
145+processPandoc = processWith
146
146
147−{-# DEPRECATED queryPandoc "Use queryIn instead" #-}
147+{-# DEPRECATED queryPandoc "Use queryWith instead" #-}
148queryPandoc :: Data a => (a -> [b]) -> Pandoc -> [b]
148queryPandoc :: Data a => (a -> [b]) -> Pandoc -> [b]
149−queryPandoc = queryIn
149+queryPandoc = queryWith
150
150
Text/Pandoc/Plugins.hs+2−2
@@ -65,5 +65,5 @@ evaluatePlugin modsrc = do
65 throwError $ UnknownError $ "The plugin module must define a function 'transform'."
65 throwError $ UnknownError $ "The plugin module must define a function 'transform'."
66 transformType <- typeOf "transform"
66 transformType <- typeOf "transform"
67 if "-> IO" `isInfixOf` transformType
67 if "-> IO" `isInfixOf` transformType
68− then interpret "processInM transform" (as :: Pandoc -> IO Pandoc)
68+ then interpret "processWithM transform" (as :: Pandoc -> IO Pandoc)
69− else interpret "return . (processIn transform)" (as :: Pandoc -> IO Pandoc)
69+ else interpret "return . (processWith transform)" (as :: Pandoc -> IO Pandoc)
plugins/CapitalizeEmphasisPlugin.hs+1−1
@@ -5,7 +5,7 @@ import Data.Char (toUpper)
5-- This plugin changes emphasized text into CAPITALIZED TEXT.
5-- This plugin changes emphasized text into CAPITALIZED TEXT.
6
6
7transform :: [Inline] -> [Inline]
7transform :: [Inline] -> [Inline]
8−transform (Emph x : ys) = processIn capStr x ++ transform ys
8+transform (Emph x : ys) = processWith capStr x ++ transform ys
9transform (x : ys) = x : transform ys
9transform (x : ys) = x : transform ys
10transform [] = []
10transform [] = []
11
11