git.iko.soy/typeable/pandoc
on master help sign in
LaTeX reader: fix double `unnumbered` class.
58dcdb0John MacFarlane
src/Text/Pandoc/Readers/LaTeX.hs+20−21
@@ -2281,17 +2281,16 @@ looseItem = do
2281resetCaption :: PandocMonad m => LP m ()
2281resetCaption :: PandocMonad m => LP m ()
2282resetCaption = updateState $ \st -> st{ sCaption = (Nothing, Nothing) }
2282resetCaption = updateState $ \st -> st{ sCaption = (Nothing, Nothing) }
2283
2283
2284−section :: PandocMonad m => Bool -> Attr -> Int -> LP m Blocks
2284+section :: PandocMonad m => Attr -> Int -> LP m Blocks
2285−section starred (ident, classes, kvs) lvl = do
2285+section (ident, classes, kvs) lvl = do
2286 skipopts
2286 skipopts
2287 contents <- grouped inline
2287 contents <- grouped inline
2288 lab <- option ident $
2288 lab <- option ident $
2289 try (spaces >> controlSeq "label"
2289 try (spaces >> controlSeq "label"
2290 >> spaces >> toksToString <$> braced)
2290 >> spaces >> toksToString <$> braced)
2291− let classes' = if starred then "unnumbered" : classes else classes
2292 when (lvl == 0) $
2291 when (lvl == 0) $
2293 updateState $ \st -> st{ sHasChapters = True }
2292 updateState $ \st -> st{ sHasChapters = True }
2294− unless starred $ do
2293+ unless ("unnumbered" `elem` classes) $ do
2295 hn <- sLastHeaderNum <$> getState
2294 hn <- sLastHeaderNum <$> getState
2296 hasChapters <- sHasChapters <$> getState
2295 hasChapters <- sHasChapters <$> getState
2297 let lvl' = lvl + if hasChapters then 1 else 0
2296 let lvl' = lvl + if hasChapters then 1 else 0
@@ -2300,7 +2299,7 @@ section starred (ident, classes, kvs) lvl = do
2300 updateState $ \st -> st{ sLabels = M.insert lab
2299 updateState $ \st -> st{ sLabels = M.insert lab
2301 [Str (renderHeaderNum num)]
2300 [Str (renderHeaderNum num)]
2302 (sLabels st) }
2301 (sLabels st) }
2303− attr' <- registerHeader (lab, classes', kvs) contents
2302+ attr' <- registerHeader (lab, classes, kvs) contents
2304 return $ headerWith attr' lvl contents
2303 return $ headerWith attr' lvl contents
2305
2304
2306blockCommand :: PandocMonad m => LP m Blocks
2305blockCommand :: PandocMonad m => LP m Blocks
@@ -2361,23 +2360,23 @@ blockCommands = M.fromList
2361 -- Koma-script metadata commands
2360 -- Koma-script metadata commands
2362 , ("dedication", mempty <$ (skipopts *> tok >>= addMeta "dedication"))
2361 , ("dedication", mempty <$ (skipopts *> tok >>= addMeta "dedication"))
2363 -- sectioning
2362 -- sectioning
2364− , ("part", section False nullAttr (-1))
2363+ , ("part", section nullAttr (-1))
2365− , ("part*", section True nullAttr (-1))
2364+ , ("part*", section nullAttr (-1))
2366− , ("chapter", section False nullAttr 0)
2365+ , ("chapter", section nullAttr 0)
2367− , ("chapter*", section True ("",["unnumbered"],[]) 0)
2366+ , ("chapter*", section ("",["unnumbered"],[]) 0)
2368− , ("section", section False nullAttr 1)
2367+ , ("section", section nullAttr 1)
2369− , ("section*", section True ("",["unnumbered"],[]) 1)
2368+ , ("section*", section ("",["unnumbered"],[]) 1)
2370− , ("subsection", section False nullAttr 2)
2369+ , ("subsection", section nullAttr 2)
2371− , ("subsection*", section True ("",["unnumbered"],[]) 2)
2370+ , ("subsection*", section ("",["unnumbered"],[]) 2)
2372− , ("subsubsection", section False nullAttr 3)
2371+ , ("subsubsection", section nullAttr 3)
2373− , ("subsubsection*", section True ("",["unnumbered"],[]) 3)
2372+ , ("subsubsection*", section ("",["unnumbered"],[]) 3)
2374− , ("paragraph", section False nullAttr 4)
2373+ , ("paragraph", section nullAttr 4)
2375− , ("paragraph*", section True ("",["unnumbered"],[]) 4)
2374+ , ("paragraph*", section ("",["unnumbered"],[]) 4)
2376− , ("subparagraph", section False nullAttr 5)
2375+ , ("subparagraph", section nullAttr 5)
2377− , ("subparagraph*", section True ("",["unnumbered"],[]) 5)
2376+ , ("subparagraph*", section ("",["unnumbered"],[]) 5)
2378 -- beamer slides
2377 -- beamer slides
2379− , ("frametitle", section False nullAttr 3)
2378+ , ("frametitle", section nullAttr 3)
2380− , ("framesubtitle", section False nullAttr 4)
2379+ , ("framesubtitle", section nullAttr 4)
2381 -- letters
2380 -- letters
2382 , ("opening", (para . trimInlines) <$> (skipopts *> tok))
2381 , ("opening", (para . trimInlines) <$> (skipopts *> tok))
2383 , ("closing", skipopts *> closing)
2382 , ("closing", skipopts *> closing)