git.iko.soy/typeable/pandoc
on master help sign in
T.P.Shared: remove some obsolete functions [API change].

Removed: - `splitByIndices` - `splitStringByIndicies` - `substitute` - `underlineSpan` None of these are used elsewhere in the code base.

commitd8ef383692a167c97c67114107878a60d0aee6e1 authorJohn MacFarlane <jgm@berkeley.edu> dateSat 20 Feb 2021, 23:01 (6 years ago) parent321343b
1 file changed+1−43
src/Text/Pandoc/Shared.hs+1−43
src/Text/Pandoc/Shared.hs+1−43
@@ -21,10 +21,7 @@ module Text.Pandoc.Shared (
2121 -- * List processing
2222 splitBy,
2323 splitTextBy,
24− splitByIndices,
25− splitStringByIndices,
2624 splitTextByIndices,
27− substitute,
2825 ordNub,
2926 findM,
3027 -- * Text processing
@@ -74,7 +71,6 @@ module Text.Pandoc.Shared (
7471 addMetaField,
7572 makeMeta,
7673 eastAsianLineBreakFilter,
77− underlineSpan,
7874 htmlSpanLikeElements,
7975 splitSentences,
8076 filterIpynbOutput,
@@ -113,7 +109,7 @@ import qualified Data.Bifunctor as Bifunctor
113109import Data.Char (isAlpha, isLower, isSpace, isUpper, toLower, isAlphaNum,
114110 generalCategory, GeneralCategory(NonSpacingMark,
115111 SpacingCombiningMark, EnclosingMark, ConnectorPunctuation))
116−import Data.List (find, intercalate, intersperse, stripPrefix, sortOn)
112+import Data.List (find, intercalate, intersperse, sortOn)
117113import qualified Data.Map as M
118114import Data.Maybe (mapMaybe, fromMaybe)
119115import Data.Monoid (Any (..))
@@ -160,27 +156,6 @@ splitTextBy isSep t
160156 | otherwise = let (first, rest) = T.break isSep t
161157 in first : splitTextBy isSep (T.dropWhile isSep rest)
162158
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−
184159splitTextByIndices :: [Int] -> T.Text -> [T.Text]
185160splitTextByIndices ns = splitTextByRelIndices (zipWith (-) ns (0:ns))
186161 where
@@ -189,16 +164,6 @@ splitTextByIndices ns = splitTextByRelIndices (zipWith (-) ns (0:ns))
189164 let (first, rest) = T.splitAt x t
190165 in first : splitTextByRelIndices xs rest
191166
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−
202167ordNub :: (Ord a) => [a] -> [a]
203168ordNub l = go Set.empty l
204169 where
@@ -765,13 +730,6 @@ eastAsianLineBreakFilter = bottomUp go
765730 go xs
766731 = xs
767732
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−
775733-- | Set of HTML elements that are represented as Span with a class equal as
776734-- the element tag itself.
777735htmlSpanLikeElements :: Set.Set T.Text