2006-12-20 20:54:23 +00:00
|
|
|
{-
|
|
|
|
Copyright (C) 2006 John MacFarlane <jgm at berkeley dot edu>
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
-}
|
|
|
|
|
2006-12-20 06:50:14 +00:00
|
|
|
{- |
|
|
|
|
Module : Text.Pandoc.Writers.HTML
|
|
|
|
Copyright : Copyright (C) 2006 John MacFarlane
|
|
|
|
License : GNU GPL, version 2 or above
|
|
|
|
|
|
|
|
Maintainer : John MacFarlane <jgm at berkeley dot edu>
|
2006-12-20 20:20:10 +00:00
|
|
|
Stability : alpha
|
2006-12-20 06:50:14 +00:00
|
|
|
Portability : portable
|
|
|
|
|
|
|
|
Conversion of 'Pandoc' documents to HTML.
|
|
|
|
-}
|
Modified HTML writer to use the Text.XHtml library. This results
in cleaner, faster code, and it makes it easier to use Pandoc in
other projects, like wikis, that use Text.XHtml. Two functions
are now provided, writeHtml and writeHtmlString: the former outputs
an Html structure, the latter a rendered string. The S5 writer is
also changed, in parallel ways (writeS5, writeS5String). The Html
header is now written programmatically, so it has been removed from
the 'headers' directory. The S5 header is still needed, but the
doctype and some of the meta declarations have been removed, since
they are written programatically. The INSTALL file and cabalize
have been updated to reflect the new dependency on the xhtml package.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@549 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-02-26 19:08:10 +00:00
|
|
|
module Text.Pandoc.Writers.HTML ( writeHtml, writeHtmlString ) where
|
2006-10-17 14:22:29 +00:00
|
|
|
import Text.Pandoc.Definition
|
|
|
|
import Text.Pandoc.Shared
|
2006-12-20 18:16:07 +00:00
|
|
|
import Text.Regex ( mkRegex, matchRegex )
|
2006-10-17 14:22:29 +00:00
|
|
|
import Numeric ( showHex )
|
2006-12-20 18:16:07 +00:00
|
|
|
import Data.Char ( ord, toLower )
|
2006-12-19 23:13:03 +00:00
|
|
|
import Data.List ( isPrefixOf, partition )
|
Modified HTML writer to use the Text.XHtml library. This results
in cleaner, faster code, and it makes it easier to use Pandoc in
other projects, like wikis, that use Text.XHtml. Two functions
are now provided, writeHtml and writeHtmlString: the former outputs
an Html structure, the latter a rendered string. The S5 writer is
also changed, in parallel ways (writeS5, writeS5String). The Html
header is now written programmatically, so it has been removed from
the 'headers' directory. The S5 header is still needed, but the
doctype and some of the meta declarations have been removed, since
they are written programatically. The INSTALL file and cabalize
have been updated to reflect the new dependency on the xhtml package.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@549 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-02-26 19:08:10 +00:00
|
|
|
import Text.XHtml.Strict
|
2006-10-17 14:22:29 +00:00
|
|
|
|
Modified HTML writer to use the Text.XHtml library. This results
in cleaner, faster code, and it makes it easier to use Pandoc in
other projects, like wikis, that use Text.XHtml. Two functions
are now provided, writeHtml and writeHtmlString: the former outputs
an Html structure, the latter a rendered string. The S5 writer is
also changed, in parallel ways (writeS5, writeS5String). The Html
header is now written programmatically, so it has been removed from
the 'headers' directory. The S5 header is still needed, but the
doctype and some of the meta declarations have been removed, since
they are written programatically. The INSTALL file and cabalize
have been updated to reflect the new dependency on the xhtml package.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@549 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-02-26 19:08:10 +00:00
|
|
|
-- | Convert Pandoc document to Html string.
|
|
|
|
writeHtmlString :: WriterOptions -> Pandoc -> String
|
|
|
|
writeHtmlString opts =
|
|
|
|
if writerStandalone opts
|
|
|
|
then renderHtml . (writeHtml opts)
|
|
|
|
else renderHtmlFragment . (writeHtml opts)
|
|
|
|
|
|
|
|
-- | Convert Pandoc document to Html structure.
|
|
|
|
writeHtml :: WriterOptions -> Pandoc -> Html
|
|
|
|
writeHtml opts (Pandoc (Meta tit authors date) blocks) =
|
|
|
|
let titlePrefix = writerTitlePrefix opts
|
|
|
|
topTitle = inlineListToHtml opts tit
|
|
|
|
topTitle' = if not (null titlePrefix)
|
|
|
|
then stringToHtml titlePrefix +++
|
|
|
|
if not (null tit)
|
|
|
|
then '-' +++ topTitle
|
|
|
|
else noHtml
|
|
|
|
else topTitle
|
|
|
|
head = header $ thetitle topTitle' +++
|
|
|
|
meta ! [httpequiv "Content-Type",
|
|
|
|
content "text/html; charset=UTF-8"] +++
|
|
|
|
meta ! [name "generator", content "pandoc"] +++
|
|
|
|
(toHtmlFromList $
|
|
|
|
map (\a -> meta ! [name "author", content a]) authors) +++
|
|
|
|
(if null date
|
|
|
|
then noHtml
|
|
|
|
else meta ! [name "date", content date]) +++
|
|
|
|
primHtml (writerHeader opts)
|
|
|
|
titleHeader = if (writerStandalone opts) && (not (null tit)) &&
|
2007-01-06 09:54:58 +00:00
|
|
|
(not (writerS5 opts))
|
Modified HTML writer to use the Text.XHtml library. This results
in cleaner, faster code, and it makes it easier to use Pandoc in
other projects, like wikis, that use Text.XHtml. Two functions
are now provided, writeHtml and writeHtmlString: the former outputs
an Html structure, the latter a rendered string. The S5 writer is
also changed, in parallel ways (writeS5, writeS5String). The Html
header is now written programmatically, so it has been removed from
the 'headers' directory. The S5 header is still needed, but the
doctype and some of the meta declarations have been removed, since
they are written programatically. The INSTALL file and cabalize
have been updated to reflect the new dependency on the xhtml package.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@549 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-02-26 19:08:10 +00:00
|
|
|
then h1 ! [theclass "title"] $ topTitle
|
|
|
|
else noHtml
|
|
|
|
blocks' = replaceReferenceLinks blocks
|
2006-12-20 06:50:14 +00:00
|
|
|
(noteBlocks, blocks'') = partition isNoteBlock blocks'
|
Modified HTML writer to use the Text.XHtml library. This results
in cleaner, faster code, and it makes it easier to use Pandoc in
other projects, like wikis, that use Text.XHtml. Two functions
are now provided, writeHtml and writeHtmlString: the former outputs
an Html structure, the latter a rendered string. The S5 writer is
also changed, in parallel ways (writeS5, writeS5String). The Html
header is now written programmatically, so it has been removed from
the 'headers' directory. The S5 header is still needed, but the
doctype and some of the meta declarations have been removed, since
they are written programatically. The INSTALL file and cabalize
have been updated to reflect the new dependency on the xhtml package.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@549 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-02-26 19:08:10 +00:00
|
|
|
before = primHtml $ writerIncludeBefore opts
|
|
|
|
after = primHtml $ writerIncludeAfter opts
|
|
|
|
thebody = before +++ titleHeader +++
|
|
|
|
toHtmlFromList (map (blockToHtml opts) blocks'') +++
|
|
|
|
footnoteSection opts noteBlocks +++ after
|
|
|
|
in if writerStandalone opts
|
|
|
|
then head +++ (body thebody)
|
|
|
|
else thebody
|
2006-10-17 14:22:29 +00:00
|
|
|
|
2006-12-20 06:50:14 +00:00
|
|
|
-- | Convert list of Note blocks to a footnote <div>.
|
|
|
|
-- Assumes notes are sorted.
|
Modified HTML writer to use the Text.XHtml library. This results
in cleaner, faster code, and it makes it easier to use Pandoc in
other projects, like wikis, that use Text.XHtml. Two functions
are now provided, writeHtml and writeHtmlString: the former outputs
an Html structure, the latter a rendered string. The S5 writer is
also changed, in parallel ways (writeS5, writeS5String). The Html
header is now written programmatically, so it has been removed from
the 'headers' directory. The S5 header is still needed, but the
doctype and some of the meta declarations have been removed, since
they are written programatically. The INSTALL file and cabalize
have been updated to reflect the new dependency on the xhtml package.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@549 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-02-26 19:08:10 +00:00
|
|
|
footnoteSection :: WriterOptions -> [Block] -> Html
|
2007-01-06 09:54:58 +00:00
|
|
|
footnoteSection opts notes =
|
2006-12-20 06:50:14 +00:00
|
|
|
if null notes
|
Modified HTML writer to use the Text.XHtml library. This results
in cleaner, faster code, and it makes it easier to use Pandoc in
other projects, like wikis, that use Text.XHtml. Two functions
are now provided, writeHtml and writeHtmlString: the former outputs
an Html structure, the latter a rendered string. The S5 writer is
also changed, in parallel ways (writeS5, writeS5String). The Html
header is now written programmatically, so it has been removed from
the 'headers' directory. The S5 header is still needed, but the
doctype and some of the meta declarations have been removed, since
they are written programatically. The INSTALL file and cabalize
have been updated to reflect the new dependency on the xhtml package.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@549 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-02-26 19:08:10 +00:00
|
|
|
then noHtml
|
|
|
|
else thediv ! [theclass "footnotes"] $
|
|
|
|
hr +++ (olist $ toHtmlFromList $ map (blockToHtml opts) notes)
|
2006-12-19 23:13:03 +00:00
|
|
|
|
2006-10-17 14:22:29 +00:00
|
|
|
-- | Obfuscate a "mailto:" link using Javascript.
|
Modified HTML writer to use the Text.XHtml library. This results
in cleaner, faster code, and it makes it easier to use Pandoc in
other projects, like wikis, that use Text.XHtml. Two functions
are now provided, writeHtml and writeHtmlString: the former outputs
an Html structure, the latter a rendered string. The S5 writer is
also changed, in parallel ways (writeS5, writeS5String). The Html
header is now written programmatically, so it has been removed from
the 'headers' directory. The S5 header is still needed, but the
doctype and some of the meta declarations have been removed, since
they are written programatically. The INSTALL file and cabalize
have been updated to reflect the new dependency on the xhtml package.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@549 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-02-26 19:08:10 +00:00
|
|
|
obfuscateLink :: WriterOptions -> [Inline] -> String -> Html
|
2007-01-06 09:54:58 +00:00
|
|
|
obfuscateLink opts txt src =
|
2006-12-20 18:16:07 +00:00
|
|
|
let emailRegex = mkRegex "mailto:*([^@]*)@(.*)"
|
Modified HTML writer to use the Text.XHtml library. This results
in cleaner, faster code, and it makes it easier to use Pandoc in
other projects, like wikis, that use Text.XHtml. Two functions
are now provided, writeHtml and writeHtmlString: the former outputs
an Html structure, the latter a rendered string. The S5 writer is
also changed, in parallel ways (writeS5, writeS5String). The Html
header is now written programmatically, so it has been removed from
the 'headers' directory. The S5 header is still needed, but the
doctype and some of the meta declarations have been removed, since
they are written programatically. The INSTALL file and cabalize
have been updated to reflect the new dependency on the xhtml package.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@549 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-02-26 19:08:10 +00:00
|
|
|
text' = show $ inlineListToHtml opts txt
|
|
|
|
src' = map toLower src in
|
2006-12-20 18:16:07 +00:00
|
|
|
case (matchRegex emailRegex src') of
|
|
|
|
(Just [name, domain]) ->
|
Modified HTML writer to use the Text.XHtml library. This results
in cleaner, faster code, and it makes it easier to use Pandoc in
other projects, like wikis, that use Text.XHtml. Two functions
are now provided, writeHtml and writeHtmlString: the former outputs
an Html structure, the latter a rendered string. The S5 writer is
also changed, in parallel ways (writeS5, writeS5String). The Html
header is now written programmatically, so it has been removed from
the 'headers' directory. The S5 header is still needed, but the
doctype and some of the meta declarations have been removed, since
they are written programatically. The INSTALL file and cabalize
have been updated to reflect the new dependency on the xhtml package.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@549 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-02-26 19:08:10 +00:00
|
|
|
let domain' = substitute "." " dot " domain
|
|
|
|
at' = obfuscateChar '@'
|
|
|
|
linkText = if src' == ("mailto:" ++ text')
|
2006-12-20 18:16:07 +00:00
|
|
|
then "e"
|
|
|
|
else "'" ++ text' ++ "'"
|
|
|
|
altText = if src' == ("mailto:" ++ text')
|
|
|
|
then name ++ " at " ++ domain'
|
|
|
|
else text' ++ " (" ++ name ++ " at " ++
|
|
|
|
domain' ++ ")" in
|
2007-01-06 09:54:58 +00:00
|
|
|
if writerStrictMarkdown opts
|
2007-03-11 00:19:15 +00:00
|
|
|
then -- need to use primHtml or &'s are escaped to & in URL
|
|
|
|
primHtml $ "<a href=\"" ++ (obfuscateString src')
|
|
|
|
++ "\">" ++ (obfuscateString text') ++ "</a>"
|
Modified HTML writer to use the Text.XHtml library. This results
in cleaner, faster code, and it makes it easier to use Pandoc in
other projects, like wikis, that use Text.XHtml. Two functions
are now provided, writeHtml and writeHtmlString: the former outputs
an Html structure, the latter a rendered string. The S5 writer is
also changed, in parallel ways (writeS5, writeS5String). The Html
header is now written programmatically, so it has been removed from
the 'headers' directory. The S5 header is still needed, but the
doctype and some of the meta declarations have been removed, since
they are written programatically. The INSTALL file and cabalize
have been updated to reflect the new dependency on the xhtml package.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@549 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-02-26 19:08:10 +00:00
|
|
|
else (script ! [thetype "text/javascript"] $
|
|
|
|
primHtml ("\n<!--\nh='" ++
|
2006-12-30 22:51:49 +00:00
|
|
|
obfuscateString domain ++ "';a='" ++ at' ++ "';n='" ++
|
|
|
|
obfuscateString name ++ "';e=n+a+h;\n" ++
|
|
|
|
"document.write('<a h'+'ref'+'=\"ma'+'ilto'+':'+e+'\">'+" ++
|
Modified HTML writer to use the Text.XHtml library. This results
in cleaner, faster code, and it makes it easier to use Pandoc in
other projects, like wikis, that use Text.XHtml. Two functions
are now provided, writeHtml and writeHtmlString: the former outputs
an Html structure, the latter a rendered string. The S5 writer is
also changed, in parallel ways (writeS5, writeS5String). The Html
header is now written programmatically, so it has been removed from
the 'headers' directory. The S5 header is still needed, but the
doctype and some of the meta declarations have been removed, since
they are written programatically. The INSTALL file and cabalize
have been updated to reflect the new dependency on the xhtml package.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@549 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-02-26 19:08:10 +00:00
|
|
|
linkText ++ "+'<\\/'+'a'+'>');\n// -->\n")) +++
|
2007-03-04 07:40:22 +00:00
|
|
|
noscript (primHtml $ obfuscateString altText)
|
Modified HTML writer to use the Text.XHtml library. This results
in cleaner, faster code, and it makes it easier to use Pandoc in
other projects, like wikis, that use Text.XHtml. Two functions
are now provided, writeHtml and writeHtmlString: the former outputs
an Html structure, the latter a rendered string. The S5 writer is
also changed, in parallel ways (writeS5, writeS5String). The Html
header is now written programmatically, so it has been removed from
the 'headers' directory. The S5 header is still needed, but the
doctype and some of the meta declarations have been removed, since
they are written programatically. The INSTALL file and cabalize
have been updated to reflect the new dependency on the xhtml package.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@549 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-02-26 19:08:10 +00:00
|
|
|
_ -> anchor ! [href src] $ inlineListToHtml opts txt -- malformed email
|
2006-10-17 14:22:29 +00:00
|
|
|
|
|
|
|
-- | Obfuscate character as entity.
|
|
|
|
obfuscateChar :: Char -> String
|
2006-12-20 06:50:14 +00:00
|
|
|
obfuscateChar char =
|
|
|
|
let num = ord char in
|
|
|
|
let numstr = if even num then (show num) else ("x" ++ (showHex num "")) in
|
|
|
|
"&#" ++ numstr ++ ";"
|
2006-10-17 14:22:29 +00:00
|
|
|
|
2006-12-20 18:16:07 +00:00
|
|
|
-- | Obfuscate string using entities.
|
|
|
|
obfuscateString :: String -> String
|
|
|
|
obfuscateString = concatMap obfuscateChar
|
|
|
|
|
2006-10-17 14:22:29 +00:00
|
|
|
-- | Convert Pandoc block element to HTML.
|
Modified HTML writer to use the Text.XHtml library. This results
in cleaner, faster code, and it makes it easier to use Pandoc in
other projects, like wikis, that use Text.XHtml. Two functions
are now provided, writeHtml and writeHtmlString: the former outputs
an Html structure, the latter a rendered string. The S5 writer is
also changed, in parallel ways (writeS5, writeS5String). The Html
header is now written programmatically, so it has been removed from
the 'headers' directory. The S5 header is still needed, but the
doctype and some of the meta declarations have been removed, since
they are written programatically. The INSTALL file and cabalize
have been updated to reflect the new dependency on the xhtml package.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@549 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-02-26 19:08:10 +00:00
|
|
|
blockToHtml :: WriterOptions -> Block -> Html
|
|
|
|
blockToHtml opts Null = noHtml
|
|
|
|
blockToHtml opts (Plain lst) = inlineListToHtml opts lst
|
|
|
|
blockToHtml opts (Para lst) = paragraph $ inlineListToHtml opts lst
|
2007-01-06 09:54:58 +00:00
|
|
|
blockToHtml opts (BlockQuote blocks) =
|
|
|
|
if (writerS5 opts)
|
2006-12-20 06:50:14 +00:00
|
|
|
then -- in S5, treat list in blockquote specially
|
|
|
|
-- if default is incremental, make it nonincremental;
|
|
|
|
-- otherwise incremental
|
2007-01-06 09:54:58 +00:00
|
|
|
let inc = not (writerIncremental opts) in
|
2006-12-20 06:50:14 +00:00
|
|
|
case blocks of
|
Modified HTML writer to use the Text.XHtml library. This results
in cleaner, faster code, and it makes it easier to use Pandoc in
other projects, like wikis, that use Text.XHtml. Two functions
are now provided, writeHtml and writeHtmlString: the former outputs
an Html structure, the latter a rendered string. The S5 writer is
also changed, in parallel ways (writeS5, writeS5String). The Html
header is now written programmatically, so it has been removed from
the 'headers' directory. The S5 header is still needed, but the
doctype and some of the meta declarations have been removed, since
they are written programatically. The INSTALL file and cabalize
have been updated to reflect the new dependency on the xhtml package.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@549 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-02-26 19:08:10 +00:00
|
|
|
[BulletList lst] -> blockToHtml (opts {writerIncremental =
|
2006-12-20 06:50:14 +00:00
|
|
|
inc}) (BulletList lst)
|
2007-01-06 09:54:58 +00:00
|
|
|
[OrderedList lst] -> blockToHtml (opts {writerIncremental =
|
2006-12-20 06:50:14 +00:00
|
|
|
inc}) (OrderedList lst)
|
Modified HTML writer to use the Text.XHtml library. This results
in cleaner, faster code, and it makes it easier to use Pandoc in
other projects, like wikis, that use Text.XHtml. Two functions
are now provided, writeHtml and writeHtmlString: the former outputs
an Html structure, the latter a rendered string. The S5 writer is
also changed, in parallel ways (writeS5, writeS5String). The Html
header is now written programmatically, so it has been removed from
the 'headers' directory. The S5 header is still needed, but the
doctype and some of the meta declarations have been removed, since
they are written programatically. The INSTALL file and cabalize
have been updated to reflect the new dependency on the xhtml package.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@549 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-02-26 19:08:10 +00:00
|
|
|
otherwise -> blockquote $ toHtmlFromList $
|
|
|
|
map (blockToHtml opts) blocks
|
|
|
|
else blockquote $ toHtmlFromList $ map (blockToHtml opts) blocks
|
2007-01-06 09:54:58 +00:00
|
|
|
blockToHtml opts (Note ref lst) =
|
Modified HTML writer to use the Text.XHtml library. This results
in cleaner, faster code, and it makes it easier to use Pandoc in
other projects, like wikis, that use Text.XHtml. Two functions
are now provided, writeHtml and writeHtmlString: the former outputs
an Html structure, the latter a rendered string. The S5 writer is
also changed, in parallel ways (writeS5, writeS5String). The Html
header is now written programmatically, so it has been removed from
the 'headers' directory. The S5 header is still needed, but the
doctype and some of the meta declarations have been removed, since
they are written programatically. The INSTALL file and cabalize
have been updated to reflect the new dependency on the xhtml package.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@549 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-02-26 19:08:10 +00:00
|
|
|
let contents = toHtmlFromList $ map (blockToHtml opts) lst
|
|
|
|
backlink = anchor ! [href ("#fnref" ++ ref), theclass "footnoteBacklink",
|
|
|
|
title ("Jump back to footnote " ++ ref)] $
|
|
|
|
(primHtmlChar "#8617") in
|
|
|
|
li ! [identifier ("fn" ++ ref)] $ contents +++ backlink
|
|
|
|
blockToHtml opts (Key _ _) = noHtml
|
2007-01-06 09:54:58 +00:00
|
|
|
blockToHtml opts (CodeBlock str) =
|
2007-02-27 07:05:11 +00:00
|
|
|
pre $ thecode << (str ++ "\n") -- the final \n for consistency with Markdown.pl
|
Modified HTML writer to use the Text.XHtml library. This results
in cleaner, faster code, and it makes it easier to use Pandoc in
other projects, like wikis, that use Text.XHtml. Two functions
are now provided, writeHtml and writeHtmlString: the former outputs
an Html structure, the latter a rendered string. The S5 writer is
also changed, in parallel ways (writeS5, writeS5String). The Html
header is now written programmatically, so it has been removed from
the 'headers' directory. The S5 header is still needed, but the
doctype and some of the meta declarations have been removed, since
they are written programatically. The INSTALL file and cabalize
have been updated to reflect the new dependency on the xhtml package.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@549 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-02-26 19:08:10 +00:00
|
|
|
blockToHtml opts (RawHtml str) = primHtml str
|
2007-01-06 09:54:58 +00:00
|
|
|
blockToHtml opts (BulletList lst) =
|
Modified HTML writer to use the Text.XHtml library. This results
in cleaner, faster code, and it makes it easier to use Pandoc in
other projects, like wikis, that use Text.XHtml. Two functions
are now provided, writeHtml and writeHtmlString: the former outputs
an Html structure, the latter a rendered string. The S5 writer is
also changed, in parallel ways (writeS5, writeS5String). The Html
header is now written programmatically, so it has been removed from
the 'headers' directory. The S5 header is still needed, but the
doctype and some of the meta declarations have been removed, since
they are written programatically. The INSTALL file and cabalize
have been updated to reflect the new dependency on the xhtml package.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@549 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-02-26 19:08:10 +00:00
|
|
|
let attribs = if writerIncremental opts
|
|
|
|
then [theclass "incremental"]
|
2007-01-06 09:54:58 +00:00
|
|
|
else [] in
|
2007-03-11 07:54:47 +00:00
|
|
|
unordList ! attribs $ map (blockListToHtml opts) lst
|
2007-01-06 09:54:58 +00:00
|
|
|
blockToHtml opts (OrderedList lst) =
|
Modified HTML writer to use the Text.XHtml library. This results
in cleaner, faster code, and it makes it easier to use Pandoc in
other projects, like wikis, that use Text.XHtml. Two functions
are now provided, writeHtml and writeHtmlString: the former outputs
an Html structure, the latter a rendered string. The S5 writer is
also changed, in parallel ways (writeS5, writeS5String). The Html
header is now written programmatically, so it has been removed from
the 'headers' directory. The S5 header is still needed, but the
doctype and some of the meta declarations have been removed, since
they are written programatically. The INSTALL file and cabalize
have been updated to reflect the new dependency on the xhtml package.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@549 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-02-26 19:08:10 +00:00
|
|
|
let attribs = if writerIncremental opts
|
|
|
|
then [theclass "incremental"]
|
2007-01-06 09:54:58 +00:00
|
|
|
else [] in
|
2007-03-11 07:54:47 +00:00
|
|
|
ordList ! attribs $ map (blockListToHtml opts) lst
|
|
|
|
blockToHtml opts (DefinitionList lst) =
|
|
|
|
let attribs = if writerIncremental opts
|
|
|
|
then [theclass "incremental"]
|
|
|
|
else [] in
|
|
|
|
defList ! attribs $ map (\(term, def) -> (inlineListToHtml opts term,
|
|
|
|
blockListToHtml opts def)) lst
|
Modified HTML writer to use the Text.XHtml library. This results
in cleaner, faster code, and it makes it easier to use Pandoc in
other projects, like wikis, that use Text.XHtml. Two functions
are now provided, writeHtml and writeHtmlString: the former outputs
an Html structure, the latter a rendered string. The S5 writer is
also changed, in parallel ways (writeS5, writeS5String). The Html
header is now written programmatically, so it has been removed from
the 'headers' directory. The S5 header is still needed, but the
doctype and some of the meta declarations have been removed, since
they are written programatically. The INSTALL file and cabalize
have been updated to reflect the new dependency on the xhtml package.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@549 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-02-26 19:08:10 +00:00
|
|
|
blockToHtml opts HorizontalRule = hr
|
2007-01-06 09:54:58 +00:00
|
|
|
blockToHtml opts (Header level lst) =
|
Modified HTML writer to use the Text.XHtml library. This results
in cleaner, faster code, and it makes it easier to use Pandoc in
other projects, like wikis, that use Text.XHtml. Two functions
are now provided, writeHtml and writeHtmlString: the former outputs
an Html structure, the latter a rendered string. The S5 writer is
also changed, in parallel ways (writeS5, writeS5String). The Html
header is now written programmatically, so it has been removed from
the 'headers' directory. The S5 header is still needed, but the
doctype and some of the meta declarations have been removed, since
they are written programatically. The INSTALL file and cabalize
have been updated to reflect the new dependency on the xhtml package.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@549 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-02-26 19:08:10 +00:00
|
|
|
let contents = inlineListToHtml opts lst in
|
|
|
|
case level of
|
|
|
|
1 -> h1 contents
|
|
|
|
2 -> h2 contents
|
|
|
|
3 -> h3 contents
|
|
|
|
4 -> h4 contents
|
|
|
|
5 -> h5 contents
|
|
|
|
6 -> h6 contents
|
|
|
|
_ -> paragraph contents
|
|
|
|
blockToHtml opts (Table capt aligns widths headers rows) =
|
2007-01-15 19:52:42 +00:00
|
|
|
let alignStrings = map alignmentToString aligns
|
Modified HTML writer to use the Text.XHtml library. This results
in cleaner, faster code, and it makes it easier to use Pandoc in
other projects, like wikis, that use Text.XHtml. Two functions
are now provided, writeHtml and writeHtmlString: the former outputs
an Html structure, the latter a rendered string. The S5 writer is
also changed, in parallel ways (writeS5, writeS5String). The Html
header is now written programmatically, so it has been removed from
the 'headers' directory. The S5 header is still needed, but the
doctype and some of the meta declarations have been removed, since
they are written programatically. The INSTALL file and cabalize
have been updated to reflect the new dependency on the xhtml package.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@549 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-02-26 19:08:10 +00:00
|
|
|
captionDoc = if null capt
|
|
|
|
then noHtml
|
|
|
|
else caption $ inlineListToHtml opts capt in
|
|
|
|
table $ captionDoc +++
|
|
|
|
(colHeadsToHtml opts alignStrings widths headers) +++
|
|
|
|
(toHtmlFromList $ map (tableRowToHtml opts alignStrings) rows)
|
2007-01-15 19:52:42 +00:00
|
|
|
|
|
|
|
colHeadsToHtml opts alignStrings widths headers =
|
|
|
|
let heads = zipWith3
|
Modified HTML writer to use the Text.XHtml library. This results
in cleaner, faster code, and it makes it easier to use Pandoc in
other projects, like wikis, that use Text.XHtml. Two functions
are now provided, writeHtml and writeHtmlString: the former outputs
an Html structure, the latter a rendered string. The S5 writer is
also changed, in parallel ways (writeS5, writeS5String). The Html
header is now written programmatically, so it has been removed from
the 'headers' directory. The S5 header is still needed, but the
doctype and some of the meta declarations have been removed, since
they are written programatically. The INSTALL file and cabalize
have been updated to reflect the new dependency on the xhtml package.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@549 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-02-26 19:08:10 +00:00
|
|
|
(\align width item -> tableItemToHtml opts th align width item)
|
2007-01-15 19:52:42 +00:00
|
|
|
alignStrings widths headers in
|
Modified HTML writer to use the Text.XHtml library. This results
in cleaner, faster code, and it makes it easier to use Pandoc in
other projects, like wikis, that use Text.XHtml. Two functions
are now provided, writeHtml and writeHtmlString: the former outputs
an Html structure, the latter a rendered string. The S5 writer is
also changed, in parallel ways (writeS5, writeS5String). The Html
header is now written programmatically, so it has been removed from
the 'headers' directory. The S5 header is still needed, but the
doctype and some of the meta declarations have been removed, since
they are written programatically. The INSTALL file and cabalize
have been updated to reflect the new dependency on the xhtml package.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@549 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-02-26 19:08:10 +00:00
|
|
|
tr $ toHtmlFromList heads
|
2007-01-15 19:52:42 +00:00
|
|
|
|
|
|
|
alignmentToString alignment = case alignment of
|
Modified HTML writer to use the Text.XHtml library. This results
in cleaner, faster code, and it makes it easier to use Pandoc in
other projects, like wikis, that use Text.XHtml. Two functions
are now provided, writeHtml and writeHtmlString: the former outputs
an Html structure, the latter a rendered string. The S5 writer is
also changed, in parallel ways (writeS5, writeS5String). The Html
header is now written programmatically, so it has been removed from
the 'headers' directory. The S5 header is still needed, but the
doctype and some of the meta declarations have been removed, since
they are written programatically. The INSTALL file and cabalize
have been updated to reflect the new dependency on the xhtml package.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@549 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-02-26 19:08:10 +00:00
|
|
|
AlignLeft -> "left"
|
|
|
|
AlignRight -> "right"
|
|
|
|
AlignCenter -> "center"
|
2007-01-15 19:52:42 +00:00
|
|
|
AlignDefault -> "left"
|
|
|
|
tableRowToHtml opts aligns cols =
|
Modified HTML writer to use the Text.XHtml library. This results
in cleaner, faster code, and it makes it easier to use Pandoc in
other projects, like wikis, that use Text.XHtml. Two functions
are now provided, writeHtml and writeHtmlString: the former outputs
an Html structure, the latter a rendered string. The S5 writer is
also changed, in parallel ways (writeS5, writeS5String). The Html
header is now written programmatically, so it has been removed from
the 'headers' directory. The S5 header is still needed, but the
doctype and some of the meta declarations have been removed, since
they are written programatically. The INSTALL file and cabalize
have been updated to reflect the new dependency on the xhtml package.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@549 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-02-26 19:08:10 +00:00
|
|
|
tr $ toHtmlFromList $ zipWith3 (tableItemToHtml opts td) aligns (repeat 0) cols
|
2007-01-15 19:52:42 +00:00
|
|
|
|
Modified HTML writer to use the Text.XHtml library. This results
in cleaner, faster code, and it makes it easier to use Pandoc in
other projects, like wikis, that use Text.XHtml. Two functions
are now provided, writeHtml and writeHtmlString: the former outputs
an Html structure, the latter a rendered string. The S5 writer is
also changed, in parallel ways (writeS5, writeS5String). The Html
header is now written programmatically, so it has been removed from
the 'headers' directory. The S5 header is still needed, but the
doctype and some of the meta declarations have been removed, since
they are written programatically. The INSTALL file and cabalize
have been updated to reflect the new dependency on the xhtml package.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@549 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-02-26 19:08:10 +00:00
|
|
|
tableItemToHtml opts tag align' width item =
|
|
|
|
let attrib = [align align'] ++
|
2007-01-15 19:52:42 +00:00
|
|
|
if (width /= 0)
|
Modified HTML writer to use the Text.XHtml library. This results
in cleaner, faster code, and it makes it easier to use Pandoc in
other projects, like wikis, that use Text.XHtml. Two functions
are now provided, writeHtml and writeHtmlString: the former outputs
an Html structure, the latter a rendered string. The S5 writer is
also changed, in parallel ways (writeS5, writeS5String). The Html
header is now written programmatically, so it has been removed from
the 'headers' directory. The S5 header is still needed, but the
doctype and some of the meta declarations have been removed, since
they are written programatically. The INSTALL file and cabalize
have been updated to reflect the new dependency on the xhtml package.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@549 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-02-26 19:08:10 +00:00
|
|
|
then [thestyle ("{width: " ++ show (truncate (100*width)) ++ "%;}")]
|
2007-01-15 19:52:42 +00:00
|
|
|
else [] in
|
Modified HTML writer to use the Text.XHtml library. This results
in cleaner, faster code, and it makes it easier to use Pandoc in
other projects, like wikis, that use Text.XHtml. Two functions
are now provided, writeHtml and writeHtmlString: the former outputs
an Html structure, the latter a rendered string. The S5 writer is
also changed, in parallel ways (writeS5, writeS5String). The Html
header is now written programmatically, so it has been removed from
the 'headers' directory. The S5 header is still needed, but the
doctype and some of the meta declarations have been removed, since
they are written programatically. The INSTALL file and cabalize
have been updated to reflect the new dependency on the xhtml package.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@549 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-02-26 19:08:10 +00:00
|
|
|
tag ! attrib $ toHtmlFromList $ map (blockToHtml opts) item
|
2007-01-06 09:54:58 +00:00
|
|
|
|
2007-03-11 07:54:47 +00:00
|
|
|
blockListToHtml :: WriterOptions -> [Block] -> Html
|
|
|
|
blockListToHtml opts list =
|
|
|
|
toHtmlFromList $ map (blockToHtml opts) list
|
2006-10-17 14:22:29 +00:00
|
|
|
|
|
|
|
-- | Convert list of Pandoc inline elements to HTML.
|
Modified HTML writer to use the Text.XHtml library. This results
in cleaner, faster code, and it makes it easier to use Pandoc in
other projects, like wikis, that use Text.XHtml. Two functions
are now provided, writeHtml and writeHtmlString: the former outputs
an Html structure, the latter a rendered string. The S5 writer is
also changed, in parallel ways (writeS5, writeS5String). The Html
header is now written programmatically, so it has been removed from
the 'headers' directory. The S5 header is still needed, but the
doctype and some of the meta declarations have been removed, since
they are written programatically. The INSTALL file and cabalize
have been updated to reflect the new dependency on the xhtml package.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@549 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-02-26 19:08:10 +00:00
|
|
|
inlineListToHtml :: WriterOptions -> [Inline] -> Html
|
|
|
|
inlineListToHtml opts lst = toHtmlFromList $ map (inlineToHtml opts) lst
|
2006-10-17 14:22:29 +00:00
|
|
|
|
|
|
|
-- | Convert Pandoc inline element to HTML.
|
Modified HTML writer to use the Text.XHtml library. This results
in cleaner, faster code, and it makes it easier to use Pandoc in
other projects, like wikis, that use Text.XHtml. Two functions
are now provided, writeHtml and writeHtmlString: the former outputs
an Html structure, the latter a rendered string. The S5 writer is
also changed, in parallel ways (writeS5, writeS5String). The Html
header is now written programmatically, so it has been removed from
the 'headers' directory. The S5 header is still needed, but the
doctype and some of the meta declarations have been removed, since
they are written programatically. The INSTALL file and cabalize
have been updated to reflect the new dependency on the xhtml package.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@549 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-02-26 19:08:10 +00:00
|
|
|
inlineToHtml :: WriterOptions -> Inline -> Html
|
2007-01-06 09:54:58 +00:00
|
|
|
inlineToHtml opts (Emph lst) =
|
Modified HTML writer to use the Text.XHtml library. This results
in cleaner, faster code, and it makes it easier to use Pandoc in
other projects, like wikis, that use Text.XHtml. Two functions
are now provided, writeHtml and writeHtmlString: the former outputs
an Html structure, the latter a rendered string. The S5 writer is
also changed, in parallel ways (writeS5, writeS5String). The Html
header is now written programmatically, so it has been removed from
the 'headers' directory. The S5 header is still needed, but the
doctype and some of the meta declarations have been removed, since
they are written programatically. The INSTALL file and cabalize
have been updated to reflect the new dependency on the xhtml package.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@549 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-02-26 19:08:10 +00:00
|
|
|
emphasize $ inlineListToHtml opts lst
|
2007-01-06 09:54:58 +00:00
|
|
|
inlineToHtml opts (Strong lst) =
|
Modified HTML writer to use the Text.XHtml library. This results
in cleaner, faster code, and it makes it easier to use Pandoc in
other projects, like wikis, that use Text.XHtml. Two functions
are now provided, writeHtml and writeHtmlString: the former outputs
an Html structure, the latter a rendered string. The S5 writer is
also changed, in parallel ways (writeS5, writeS5String). The Html
header is now written programmatically, so it has been removed from
the 'headers' directory. The S5 header is still needed, but the
doctype and some of the meta declarations have been removed, since
they are written programatically. The INSTALL file and cabalize
have been updated to reflect the new dependency on the xhtml package.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@549 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-02-26 19:08:10 +00:00
|
|
|
strong $ inlineListToHtml opts lst
|
2007-01-06 09:54:58 +00:00
|
|
|
inlineToHtml opts (Code str) =
|
2007-02-27 07:05:11 +00:00
|
|
|
thecode << str
|
2007-01-06 09:54:58 +00:00
|
|
|
inlineToHtml opts (Quoted SingleQuote lst) =
|
Modified HTML writer to use the Text.XHtml library. This results
in cleaner, faster code, and it makes it easier to use Pandoc in
other projects, like wikis, that use Text.XHtml. Two functions
are now provided, writeHtml and writeHtmlString: the former outputs
an Html structure, the latter a rendered string. The S5 writer is
also changed, in parallel ways (writeS5, writeS5String). The Html
header is now written programmatically, so it has been removed from
the 'headers' directory. The S5 header is still needed, but the
doctype and some of the meta declarations have been removed, since
they are written programatically. The INSTALL file and cabalize
have been updated to reflect the new dependency on the xhtml package.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@549 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-02-26 19:08:10 +00:00
|
|
|
primHtmlChar "lsquo" +++ inlineListToHtml opts lst +++ primHtmlChar "rsquo"
|
2007-01-06 09:54:58 +00:00
|
|
|
inlineToHtml opts (Quoted DoubleQuote lst) =
|
Modified HTML writer to use the Text.XHtml library. This results
in cleaner, faster code, and it makes it easier to use Pandoc in
other projects, like wikis, that use Text.XHtml. Two functions
are now provided, writeHtml and writeHtmlString: the former outputs
an Html structure, the latter a rendered string. The S5 writer is
also changed, in parallel ways (writeS5, writeS5String). The Html
header is now written programmatically, so it has been removed from
the 'headers' directory. The S5 header is still needed, but the
doctype and some of the meta declarations have been removed, since
they are written programatically. The INSTALL file and cabalize
have been updated to reflect the new dependency on the xhtml package.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@549 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-02-26 19:08:10 +00:00
|
|
|
primHtmlChar "ldquo" +++ inlineListToHtml opts lst +++ primHtmlChar "rdquo"
|
|
|
|
inlineToHtml opts EmDash = primHtmlChar "mdash"
|
|
|
|
inlineToHtml opts EnDash = primHtmlChar "ndash"
|
|
|
|
inlineToHtml opts Ellipses = primHtmlChar "hellip"
|
|
|
|
inlineToHtml opts Apostrophe = primHtmlChar "rsquo"
|
|
|
|
inlineToHtml opts (Str str) = stringToHtml str
|
|
|
|
inlineToHtml opts (TeX str) = stringToHtml str
|
|
|
|
inlineToHtml opts (HtmlInline str) = primHtml str
|
|
|
|
inlineToHtml opts (LineBreak) = br
|
|
|
|
inlineToHtml opts Space = stringToHtml " "
|
|
|
|
inlineToHtml opts (Link txt (Src src tit)) =
|
2006-12-20 06:50:14 +00:00
|
|
|
if (isPrefixOf "mailto:" src)
|
2007-01-06 09:54:58 +00:00
|
|
|
then obfuscateLink opts txt src
|
Modified HTML writer to use the Text.XHtml library. This results
in cleaner, faster code, and it makes it easier to use Pandoc in
other projects, like wikis, that use Text.XHtml. Two functions
are now provided, writeHtml and writeHtmlString: the former outputs
an Html structure, the latter a rendered string. The S5 writer is
also changed, in parallel ways (writeS5, writeS5String). The Html
header is now written programmatically, so it has been removed from
the 'headers' directory. The S5 header is still needed, but the
doctype and some of the meta declarations have been removed, since
they are written programatically. The INSTALL file and cabalize
have been updated to reflect the new dependency on the xhtml package.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@549 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-02-26 19:08:10 +00:00
|
|
|
else anchor ! ([href src] ++ if null tit then [] else [title tit]) $
|
|
|
|
inlineListToHtml opts txt
|
2007-01-06 09:54:58 +00:00
|
|
|
inlineToHtml opts (Link txt (Ref ref)) =
|
Modified HTML writer to use the Text.XHtml library. This results
in cleaner, faster code, and it makes it easier to use Pandoc in
other projects, like wikis, that use Text.XHtml. Two functions
are now provided, writeHtml and writeHtmlString: the former outputs
an Html structure, the latter a rendered string. The S5 writer is
also changed, in parallel ways (writeS5, writeS5String). The Html
header is now written programmatically, so it has been removed from
the 'headers' directory. The S5 header is still needed, but the
doctype and some of the meta declarations have been removed, since
they are written programatically. The INSTALL file and cabalize
have been updated to reflect the new dependency on the xhtml package.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@549 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-02-26 19:08:10 +00:00
|
|
|
'[' +++ (inlineListToHtml opts txt) +++
|
|
|
|
']' +++ '[' +++ (inlineListToHtml opts ref) +++
|
|
|
|
']'
|
2006-12-20 06:50:14 +00:00
|
|
|
-- this is what markdown does, for better or worse
|
Modified HTML writer to use the Text.XHtml library. This results
in cleaner, faster code, and it makes it easier to use Pandoc in
other projects, like wikis, that use Text.XHtml. Two functions
are now provided, writeHtml and writeHtmlString: the former outputs
an Html structure, the latter a rendered string. The S5 writer is
also changed, in parallel ways (writeS5, writeS5String). The Html
header is now written programmatically, so it has been removed from
the 'headers' directory. The S5 header is still needed, but the
doctype and some of the meta declarations have been removed, since
they are written programatically. The INSTALL file and cabalize
have been updated to reflect the new dependency on the xhtml package.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@549 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-02-26 19:08:10 +00:00
|
|
|
inlineToHtml opts (Image alttext (Src source tit)) =
|
2007-02-27 07:05:11 +00:00
|
|
|
let alternate = renderHtmlFragment $ inlineListToHtml opts alttext in
|
Modified HTML writer to use the Text.XHtml library. This results
in cleaner, faster code, and it makes it easier to use Pandoc in
other projects, like wikis, that use Text.XHtml. Two functions
are now provided, writeHtml and writeHtmlString: the former outputs
an Html structure, the latter a rendered string. The S5 writer is
also changed, in parallel ways (writeS5, writeS5String). The Html
header is now written programmatically, so it has been removed from
the 'headers' directory. The S5 header is still needed, but the
doctype and some of the meta declarations have been removed, since
they are written programatically. The INSTALL file and cabalize
have been updated to reflect the new dependency on the xhtml package.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@549 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-02-26 19:08:10 +00:00
|
|
|
image ! ([src source, title tit] ++ if null alttext then [] else [alt alternate])
|
|
|
|
-- note: null title is included, as in Markdown.pl
|
2007-01-06 09:54:58 +00:00
|
|
|
inlineToHtml opts (Image alternate (Ref ref)) =
|
Modified HTML writer to use the Text.XHtml library. This results
in cleaner, faster code, and it makes it easier to use Pandoc in
other projects, like wikis, that use Text.XHtml. Two functions
are now provided, writeHtml and writeHtmlString: the former outputs
an Html structure, the latter a rendered string. The S5 writer is
also changed, in parallel ways (writeS5, writeS5String). The Html
header is now written programmatically, so it has been removed from
the 'headers' directory. The S5 header is still needed, but the
doctype and some of the meta declarations have been removed, since
they are written programatically. The INSTALL file and cabalize
have been updated to reflect the new dependency on the xhtml package.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@549 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-02-26 19:08:10 +00:00
|
|
|
'!' +++ inlineToHtml opts (Link alternate (Ref ref))
|
2007-01-06 09:54:58 +00:00
|
|
|
inlineToHtml opts (NoteRef ref) =
|
2007-02-27 07:05:11 +00:00
|
|
|
anchor ! [href ("#fn" ++ ref), theclass "footnoteRef", identifier ("fnref" ++ ref)] <<
|
|
|
|
sup << ref
|
Modified HTML writer to use the Text.XHtml library. This results
in cleaner, faster code, and it makes it easier to use Pandoc in
other projects, like wikis, that use Text.XHtml. Two functions
are now provided, writeHtml and writeHtmlString: the former outputs
an Html structure, the latter a rendered string. The S5 writer is
also changed, in parallel ways (writeS5, writeS5String). The Html
header is now written programmatically, so it has been removed from
the 'headers' directory. The S5 header is still needed, but the
doctype and some of the meta declarations have been removed, since
they are written programatically. The INSTALL file and cabalize
have been updated to reflect the new dependency on the xhtml package.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@549 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-02-26 19:08:10 +00:00
|
|
|
|