diff options
author | Amogh Rathore <amoghdroid09@gmail.com> | 2019-10-24 00:44:24 +0900 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2019-10-23 08:44:24 -0700 |
commit | d50f46d26d8584a03b775394de8878e028f8d8a4 (patch) | |
tree | 869c360311b2f615a4c8480f3e58759b13f34de9 /src | |
parent | b80bd174a23e17f5a5c656f51e8eac148abaf85d (diff) | |
download | pandoc-d50f46d26d8584a03b775394de8878e028f8d8a4.tar.gz |
Add Reader support for HTML <samp> element (#5843)
The `<samp>` element is parsed as a Span with class `sample`.
Closes #5792.
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/Readers/HTML.hs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs index a9a04c962..b6f88d3a9 100644 --- a/src/Text/Pandoc/Readers/HTML.hs +++ b/src/Text/Pandoc/Readers/HTML.hs @@ -652,6 +652,7 @@ inline = choice , pLink , pImage , pCode + , pSamp , pSpan , pMath False , pScriptMath @@ -781,6 +782,14 @@ pImage = do let kvs = concatMap getAtt ["width", "height", "sizes", "srcset"] return $ B.imageWith (uid, cls, kvs) (escapeURI url) title (B.text alt) +pSamp :: PandocMonad m => TagParser m Inlines +pSamp = try $ do + TagOpen open attr' <- pSatisfy $ tagOpen (=="samp") (const True) + result <- manyTill pAny (pCloses open) + let (ids,cs,kvs) = mkAttr . toStringAttr $ attr' + return . B.codeWith (ids,"sample":cs,kvs) . + unwords . lines . T.unpack . innerText $ result + pCode :: PandocMonad m => TagParser m Inlines pCode = try $ do (TagOpen open attr') <- pSatisfy $ tagOpen (`elem` ["code","tt"]) (const True) |