mirror of
https://github.com/jgm/pandoc.git
synced 2026-08-24 09:16:43 +00:00
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
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user