Don't generate empty H1 after hrule slide breaks.
We now use a slide-level header with contents [Str "\0"] to mark an hrule break. This avoids creation of an empty H1 in these contexts. Closes #484.
This commit is contained in:
parent
4cf3aaecde
commit
527be1ddf2
3 changed files with 11 additions and 5 deletions
|
@ -49,9 +49,10 @@ 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 [] : splitHrule xs
|
||||
splitHrule (HorizontalRule : xs) = Header slideLevel [Str "\0"] :
|
||||
splitHrule xs
|
||||
splitHrule (x : xs) = x : splitHrule xs
|
||||
splitHrule [] = []
|
||||
ensureStartWithH bs@(Header n _:_)
|
||||
| n <= slideLevel = bs
|
||||
ensureStartWithH bs = Header slideLevel [] : bs
|
||||
ensureStartWithH bs = Header slideLevel [Str "\0"] : bs
|
||||
|
|
|
@ -262,7 +262,9 @@ elementToHtml slideLevel opts (Sec level num id' title' elements) = do
|
|||
-- always use level 1 for slide titles
|
||||
let level' = if slide then 1 else level
|
||||
let titleSlide = slide && level < slideLevel
|
||||
header' <- blockToHtml opts (Header level' title')
|
||||
header' <- if title' == [Str "\0"] -- marker for hrule
|
||||
then return mempty
|
||||
else blockToHtml opts (Header level' title')
|
||||
let isSec (Sec _ _ _ _ _) = True
|
||||
isSec (Blk _) = False
|
||||
innerContents <- mapM (elementToHtml slideLevel opts)
|
||||
|
|
|
@ -243,8 +243,11 @@ elementToBeamer slideLevel (Sec lvl _num _ident tit elts)
|
|||
let fragile = if not $ null $ queryWith hasCodeBlock elts ++ queryWith hasCode elts
|
||||
then "[fragile]"
|
||||
else ""
|
||||
let slideStart = Para $ RawInline "latex" ("\\begin{frame}" ++ fragile ++
|
||||
"\\frametitle{") : tit ++ [RawInline "latex" "}"]
|
||||
let slideStart = Para $ RawInline "latex" ("\\begin{frame}" ++ fragile) :
|
||||
if tit == [Str "\0"] -- marker for hrule
|
||||
then []
|
||||
else (RawInline "latex" "\\frametitle{") : tit ++
|
||||
[RawInline "latex" "}"]
|
||||
let slideEnd = RawBlock "latex" "\\end{frame}"
|
||||
-- now carve up slide into blocks if there are sections inside
|
||||
bs <- concat `fmap` mapM (elementToBeamer slideLevel) elts
|
||||
|
|
Loading…
Reference in a new issue