aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers/LaTeX
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2020-07-22 23:52:28 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2020-07-22 23:52:28 -0700
commitff0e130560e32d23ead14bca7af821a80acc3318 (patch)
treeff596e8c5cc8b076494a5018341a27d953218728 /src/Text/Pandoc/Readers/LaTeX
parentcdaaaa3f63a18ffdeec87973915d0e68cd1945a8 (diff)
downloadpandoc-ff0e130560e32d23ead14bca7af821a80acc3318.tar.gz
LaTeX reader: SUpport ams `\theoremstyle`.
Diffstat (limited to 'src/Text/Pandoc/Readers/LaTeX')
-rw-r--r--src/Text/Pandoc/Readers/LaTeX/Parsing.hs12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX/Parsing.hs b/src/Text/Pandoc/Readers/LaTeX/Parsing.hs
index 4e8414fef..10e48b45f 100644
--- a/src/Text/Pandoc/Readers/LaTeX/Parsing.hs
+++ b/src/Text/Pandoc/Readers/LaTeX/Parsing.hs
@@ -19,6 +19,7 @@ module Text.Pandoc.Readers.LaTeX.Parsing
, renderDottedNum
, incrementDottedNum
, TheoremSpec(..)
+ , TheoremStyle(..)
, LaTeXState(..)
, defaultLaTeXState
, LP
@@ -103,7 +104,7 @@ import Text.Parsec.Pos
-- import Debug.Trace
newtype DottedNum = DottedNum [Int]
- deriving (Show)
+ deriving (Show, Eq)
renderDottedNum :: DottedNum -> T.Text
renderDottedNum (DottedNum xs) = T.pack $
@@ -115,14 +116,19 @@ incrementDottedNum level (DottedNum ns) = DottedNum $
(x:xs) -> reverse (x+1 : xs)
[] -> [] -- shouldn't happen
+data TheoremStyle =
+ PlainStyle | DefinitionStyle | RemarkStyle
+ deriving (Show, Eq)
+
data TheoremSpec =
TheoremSpec
{ theoremName :: Text
+ , theoremStyle :: TheoremStyle
, theoremSeries :: Maybe Text
, theoremSyncTo :: Maybe Text
, theoremNumber :: Bool
, theoremLastNum :: DottedNum }
- deriving (Show)
+ deriving (Show, Eq)
data LaTeXState = LaTeXState{ sOptions :: ReaderOptions
, sMeta :: Meta
@@ -139,6 +145,7 @@ data LaTeXState = LaTeXState{ sOptions :: ReaderOptions
, sLastFigureNum :: DottedNum
, sLastTableNum :: DottedNum
, sTheoremMap :: M.Map Text TheoremSpec
+ , sLastTheoremStyle :: TheoremStyle
, sLastLabel :: Maybe Text
, sLabels :: M.Map Text [Inline]
, sHasChapters :: Bool
@@ -163,6 +170,7 @@ defaultLaTeXState = LaTeXState{ sOptions = def
, sLastFigureNum = DottedNum []
, sLastTableNum = DottedNum []
, sTheoremMap = M.empty
+ , sLastTheoremStyle = PlainStyle
, sLastLabel = Nothing
, sLabels = M.empty
, sHasChapters = False