diff options
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r-- | src/Text/Pandoc/Readers/HTML.hs | 27 |
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)) |