diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-07-22 16:05:38 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-07-22 16:05:38 +0000 |
commit | 6bb6dd2bfd526fff9a469fddd9515aec268bfe15 (patch) | |
tree | 0a6fc064c44a055e86714473b202d1d64a7d5fe6 /src/Text/Pandoc/Writers/HTML.hs | |
parent | d03ec5a4a243a80856b53fa0cdf222d8dfdb1dd7 (diff) | |
download | pandoc-6bb6dd2bfd526fff9a469fddd9515aec268bfe15.tar.gz |
+ Added support for superscript, subscript, and
strikeout to all writers. (Thanks to Bradley Kuhn
for the patches for strikeout, here slightly modified.)
+ Refactored character escaping using the new functions
escapeStringUsing and backslashEscapes.
+ Added state to LaTeX writer, which now keeps track of what
packages need to be included in the preamble, based on the
content of the document. (Thus, e.g., ulem is only required
if you use strikeout.)
git-svn-id: https://pandoc.googlecode.com/svn/trunk@755 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'src/Text/Pandoc/Writers/HTML.hs')
-rw-r--r-- | src/Text/Pandoc/Writers/HTML.hs | 43 |
1 files changed, 26 insertions, 17 deletions
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs index ad31969ed..d8fbdb9b4 100644 --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/src/Text/Pandoc/Writers/HTML.hs @@ -66,6 +66,7 @@ writeHtml opts (Pandoc (Meta tit authors date) blocks) = (if null date then noHtml else meta ! [name "date", content date]) +++ + (style ! [thetype "text/css"] $ (stringToHtml ".strikeout { text-decoration: line-through; }")) +++ primHtml (writerHeader opts) titleHeader = if (writerStandalone opts) && (not (null tit)) && (not (writerS5 opts)) @@ -179,23 +180,27 @@ inlineListToIdentifier [] = "" inlineListToIdentifier (x:xs) = xAsText ++ inlineListToIdentifier xs where xAsText = case x of - Str s -> filter (\c -> (c == '-') || not (isPunctuation c)) $ - concat $ intersperse "-" $ words $ map toLower s - Emph lst -> inlineListToIdentifier lst - Strong lst -> inlineListToIdentifier lst - Quoted _ lst -> inlineListToIdentifier lst - Code s -> s - Space -> "-" - EmDash -> "-" - EnDash -> "-" - Apostrophe -> "" - Ellipses -> "" - LineBreak -> "-" - TeX _ -> "" - HtmlInline _ -> "" - Link lst _ -> inlineListToIdentifier lst - Image lst _ -> inlineListToIdentifier lst - Note _ -> "" + Str s -> filter + (\c -> (c == '-') || not (isPunctuation c)) $ + concat $ intersperse "-" $ words $ map toLower s + Emph lst -> inlineListToIdentifier lst + Strikeout lst -> inlineListToIdentifier lst + Superscript lst -> inlineListToIdentifier lst + Subscript lst -> inlineListToIdentifier lst + Strong lst -> inlineListToIdentifier lst + Quoted _ lst -> inlineListToIdentifier lst + Code s -> s + Space -> "-" + EmDash -> "-" + EnDash -> "-" + Apostrophe -> "" + Ellipses -> "" + LineBreak -> "-" + TeX _ -> "" + HtmlInline _ -> "" + Link lst _ -> inlineListToIdentifier lst + Image lst _ -> inlineListToIdentifier lst + Note _ -> "" -- | Return unique identifiers for list of inline lists. uniqueIdentifiers :: [[Inline]] -> [String] @@ -326,6 +331,10 @@ inlineToHtml opts inline = (Emph lst) -> inlineListToHtml opts lst >>= (return . emphasize) (Strong lst) -> inlineListToHtml opts lst >>= (return . strong) (Code str) -> return $ thecode << str + (Strikeout lst) -> inlineListToHtml opts lst >>= + (return . (thespan ! [theclass "strikeout"])) + (Superscript lst) -> inlineListToHtml opts lst >>= (return . sup) + (Subscript lst) -> inlineListToHtml opts lst >>= (return . sub) (Quoted quoteType lst) -> let (leftQuote, rightQuote) = case quoteType of SingleQuote -> (primHtmlChar "lsquo", |