summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-07-21 22:54:40 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-07-21 22:54:40 +0000
commita2194f23dbc3251908a5cc20198a2b3fbad7b759 (patch)
tree3c72c444a495c9d9530bf5614ef387d82d21ccfc /src/Text/Pandoc/Readers
parent44b11214ba9edce73b0aad0b418a94b0c11f3b10 (diff)
Added support for Strikeout, Superscript, and Subscript to
HTML reader. Thanks to Bradley Sif for the patch for Strikeout (Issue #18). git-svn-id: https://pandoc.googlecode.com/svn/trunk@753 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r--src/Text/Pandoc/Readers/HTML.hs27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs
index 824f615c0..c7832fbf0 100644
--- a/src/Text/Pandoc/Readers/HTML.hs
+++ b/src/Text/Pandoc/Readers/HTML.hs
@@ -384,7 +384,9 @@ plain = do
inline = choice [ text, special ] <?> "inline"
-text = choice [ entity, strong, emph, code, str, linebreak, whitespace ] <?> "text"
+text = choice [ entity, strong, emph, superscript, subscript,
+ strikeout, spanStrikeout, code, str,
+ linebreak, whitespace ] <?> "text"
special = choice [ link, image, rawHtmlInline ] <?>
"link, inline html, or image"
@@ -416,6 +418,29 @@ emph = try (do
result <- choice [betweenTags "em", betweenTags "it"]
return (Emph result))
+superscript = try $ do
+ failIfStrict -- strict markdown has no superscript, so treat as raw HTML
+ result <- betweenTags "sup"
+ return (Superscript result)
+
+subscript = try $ do
+ failIfStrict -- strict markdown has no subscript, so treat as raw HTML
+ result <- betweenTags "sub"
+ return (Subscript result)
+
+strikeout = try $ do
+ failIfStrict -- strict markdown has no strikeout, so treat as raw HTML
+ result <- choice [betweenTags "s", betweenTags "strike"]
+ return (Strikeout result)
+
+spanStrikeout = try $ do
+ failIfStrict -- strict markdown has no strikeout, so treat as raw HTML
+ (tag, attributes) <- htmlTag "span"
+ result <- case (extractAttribute "class" attributes) of
+ Just "strikeout" -> inlinesTilEnd "span"
+ Nothing -> fail "not a strikeout"
+ return (Strikeout result)
+
strong = try (do
result <- choice [betweenTags "b", betweenTags "strong"]
return (Strong result))