git.iko.soy/typeable/pandoc
on master help sign in
T.P.Shared: remove some obsolete functions [API change].
d8ef383John MacFarlane
src/Text/Pandoc/Shared.hs+1−43
@@ -21,10 +21,7 @@ module Text.Pandoc.Shared (
21 -- * List processing
21 -- * List processing
22 splitBy,
22 splitBy,
23 splitTextBy,
23 splitTextBy,
24− splitByIndices,
25− splitStringByIndices,
26 splitTextByIndices,
24 splitTextByIndices,
27− substitute,
28 ordNub,
25 ordNub,
29 findM,
26 findM,
30 -- * Text processing
27 -- * Text processing
@@ -74,7 +71,6 @@ module Text.Pandoc.Shared (
74 addMetaField,
71 addMetaField,
75 makeMeta,
72 makeMeta,
76 eastAsianLineBreakFilter,
73 eastAsianLineBreakFilter,
77− underlineSpan,
78 htmlSpanLikeElements,
74 htmlSpanLikeElements,
79 splitSentences,
75 splitSentences,
80 filterIpynbOutput,
76 filterIpynbOutput,
@@ -113,7 +109,7 @@ import qualified Data.Bifunctor as Bifunctor
113import Data.Char (isAlpha, isLower, isSpace, isUpper, toLower, isAlphaNum,
109import Data.Char (isAlpha, isLower, isSpace, isUpper, toLower, isAlphaNum,
114 generalCategory, GeneralCategory(NonSpacingMark,
110 generalCategory, GeneralCategory(NonSpacingMark,
115 SpacingCombiningMark, EnclosingMark, ConnectorPunctuation))
111 SpacingCombiningMark, EnclosingMark, ConnectorPunctuation))
116−import Data.List (find, intercalate, intersperse, stripPrefix, sortOn)
112+import Data.List (find, intercalate, intersperse, sortOn)
117import qualified Data.Map as M
113import qualified Data.Map as M
118import Data.Maybe (mapMaybe, fromMaybe)
114import Data.Maybe (mapMaybe, fromMaybe)
119import Data.Monoid (Any (..))
115import Data.Monoid (Any (..))
@@ -160,27 +156,6 @@ splitTextBy isSep t
160 | otherwise = let (first, rest) = T.break isSep t
156 | otherwise = let (first, rest) = T.break isSep t
161 in first : splitTextBy isSep (T.dropWhile isSep rest)
157 in first : splitTextBy isSep (T.dropWhile isSep rest)
162
158
163−{-# DEPRECATED splitByIndices "This function is slated for removal" #-}
164−splitByIndices :: [Int] -> [a] -> [[a]]
165−splitByIndices [] lst = [lst]
166−splitByIndices (x:xs) lst = first:splitByIndices (map (\y -> y - x) xs) rest
167− where (first, rest) = splitAt x lst
168−
169−{-# DEPRECATED splitStringByIndices "This function is slated for removal" #-}
170−-- | Split string into chunks divided at specified indices.
171−splitStringByIndices :: [Int] -> [Char] -> [[Char]]
172−splitStringByIndices [] lst = [lst]
173−splitStringByIndices (x:xs) lst =
174− let (first, rest) = splitAt' x lst in
175− first : splitStringByIndices (map (\y -> y - x) xs) rest
176−
177−-- DEPRECATED: can be removed when splitStringByIndices is
178−splitAt' :: Int -> [Char] -> ([Char],[Char])
179−splitAt' _ [] = ([],[])
180−splitAt' n xs | n <= 0 = ([],xs)
181−splitAt' n (x:xs) = (x:ys,zs)
182− where (ys,zs) = splitAt' (n - charWidth x) xs
183−
184splitTextByIndices :: [Int] -> T.Text -> [T.Text]
159splitTextByIndices :: [Int] -> T.Text -> [T.Text]
185splitTextByIndices ns = splitTextByRelIndices (zipWith (-) ns (0:ns))
160splitTextByIndices ns = splitTextByRelIndices (zipWith (-) ns (0:ns))
186 where
161 where
@@ -189,16 +164,6 @@ splitTextByIndices ns = splitTextByRelIndices (zipWith (-) ns (0:ns))
189 let (first, rest) = T.splitAt x t
164 let (first, rest) = T.splitAt x t
190 in first : splitTextByRelIndices xs rest
165 in first : splitTextByRelIndices xs rest
191
166
192−{-# DEPRECATED substitute "This function is slated for removal" #-}
193−-- | Replace each occurrence of one sublist in a list with another.
194−substitute :: (Eq a) => [a] -> [a] -> [a] -> [a]
195−substitute _ _ [] = []
196−substitute [] _ xs = xs
197−substitute target replacement lst@(x:xs) =
198− case stripPrefix target lst of
199− Just lst' -> replacement ++ substitute target replacement lst'
200− Nothing -> x : substitute target replacement xs
201−
202ordNub :: (Ord a) => [a] -> [a]
167ordNub :: (Ord a) => [a] -> [a]
203ordNub l = go Set.empty l
168ordNub l = go Set.empty l
204 where
169 where
@@ -765,13 +730,6 @@ eastAsianLineBreakFilter = bottomUp go
765 go xs
730 go xs
766 = xs
731 = xs
767
732
768−{-# DEPRECATED underlineSpan "Use Text.Pandoc.Builder.underline instead" #-}
769−-- | Builder for underline (deprecated).
770−-- This probably belongs in Builder.hs in pandoc-types.
771−-- Will be replaced once Underline is an element.
772−underlineSpan :: Inlines -> Inlines
773−underlineSpan = B.underline
774−
775-- | Set of HTML elements that are represented as Span with a class equal as
733-- | Set of HTML elements that are represented as Span with a class equal as
776-- the element tag itself.
734-- the element tag itself.
777htmlSpanLikeElements :: Set.Set T.Text
735htmlSpanLikeElements :: Set.Set T.Text