mirror of
https://github.com/jgm/pandoc.git
synced 2026-09-24 15:44:59 +08:00
HTML Reader: Tests for 'tt' and 'code' elements (#8330).
tt is a deprecated element in HTML, but is still used in the wild in
some places, support reading it as just another 'code' element.
Commit 4abb9d0ad8 was originally
part of this PR as well.
This commit is contained in:
committed by
John MacFarlane
parent
4abb9d0ad8
commit
740396d1ed
@@ -662,7 +662,7 @@ inline = pTagText <|> do
|
||||
"img" -> pImage
|
||||
"svg" -> pSvg
|
||||
"bdo" -> pBdo
|
||||
"tt" -> pCode
|
||||
"tt" -> pCode
|
||||
"code" -> pCode
|
||||
"samp" -> pCodeWithClass "samp" "sample"
|
||||
"var" -> pCodeWithClass "var" "variable"
|
||||
|
||||
@@ -98,6 +98,18 @@ tests = [ testGroup "base tag"
|
||||
, test htmlNativeDivs "<main> followed by text" $ "<main>main content</main>non-main content" =?>
|
||||
doc (divWith ("", [], [("role", "main")]) (plain (text "main content")) <> plain (text "non-main content"))
|
||||
]
|
||||
, testGroup "code"
|
||||
[
|
||||
test html "inline code block" $
|
||||
"<code>Answer is 42</code>" =?>
|
||||
plain (codeWith ("",[],[]) "Answer is 42")
|
||||
]
|
||||
, testGroup "tt"
|
||||
[
|
||||
test html "inline tt block" $
|
||||
"<tt>Answer is 42</tt>" =?>
|
||||
plain (codeWith ("",[],[]) "Answer is 42")
|
||||
]
|
||||
, testGroup "samp"
|
||||
[
|
||||
test html "inline samp block" $
|
||||
|
||||
@@ -84,6 +84,11 @@ tests =
|
||||
doubleQuoted (spanWith ("", [], [("cite", "http://example.org")]) (str "examples"))
|
||||
=?> "<q cite=\"http://example.org\">examples</q>"
|
||||
]
|
||||
, testGroup "code"
|
||||
[ "code should be rendered correctly" =:
|
||||
plain (codeWith ("",[],[]) "Answer is 42") =?>
|
||||
"<code>Answer is 42</code>"
|
||||
]
|
||||
, testGroup "sample"
|
||||
[ "sample should be rendered correctly" =:
|
||||
plain (codeWith ("",["sample"],[]) "Answer is 42") =?>
|
||||
|
||||
Reference in New Issue
Block a user