aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2013-02-20 09:59:31 -0800
committerJohn MacFarlane <fiddlosopher@gmail.com>2013-02-20 09:59:31 -0800
commit3f2dd98f455a5a46e8872389650929f5eebe42ee (patch)
tree10ba20933c8fea7abddfc62b53935c736b2eafce /src
parent5aaead0afa837499270aede50465beb1206477ad (diff)
downloadpandoc-3f2dd98f455a5a46e8872389650929f5eebe42ee.tar.gz
LaTeX reader: Parse `\section*`, etc. as unnumbered sections.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Readers/LaTeX.hs30
1 files changed, 19 insertions, 11 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs
index 9032ba342..6b7fe1829 100644
--- a/src/Text/Pandoc/Readers/LaTeX.hs
+++ b/src/Text/Pandoc/Readers/LaTeX.hs
@@ -256,15 +256,23 @@ blockCommands = M.fromList $
, ("signature", mempty <$ (skipopts *> authors))
, ("date", mempty <$ (skipopts *> tok >>= addDate))
-- sectioning
- , ("chapter", updateState (\s -> s{ stateHasChapters = True }) *> section 0)
- , ("section", section 1)
- , ("subsection", section 2)
- , ("subsubsection", section 3)
- , ("paragraph", section 4)
- , ("subparagraph", section 5)
+ , ("chapter", updateState (\s -> s{ stateHasChapters = True })
+ *> section nullAttr 0)
+ , ("chapter*", updateState (\s -> s{ stateHasChapters = True })
+ *> section ("",["unnumbered"],[]) 0)
+ , ("section", section nullAttr 1)
+ , ("section*", section ("",["unnumbered"],[]) 1)
+ , ("subsection", section nullAttr 2)
+ , ("subsection*", section ("",["unnumbered"],[]) 2)
+ , ("subsubsection", section nullAttr 3)
+ , ("subsubsection*", section ("",["unnumbered"],[]) 3)
+ , ("paragraph", section nullAttr 4)
+ , ("paragraph*", section ("",["unnumbered"],[]) 4)
+ , ("subparagraph", section nullAttr 5)
+ , ("subparagraph*", section ("",["unnumbered"],[]) 5)
-- beamer slides
- , ("frametitle", section 3)
- , ("framesubtitle", section 4)
+ , ("frametitle", section nullAttr 3)
+ , ("framesubtitle", section nullAttr 4)
-- letters
, ("opening", (para . trimInlines) <$> (skipopts *> tok))
, ("closing", skipopts *> closing)
@@ -313,13 +321,13 @@ authors = try $ do
addDate :: Inlines -> LP ()
addDate dat = updateState (\s -> s{ stateDate = toList dat })
-section :: Int -> LP Blocks
-section lvl = do
+section :: Attr -> Int -> LP Blocks
+section attr lvl = do
hasChapters <- stateHasChapters `fmap` getState
let lvl' = if hasChapters then lvl + 1 else lvl
skipopts
contents <- grouped inline
- return $ header lvl' contents
+ return $ headerWith attr lvl' contents
inlineCommand :: LP Inlines
inlineCommand = try $ do