aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers/HTML.hs
diff options
context:
space:
mode:
authorTristan de Cacqueray <tdecacqu@redhat.com>2020-04-11 16:57:59 +0000
committerGitHub <noreply@github.com>2020-04-11 09:57:59 -0700
commitdd06d6354081f478e99d864ac4343896ec887eda (patch)
tree527ccd7661459995cc26693fbec96689cb607b18 /src/Text/Pandoc/Readers/HTML.hs
parent61f666a88f5195db09f140c5650973d71e49006a (diff)
downloadpandoc-dd06d6354081f478e99d864ac4343896ec887eda.tar.gz
HTML reader: support <bdo> (#6271)
See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/bdo Closes #5794
Diffstat (limited to 'src/Text/Pandoc/Readers/HTML.hs')
-rw-r--r--src/Text/Pandoc/Readers/HTML.hs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs
index 6cfef0ebe..798661fe3 100644
--- a/src/Text/Pandoc/Readers/HTML.hs
+++ b/src/Text/Pandoc/Readers/HTML.hs
@@ -648,6 +648,7 @@ inline = choice
, pLineBreak
, pLink
, pImage
+ , pBdo
, pCode
, pCodeWithClass [("samp","sample"),("var","variable")]
, pSpan
@@ -802,6 +803,18 @@ pCode = try $ do
result <- manyTill pAny (pCloses open)
return $ B.codeWith (mkAttr attr) $ T.unwords $ T.lines $ innerText result
+-- https://developer.mozilla.org/en-US/docs/Web/HTML/Element/bdo
+-- Bidirectional Text Override
+pBdo :: PandocMonad m => TagParser m Inlines
+pBdo = try $ do
+ TagOpen _ attr' <- lookAhead $ pSatisfy $ tagOpen (=="bdo") (const True)
+ let attr = toStringAttr attr'
+ contents <- pInTags "bdo" inline
+ return $ case lookup "dir" attr of
+ -- Only bdo with a direction matters
+ Just dir -> B.spanWith ("", [], [("dir",T.toLower dir)]) contents
+ Nothing -> contents
+
pSpan :: PandocMonad m => TagParser m Inlines
pSpan = try $ do
guardEnabled Ext_native_spans