diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-07-14 03:37:41 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-07-14 03:37:41 +0000 |
commit | a786f43e8cfcbcd7252a13e36357d78a0bc1f4bf (patch) | |
tree | be3dd14a6b3bc6911f071412213ce993fef4b9de /src | |
parent | 8477f141130f70ad60d771865fd7c40c59864c47 (diff) | |
download | pandoc-a786f43e8cfcbcd7252a13e36357d78a0bc1f4bf.tar.gz |
Change to footnotes in HTML writer: Instead of putting the footnote
backlink on a line by itself, after the content of the note,
we now put it at the end of the last paragraph of the footnote.
This saves space and looks better. More specifically:
+ If the last block of the note is a Para or Plain block, the
backlink is put at the end of that block's contents.
+ Otherwise, the backlink is put in a separate Plain block by
itself, after the footnote's contents.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@697 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/Writers/HTML.hs | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs index 4ed6a3ce9..ad31969ed 100644 --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/src/Text/Pandoc/Writers/HTML.hs @@ -363,9 +363,22 @@ inlineToHtml opts inline = blockListToNote :: WriterOptions -> String -> [Block] -> State WriterState Html blockListToNote opts ref blocks = - do contents <- blockListToHtml opts blocks - let backlink = anchor ! [href ("#fnref" ++ ref), theclass "footnoteBacklink", - title ("Jump back to footnote " ++ ref)] $ - (primHtmlChar "#8617") - return $ li ! [identifier ("fn" ++ ref)] $ contents +++ backlink + -- If last block is Para or Plain, include the backlink at the end of + -- that block. Otherwise, insert a new Plain block with the backlink. + let backlink = [HtmlInline $ " <a href=\"#fnref" ++ ref ++ + "\" class=\"footnoteBackLink\"" ++ + " title=\"Jump back to footnote " ++ ref ++ "\">↩</a>"] + blocks' = if null blocks + then [] + else let lastBlock = last blocks + otherBlocks = init blocks + in case lastBlock of + (Para lst) -> otherBlocks ++ + [Para (lst ++ backlink)] + (Plain lst) -> otherBlocks ++ + [Plain (lst ++ backlink)] + _ -> otherBlocks ++ [lastBlock, + Plain backlink] + in do contents <- blockListToHtml opts blocks' + return $ li ! [identifier ("fn" ++ ref)] $ contents |