aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Shared.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2021-02-20 23:01:07 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2021-02-20 23:02:10 -0800
commitd8ef383692a167c97c67114107878a60d0aee6e1 (patch)
tree676072251ba8dd02b41a236a4bc8666586996c73 /src/Text/Pandoc/Shared.hs
parent321343b2cf8a4a75abe1b6713aa40e278ca57997 (diff)
downloadpandoc-d8ef383692a167c97c67114107878a60d0aee6e1.tar.gz
T.P.Shared: remove some obsolete functions [API change].
Removed: - `splitByIndices` - `splitStringByIndicies` - `substitute` - `underlineSpan` None of these are used elsewhere in the code base.
Diffstat (limited to 'src/Text/Pandoc/Shared.hs')
-rw-r--r--src/Text/Pandoc/Shared.hs44
1 files changed, 1 insertions, 43 deletions
diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs
index a579681b1..922df7922 100644
--- a/src/Text/Pandoc/Shared.hs
+++ b/src/Text/Pandoc/Shared.hs
@@ -21,10 +21,7 @@ module Text.Pandoc.Shared (
-- * List processing
splitBy,
splitTextBy,
- splitByIndices,
- splitStringByIndices,
splitTextByIndices,
- substitute,
ordNub,
findM,
-- * Text processing
@@ -74,7 +71,6 @@ module Text.Pandoc.Shared (
addMetaField,
makeMeta,
eastAsianLineBreakFilter,
- underlineSpan,
htmlSpanLikeElements,
splitSentences,
filterIpynbOutput,
@@ -113,7 +109,7 @@ import qualified Data.Bifunctor as Bifunctor
import Data.Char (isAlpha, isLower, isSpace, isUpper, toLower, isAlphaNum,
generalCategory, GeneralCategory(NonSpacingMark,
SpacingCombiningMark, EnclosingMark, ConnectorPunctuation))
-import Data.List (find, intercalate, intersperse, stripPrefix, sortOn)
+import Data.List (find, intercalate, intersperse, sortOn)
import qualified Data.Map as M
import Data.Maybe (mapMaybe, fromMaybe)
import Data.Monoid (Any (..))
@@ -160,27 +156,6 @@ splitTextBy isSep t
| otherwise = let (first, rest) = T.break isSep t
in first : splitTextBy isSep (T.dropWhile isSep rest)
-{-# DEPRECATED splitByIndices "This function is slated for removal" #-}
-splitByIndices :: [Int] -> [a] -> [[a]]
-splitByIndices [] lst = [lst]
-splitByIndices (x:xs) lst = first:splitByIndices (map (\y -> y - x) xs) rest
- where (first, rest) = splitAt x lst
-
-{-# DEPRECATED splitStringByIndices "This function is slated for removal" #-}
--- | Split string into chunks divided at specified indices.
-splitStringByIndices :: [Int] -> [Char] -> [[Char]]
-splitStringByIndices [] lst = [lst]
-splitStringByIndices (x:xs) lst =
- let (first, rest) = splitAt' x lst in
- first : splitStringByIndices (map (\y -> y - x) xs) rest
-
--- DEPRECATED: can be removed when splitStringByIndices is
-splitAt' :: Int -> [Char] -> ([Char],[Char])
-splitAt' _ [] = ([],[])
-splitAt' n xs | n <= 0 = ([],xs)
-splitAt' n (x:xs) = (x:ys,zs)
- where (ys,zs) = splitAt' (n - charWidth x) xs
-
splitTextByIndices :: [Int] -> T.Text -> [T.Text]
splitTextByIndices ns = splitTextByRelIndices (zipWith (-) ns (0:ns))
where
@@ -189,16 +164,6 @@ splitTextByIndices ns = splitTextByRelIndices (zipWith (-) ns (0:ns))
let (first, rest) = T.splitAt x t
in first : splitTextByRelIndices xs rest
-{-# DEPRECATED substitute "This function is slated for removal" #-}
--- | Replace each occurrence of one sublist in a list with another.
-substitute :: (Eq a) => [a] -> [a] -> [a] -> [a]
-substitute _ _ [] = []
-substitute [] _ xs = xs
-substitute target replacement lst@(x:xs) =
- case stripPrefix target lst of
- Just lst' -> replacement ++ substitute target replacement lst'
- Nothing -> x : substitute target replacement xs
-
ordNub :: (Ord a) => [a] -> [a]
ordNub l = go Set.empty l
where
@@ -765,13 +730,6 @@ eastAsianLineBreakFilter = bottomUp go
go xs
= xs
-{-# DEPRECATED underlineSpan "Use Text.Pandoc.Builder.underline instead" #-}
--- | Builder for underline (deprecated).
--- This probably belongs in Builder.hs in pandoc-types.
--- Will be replaced once Underline is an element.
-underlineSpan :: Inlines -> Inlines
-underlineSpan = B.underline
-
-- | Set of HTML elements that are represented as Span with a class equal as
-- the element tag itself.
htmlSpanLikeElements :: Set.Set T.Text