aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Citeproc/Locator.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2021-10-21 22:27:07 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2021-10-21 22:27:07 -0700
commitee34252219cca23fd180e4602318ca264f8efa06 (patch)
treed0d49b211805cf0e5ec6a8a79023b87fd5dfd608 /src/Text/Pandoc/Citeproc/Locator.hs
parentef7b769fa07e2cbf4e9b8004484828628f548409 (diff)
downloadpandoc-ee34252219cca23fd180e4602318ca264f8efa06.tar.gz
Move splitStrWhen to T.P.Citeproc.Util.
Previously there were two copies, in BibTeX and Locator.
Diffstat (limited to 'src/Text/Pandoc/Citeproc/Locator.hs')
-rw-r--r--src/Text/Pandoc/Citeproc/Locator.hs13
1 files changed, 1 insertions, 12 deletions
diff --git a/src/Text/Pandoc/Citeproc/Locator.hs b/src/Text/Pandoc/Citeproc/Locator.hs
index f8931d7b5..ce606197b 100644
--- a/src/Text/Pandoc/Citeproc/Locator.hs
+++ b/src/Text/Pandoc/Citeproc/Locator.hs
@@ -5,6 +5,7 @@ module Text.Pandoc.Citeproc.Locator
( parseLocator )
where
import Citeproc.Types
+import Text.Pandoc.Citeproc.Util (splitStrWhen)
import Data.Text (Text)
import qualified Data.Text as T
import Data.List (foldl')
@@ -247,18 +248,6 @@ isLocatorSep ',' = True
isLocatorSep ';' = True
isLocatorSep _ = False
-splitStrWhen :: (Char -> Bool) -> [Inline] -> [Inline]
-splitStrWhen _ [] = []
-splitStrWhen p (Str xs : ys) = go (T.unpack xs) ++ splitStrWhen p ys
- where
- go [] = []
- go s = case break p s of
- ([],[]) -> []
- (zs,[]) -> [Str $ T.pack zs]
- ([],w:ws) -> Str (T.singleton w) : go ws
- (zs,w:ws) -> Str (T.pack zs) : Str (T.singleton w) : go ws
-splitStrWhen p (x : ys) = x : splitStrWhen p ys
-
--
-- Locator Map
--