Skip to content

Commit

Permalink
Make epub2 footnotes consistent with epub3
Browse files Browse the repository at this point in the history
  • Loading branch information
Porges committed Mar 24, 2018
1 parent c11617c commit 08172db
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/Text/Pandoc/Writers/HTML.hs
Original file line number Diff line number Diff line change
Expand Up @@ -487,12 +487,7 @@ footnoteSection opts notes = do
return $
if null notes
then mempty
else
nl opts >>
container (nl opts >> hrtag >> nl opts >>
-- if HTML5 then we're using <aside> and not <li>
(if html5 then id else H.ol) (mconcat notes >> nl opts)
>> nl opts)
else nl opts >> container (nl opts >> hrtag >> nl opts >> (mconcat notes >> nl opts) >> nl opts)

-- | Parse a mailto link; return Just (name, domain) or Nothing.
parseMailto :: String -> Maybe (String, String)
Expand Down Expand Up @@ -1167,9 +1162,9 @@ inlineToHtml opts inline = do

blockListToNote :: PandocMonad m => WriterOptions -> String -> [Block] -> StateT WriterState m Html
blockListToNote opts ref blocks =
-- If last block is Para or Plain, include the backlink at the end of
-- If first block is Para or Plain, include the backlink at the start of
-- that block. Otherwise, insert a new Plain block with the backlink.
let backlink = [Link ("",["footnote-back"],[]) [Str (ref ++ ":")] ("#" ++ "fnref" ++ ref,[]), Space]
let backlink = [Link ("",["footnote-back"],[]) [Str (ref ++ ".")] ("#" ++ "fnref" ++ ref,[]), Space]
blocks' = case blocks of
[] -> []
(firstBlock:otherBlocks) ->
Expand All @@ -1180,7 +1175,7 @@ blockListToNote opts ref blocks =

in do contents <- blockListToHtml opts blocks'
html5 <- gets stHtml5
let noteElement = if html5 then H5.aside else H.li
let noteElement = if html5 then H5.aside else H.div
let noteItem = noteElement ! prefixedId opts ("fn" ++ ref) $ contents
epubVersion <- gets stEPUBVersion
let noteItem' = case epubVersion of
Expand Down

0 comments on commit 08172db

Please sign in to comment.