diff options
author | John MacFarlane <fiddlosopher@gmail.com> | 2012-10-29 22:45:52 -0700 |
---|---|---|
committer | John MacFarlane <fiddlosopher@gmail.com> | 2013-01-09 09:30:05 -0800 |
commit | d599c4cdabd0d71fd9d27161c949b5e1e692436d (patch) | |
tree | 96b6130be929282f85d0261bbb0e0ef37e4e43ff /src/Text/Pandoc/Slides.hs | |
parent | 7a40fa8c08996cb94e7ff3cfafd8ede84972ce70 (diff) | |
download | pandoc-d599c4cdabd0d71fd9d27161c949b5e1e692436d.tar.gz |
Added Attr field to Header.
Previously header ids were autogenerated by the writers.
Now they are generated (unless supplied explicitly) in the
markdown parser, if the `header_identifiers` extension is
selected.
In addition, the textile reader now supports id attributes on
headers.
Diffstat (limited to 'src/Text/Pandoc/Slides.hs')
-rw-r--r-- | src/Text/Pandoc/Slides.hs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/Text/Pandoc/Slides.hs b/src/Text/Pandoc/Slides.hs index fe9b60720..b69057b7a 100644 --- a/src/Text/Pandoc/Slides.hs +++ b/src/Text/Pandoc/Slides.hs @@ -35,24 +35,24 @@ import Text.Pandoc.Definition -- level that occurs before a non-header/non-hrule in the blocks). getSlideLevel :: [Block] -> Int getSlideLevel = go 6 - where go least (Header n _ : x : xs) + where go least (Header n _ _ : x : xs) | n < least && nonHOrHR x = go n xs | otherwise = go least (x:xs) go least (_ : xs) = go least xs go least [] = least - nonHOrHR (Header _ _) = False + nonHOrHR (Header _ _ _) = False nonHOrHR (HorizontalRule) = False nonHOrHR _ = True -- | Prepare a block list to be passed to hierarchicalize. prepSlides :: Int -> [Block] -> [Block] prepSlides slideLevel = ensureStartWithH . splitHrule - where splitHrule (HorizontalRule : Header n xs : ys) - | n == slideLevel = Header slideLevel xs : splitHrule ys - splitHrule (HorizontalRule : xs) = Header slideLevel [Str "\0"] : + 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 [] = [] - ensureStartWithH bs@(Header n _:_) + ensureStartWithH bs@(Header n _ _:_) | n <= slideLevel = bs - ensureStartWithH bs = Header slideLevel [Str "\0"] : bs + ensureStartWithH bs = Header slideLevel nullAttr [Str "\0"] : bs |