From 839f77d81ecd742d6368f8b140eeccd37d8a80e7 Mon Sep 17 00:00:00 2001
From: fiddlosopher
Date: Sun, 24 Feb 2008 18:15:36 +0000
Subject: [PATCH] Use style attributes rather than css classes for
strikethrough and ordered list styles. This works better when fragments,
rather than standalone documents, are generated.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1245 788f1e2b-df1e-0410-8736-df70ead52e1b
---
Text/Pandoc/Writers/HTML.hs | 13 +++--------
tests/writer.html | 45 +++++++++++++++----------------------
2 files changed, 21 insertions(+), 37 deletions(-)
diff --git a/Text/Pandoc/Writers/HTML.hs b/Text/Pandoc/Writers/HTML.hs
index d4ba09293..6ada56ba2 100644
--- a/Text/Pandoc/Writers/HTML.hs
+++ b/Text/Pandoc/Writers/HTML.hs
@@ -331,13 +331,8 @@ blockToHtml opts (OrderedList (startnum, numstyle, _) lst) = do
then [start startnum]
else []) ++
(if numstyle /= DefaultStyle
- then [theclass numstyle']
+ then [thestyle $ "list-style-type: " ++ numstyle' ++ ";"]
else [])
- if numstyle /= DefaultStyle
- then addToCSS $ "ol." ++ numstyle' ++
- " { list-style-type: " ++
- numstyle' ++ "; }"
- else return ()
return $ ordList ! attribs $ contents
blockToHtml opts (DefinitionList lst) = do
contents <- mapM (\(term, def) -> do term' <- inlineListToHtml opts term
@@ -405,10 +400,8 @@ inlineToHtml opts inline =
(Emph lst) -> inlineListToHtml opts lst >>= return . emphasize
(Strong lst) -> inlineListToHtml opts lst >>= return . strong
(Code str) -> return $ thecode << str
- (Strikeout lst) -> addToCSS
- ".strikeout { text-decoration: line-through; }" >>
- inlineListToHtml opts lst >>=
- return . (thespan ! [theclass "strikeout"])
+ (Strikeout lst) -> inlineListToHtml opts lst >>=
+ return . (thespan ! [thestyle "text-decoration: line-through;"])
(Superscript lst) -> inlineListToHtml opts lst >>= return . sup
(Subscript lst) -> inlineListToHtml opts lst >>= return . sub
(Quoted quoteType lst) ->
diff --git a/tests/writer.html b/tests/writer.html
index 890ce258c..99819f990 100644
--- a/tests/writer.html
+++ b/tests/writer.html
@@ -8,16 +8,7 @@
/>Pandoc Test Suite
A list:
- item one
- Ordered
Tight:
- First
and:
- One
Loose using tabs:
First
and using spaces:
One
Multiple paragraphs:
Item 1, graf one.
Here’s another:
- First
Same thing but with paragraphs:
First
Fancy list markers
- begins with 2
- and now 3
with a continuation
- sublist with roman numerals, starting with 4
- more items
more items- a subsublist
Nesting:
- Upper Alpha
Upper Alpha- Upper Roman.
Upper Roman.- Decimal start with 6
Decimal start with 6- Lower alpha with paren
<html>.This is strikeout.'+''+e+'
'+'<\/'+
>
- And in list items.