aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2013-09-18 09:13:37 -0700
committerJohn MacFarlane <fiddlosopher@gmail.com>2013-09-18 09:13:37 -0700
commit464b174d0f17c5a9f38d724523dcaf4e8a6b07fe (patch)
tree812bd314feac17d66e628b49caba0cad4d03447d /src/Text/Pandoc
parent3397af30e42bef5cc86b48216860545f364cf40c (diff)
downloadpandoc-464b174d0f17c5a9f38d724523dcaf4e8a6b07fe.tar.gz
Fixed reference slides.
The Div container around references messed up the procedure for carving a document into slides. So we now remove the surrounding Div in prepSlides.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Slides.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Slides.hs b/src/Text/Pandoc/Slides.hs
index 2bbdb120f..db4aa2509 100644
--- a/src/Text/Pandoc/Slides.hs
+++ b/src/Text/Pandoc/Slides.hs
@@ -46,13 +46,18 @@ getSlideLevel = go 6
-- | Prepare a block list to be passed to hierarchicalize.
prepSlides :: Int -> [Block] -> [Block]
-prepSlides slideLevel = ensureStartWithH . splitHrule
+prepSlides slideLevel = ensureStartWithH . splitHrule . extractRefsHeader
where splitHrule (HorizontalRule : Header n attr xs : ys)
| n == slideLevel = Header slideLevel attr xs : splitHrule ys
splitHrule (HorizontalRule : xs) = Header slideLevel nullAttr [Str "\0"] :
splitHrule xs
splitHrule (x : xs) = x : splitHrule xs
splitHrule [] = []
+ extractRefsHeader bs =
+ case reverse bs of
+ (Div (_,["references"],_) (Header n attrs xs : ys) : zs)
+ -> reverse zs ++ (Header n attrs xs : ys)
+ _ -> bs
ensureStartWithH bs@(Header n _ _:_)
| n <= slideLevel = bs
ensureStartWithH bs = Header slideLevel nullAttr [Str "\0"] : bs