summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2008-02-24 18:15:36 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2008-02-24 18:15:36 +0000
commit839f77d81ecd742d6368f8b140eeccd37d8a80e7 (patch)
treeceb1fe9fa7d42cbda28be5ccdd12ef88db2efc49
parent858269dd20b48517ef0c8c9dc733433e1b17b131 (diff)
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
-rw-r--r--Text/Pandoc/Writers/HTML.hs13
-rw-r--r--tests/writer.html45
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 @@
/><meta name="author" content="John MacFarlane"
/><meta name="author" content="Anonymous"
/><meta name="date" content="July 17, 2006"
- /><style type="text/css"
- >
-.strikeout { text-decoration: line-through; }
-ol.decimal { list-style-type: decimal; }
-ol.lower-alpha { list-style-type: lower-alpha; }
-ol.lower-roman { list-style-type: lower-roman; }
-ol.upper-alpha { list-style-type: upper-alpha; }
-ol.upper-roman { list-style-type: upper-roman; }
-</style
- ></head
+ /></head
><body
><h1 class="title"
>Pandoc Test Suite</h1
@@ -85,7 +76,7 @@ ol.upper-roman { list-style-type: upper-roman; }
></pre
><p
>A list:</p
- ><ol class="decimal"
+ ><ol style="list-style-type: decimal;"
><li
>item one</li
><li
@@ -218,7 +209,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{
>Ordered</h2
><p
>Tight:</p
- ><ol class="decimal"
+ ><ol style="list-style-type: decimal;"
><li
>First</li
><li
@@ -228,7 +219,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{
></ol
><p
>and:</p
- ><ol class="decimal"
+ ><ol style="list-style-type: decimal;"
><li
>One</li
><li
@@ -238,7 +229,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{
></ol
><p
>Loose using tabs:</p
- ><ol class="decimal"
+ ><ol style="list-style-type: decimal;"
><li
><p
>First</p
@@ -254,7 +245,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{
></ol
><p
>and using spaces:</p
- ><ol class="decimal"
+ ><ol style="list-style-type: decimal;"
><li
><p
>One</p
@@ -270,7 +261,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{
></ol
><p
>Multiple paragraphs:</p
- ><ol class="decimal"
+ ><ol style="list-style-type: decimal;"
><li
><p
>Item 1, graf one.</p
@@ -302,7 +293,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{
></ul
><p
>Here&rsquo;s another:</p
- ><ol class="decimal"
+ ><ol style="list-style-type: decimal;"
><li
>First</li
><li
@@ -320,7 +311,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{
></ol
><p
>Same thing but with paragraphs:</p
- ><ol class="decimal"
+ ><ol style="list-style-type: decimal;"
><li
><p
>First</p
@@ -366,7 +357,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{
></ul
><h2 id="fancy-list-markers"
>Fancy list markers</h2
- ><ol start="2" class="decimal"
+ ><ol start="2" style="list-style-type: decimal;"
><li
>begins with 2</li
><li
@@ -374,11 +365,11 @@ These should not be escaped: \$ \\ \&gt; \[ \{
>and now 3</p
><p
>with a continuation</p
- ><ol start="4" class="lower-roman"
+ ><ol start="4" style="list-style-type: lower-roman;"
><li
>sublist with roman numerals, starting with 4</li
><li
- >more items<ol class="upper-alpha"
+ >more items<ol style="list-style-type: upper-alpha;"
><li
>a subsublist</li
><li
@@ -390,13 +381,13 @@ These should not be escaped: \$ \\ \&gt; \[ \{
></ol
><p
>Nesting:</p
- ><ol class="upper-alpha"
+ ><ol style="list-style-type: upper-alpha;"
><li
- >Upper Alpha<ol class="upper-roman"
+ >Upper Alpha<ol style="list-style-type: upper-roman;"
><li
- >Upper Roman.<ol start="6" class="decimal"
+ >Upper Roman.<ol start="6" style="list-style-type: decimal;"
><li
- >Decimal start with 6<ol start="3" class="lower-alpha"
+ >Decimal start with 6<ol start="3" style="list-style-type: lower-alpha;"
><li
>Lower alpha with paren</li
></ol
@@ -674,7 +665,7 @@ Blah
>&lt;html&gt;</code
>.</p
><p
- ><span class="strikeout"
+ ><span style="text-decoration: line-through;"
>This is <em
>strikeout</em
>.</span
@@ -1075,7 +1066,7 @@ document.write('<a h'+'ref'+'="ma'+'ilto'+':'+e+'">'+'<code>'+e+'</code>'+'<\/'+
></a
></p
></blockquote
- ><ol class="decimal"
+ ><ol style="list-style-type: decimal;"
><li
>And in list items.<a href="#fn5" class="footnoteRef" id="fnref5"
><sup