aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2020-11-16 22:36:10 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2020-11-16 22:36:10 -0800
commitc9ada73caca108b912d4c1289cffc9a7fcd66ce0 (patch)
tree1ae6ff8611c2fb90829e8305e81caa5849262ff5 /src/Text/Pandoc/Readers
parent57102d6ac46e3d8caf4755e46e830a10f1d7517c (diff)
downloadpandoc-c9ada73caca108b912d4c1289cffc9a7fcd66ce0.tar.gz
Move getNextNumber from Readers.LaTeX to Readers.LaTeX.Parsing.
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r--src/Text/Pandoc/Readers/LaTeX.hs26
-rw-r--r--src/Text/Pandoc/Readers/LaTeX/Parsing.hs26
2 files changed, 26 insertions, 26 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs
index 38e2435e3..61c9abe3a 100644
--- a/src/Text/Pandoc/Readers/LaTeX.hs
+++ b/src/Text/Pandoc/Readers/LaTeX.hs
@@ -1923,32 +1923,6 @@ addImageCaption = walkM go
return $ Image attr' alt' (src, tit')
go x = return x
-getNextNumber :: Monad m
- => (LaTeXState -> DottedNum) -> LP m DottedNum
-getNextNumber getCurrentNum = do
- st <- getState
- let chapnum =
- case sLastHeaderNum st of
- DottedNum (n:_) | sHasChapters st -> Just n
- _ -> Nothing
- return . DottedNum $
- case getCurrentNum st of
- DottedNum [m,n] ->
- case chapnum of
- Just m' | m' == m -> [m, n+1]
- | otherwise -> [m', 1]
- Nothing -> [1]
- -- shouldn't happen
- DottedNum [n] ->
- case chapnum of
- Just m -> [m, 1]
- Nothing -> [n + 1]
- _ ->
- case chapnum of
- Just n -> [n, 1]
- Nothing -> [1]
-
-
coloredBlock :: PandocMonad m => Text -> LP m Blocks
coloredBlock stylename = try $ do
skipopts
diff --git a/src/Text/Pandoc/Readers/LaTeX/Parsing.hs b/src/Text/Pandoc/Readers/LaTeX/Parsing.hs
index 09f332bb8..563d32883 100644
--- a/src/Text/Pandoc/Readers/LaTeX/Parsing.hs
+++ b/src/Text/Pandoc/Readers/LaTeX/Parsing.hs
@@ -77,6 +77,7 @@ module Text.Pandoc.Readers.LaTeX.Parsing
, skipopts
, rawopt
, overlaySpecification
+ , getNextNumber
) where
import Control.Applicative (many, (<|>))
@@ -848,3 +849,28 @@ isFontSizeCommand "huge" = True
isFontSizeCommand "Huge" = True
isFontSizeCommand _ = False
+getNextNumber :: Monad m
+ => (LaTeXState -> DottedNum) -> LP m DottedNum
+getNextNumber getCurrentNum = do
+ st <- getState
+ let chapnum =
+ case sLastHeaderNum st of
+ DottedNum (n:_) | sHasChapters st -> Just n
+ _ -> Nothing
+ return . DottedNum $
+ case getCurrentNum st of
+ DottedNum [m,n] ->
+ case chapnum of
+ Just m' | m' == m -> [m, n+1]
+ | otherwise -> [m', 1]
+ Nothing -> [1]
+ -- shouldn't happen
+ DottedNum [n] ->
+ case chapnum of
+ Just m -> [m, 1]
+ Nothing -> [n + 1]
+ _ ->
+ case chapnum of
+ Just n -> [n, 1]
+ Nothing -> [1]
+