git.iko.soy/typeable/pandoc
on master help sign in
Renamed processIn -> processWith, queryIn -> queryWith.

git-svn-id: https://pandoc.googlecode.com/svn/trunk@1521 788f1e2b-df1e-0410-8736-df70ead52e1b

commit720e9ce3a5c822dc800adc862c20f098ab602902 authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> dateSat 24 Jan 2009, 19:58 (18 years ago) parent066e1cf
4 files changed+18−18
README+4−4 Text/Pandoc/Definition.hs+11−11 Text/Pandoc/Plugins.hs+2−2 plugins/CapitalizeEmphasisPlugin.hs+1−1
README+4−4
@@ -1242,7 +1242,7 @@ import Text.Pandoc
12421242import Data.Char (toUpper)
12431243
12441244transform :: [Inline] -> [Inline]
1245−transform (Emph xs : ys) = processIn capStr xs ++ transform ys
1245+transform (Emph xs : ys) = processWith capStr xs ++ transform ys
12461246transform (x : ys) = x : transform ys
12471247transform [] = []
12481248
@@ -1255,19 +1255,19 @@ Here `transform` converts a whole list of `Inline` elements to another
12551255such list. The key clause is
12561256
12571257~~~ {.haskell}
1258−transform (Emph xs : ys) = processIn capStr xs ++ transform ys
1258+transform (Emph xs : ys) = processWith capStr xs ++ transform ys
12591259~~~
12601260
12611261This applies the `capStr` function recursively to all inlines in the
12621262list of emphasized inlines and puts the transformed list in place
12631263of the original. `capStr` is a simple `Inline` transformation that
12641264capitalizes `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
12661266`Data.Generics` magic to apply its argument (here `capStr`) to every
12671267`Inline` element in a list, including elements that are deeply buried in
12681268other elements. Thus
12691269
1270− processIn captStr [Str "one", Strong [Str "two", Space]] ==>
1270+ processWith captStr [Str "one", Strong [Str "two", Space]] ==>
12711271 [Str "ONE", Strong [Str "TWO", Space]]
12721272
12731273There are other sample plugins in the `plugins` subdirectory of the
Text/Pandoc/Definition.hs+11−11
@@ -129,22 +129,22 @@ data Inline
129129 deriving (Show, Eq, Read, Typeable, Data)
130130
131131-- | Applies a transformation on @a@s to matching elements in a @b@.
132−processIn :: (Data a, Data b) => (a -> a) -> b -> b
133−processIn f = everywhere (mkT f)
132+processWith :: (Data a, Data b) => (a -> a) -> b -> b
133+processWith f = everywhere (mkT f)
134134
135−-- | Like 'processIn', but with monadic transformations.
136−processInM :: (Monad m, Data a, Data b) => (a -> m a) -> b -> m b
137−processInM f = everywhereM (mkM f)
135+-- | Like 'processWith', but with monadic transformations.
136+processWithM :: (Monad m, Data a, Data b) => (a -> m a) -> b -> m b
137+processWithM f = everywhereM (mkM f)
138138
139139-- | Runs a query on matching @a@ elements in a @c@.
140−queryIn :: (Data a, Data c) => (a -> [b]) -> c -> [b]
141−queryIn f = everything (++) ([] `mkQ` f)
140+queryWith :: (Data a, Data c) => (a -> [b]) -> c -> [b]
141+queryWith f = everything (++) ([] `mkQ` f)
142142
143−{-# DEPRECATED processPandoc "Use processIn instead" #-}
143+{-# DEPRECATED processPandoc "Use processWith instead" #-}
144144processPandoc :: Data a => (a -> a) -> Pandoc -> Pandoc
145−processPandoc = processIn
145+processPandoc = processWith
146146
147−{-# DEPRECATED queryPandoc "Use queryIn instead" #-}
147+{-# DEPRECATED queryPandoc "Use queryWith instead" #-}
148148queryPandoc :: Data a => (a -> [b]) -> Pandoc -> [b]
149−queryPandoc = queryIn
149+queryPandoc = queryWith
150150
Text/Pandoc/Plugins.hs+2−2
@@ -65,5 +65,5 @@ evaluatePlugin modsrc = do
6565 throwError $ UnknownError $ "The plugin module must define a function 'transform'."
6666 transformType <- typeOf "transform"
6767 if "-> IO" `isInfixOf` transformType
68− then interpret "processInM transform" (as :: Pandoc -> IO Pandoc)
69− else interpret "return . (processIn transform)" (as :: Pandoc -> IO Pandoc)
68+ then interpret "processWithM 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)
55-- This plugin changes emphasized text into CAPITALIZED TEXT.
66
77transform :: [Inline] -> [Inline]
8−transform (Emph x : ys) = processIn capStr x ++ transform ys
8+transform (Emph x : ys) = processWith capStr x ++ transform ys
99transform (x : ys) = x : transform ys
1010transform [] = []
1111