diff options
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/Readers/LaTeX.hs | 26 | ||||
-rw-r--r-- | src/Text/Pandoc/Readers/LaTeX/Parsing.hs | 26 |
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] + |