From 5cf769b1cd1d9e76ff5f543aba8b4a15a90b7d88 Mon Sep 17 00:00:00 2001 From: fiddlosopher Date: Wed, 20 Dec 2006 00:25:54 +0000 Subject: Modified the HTML writer to add invisible anchors to each section heading. The anchors are derived form the text of the section heading as described in README. This makes it easy to insert links that jump from one part of a document to another: for example, '[back to the Introduction](#Introduction)'. git-svn-id: https://pandoc.googlecode.com/svn/trunk@246 788f1e2b-df1e-0410-8736-df70ead52e1b --- src/Text/Pandoc/Writers/HTML.hs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/Text/Pandoc/Writers/HTML.hs') diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs index f1bd0f8b5..7ba506acb 100644 --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/src/Text/Pandoc/Writers/HTML.hs @@ -154,12 +154,14 @@ blockToHtml options (OrderedList lst) = let attribs = if (writerIncremental options) then " class=\"incremental\"" else "" in "\n" ++ (concatMap (listItemToHtml options) lst) ++ "\n" blockToHtml options HorizontalRule = "
\n" -blockToHtml options (Header level lst) = if ((level > 0) && (level <= 6)) then - "" ++ - (inlineListToHtml options lst) ++ - "\n" - else - "

" ++ (inlineListToHtml options lst) ++ "

\n" +blockToHtml options (Header level lst) = + let contents = inlineListToHtml options lst in + let simplify = gsub "<[^>]*>" "" . gsub " " "_" in + if ((level > 0) && (level <= 6)) + then "\n" ++ + "" ++ contents ++ + "\n" + else "

" ++ contents ++ "

\n" listItemToHtml options list = "
  • " ++ (concatMap (blockToHtml options) list) ++ "
  • \n" -- | Convert list of Pandoc inline elements to HTML. -- cgit v1.2.3