summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2013-09-01 09:13:31 -0700
committerJohn MacFarlane <fiddlosopher@gmail.com>2013-09-01 09:13:31 -0700
commit9282f632786e85c7a31f974f20162214c5387c00 (patch)
tree7389293047cc9b6a43d22ac5ed8364c15de5c109 /src/Text/Pandoc
parent6ed41fdfcc3b57e88cf98b875a75ab5e1629dca6 (diff)
Use registerHeader in RST and LaTeX readers.
This will give automatic unique identifiers, unless `-auto_identifiers` is specified.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Readers/LaTeX.hs6
-rw-r--r--src/Text/Pandoc/Readers/RST.hs6
2 files changed, 7 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs
index e91ea1e82..ff5b73348 100644
--- a/src/Text/Pandoc/Readers/LaTeX.hs
+++ b/src/Text/Pandoc/Readers/LaTeX.hs
@@ -318,9 +318,9 @@ section (ident, classes, kvs) lvl = do
let lvl' = if hasChapters then lvl + 1 else lvl
skipopts
contents <- grouped inline
- lab <- option ident $ try $ spaces >> controlSeq "label" >>
- spaces >> braced
- return $ headerWith (lab, classes, kvs) lvl' contents
+ lab <- option ident $ try (spaces >> controlSeq "label" >> spaces >> braced)
+ attr' <- registerHeader (lab, classes, kvs) contents
+ return $ headerWith attr' lvl' contents
inlineCommand :: LP Inlines
inlineCommand = try $ do
diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs
index df0a8294d..32893128a 100644
--- a/src/Text/Pandoc/Readers/RST.hs
+++ b/src/Text/Pandoc/Readers/RST.hs
@@ -275,7 +275,8 @@ doubleHeader = try $ do
Just ind -> (headerTable, ind + 1)
Nothing -> (headerTable ++ [DoubleHeader c], (length headerTable) + 1)
setState (state { stateHeaderTable = headerTable' })
- return $ B.header level txt
+ attr <- registerHeader nullAttr txt
+ return $ B.headerWith attr level txt
-- a header with line on the bottom only
singleHeader :: RSTParser Blocks
@@ -295,7 +296,8 @@ singleHeader = try $ do
Just ind -> (headerTable, ind + 1)
Nothing -> (headerTable ++ [SingleHeader c], (length headerTable) + 1)
setState (state { stateHeaderTable = headerTable' })
- return $ B.header level txt
+ attr <- registerHeader nullAttr txt
+ return $ B.headerWith attr level txt
--
-- hrule block