diff options
-rw-r--r-- | src/Text/Pandoc/Readers/HTML.hs | 3 | ||||
-rw-r--r-- | test/Tests/Readers/HTML.hs | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs index 45af20ca8..dfc31f7af 100644 --- a/src/Text/Pandoc/Readers/HTML.hs +++ b/src/Text/Pandoc/Readers/HTML.hs @@ -807,7 +807,8 @@ mathMLToTeXMath s = writeTeX <$> readMathML s toStringAttr :: [(Text, Text)] -> [(String, String)] toStringAttr = map go - where go (x,y) = (T.unpack x, T.unpack y) + where go (x,y) = (T.unpack (fromMaybe x $ T.stripPrefix "data-" x), + T.unpack y) pScriptMath :: PandocMonad m => TagParser m Inlines pScriptMath = try $ do diff --git a/test/Tests/Readers/HTML.hs b/test/Tests/Readers/HTML.hs index 69078d955..be5178e07 100644 --- a/test/Tests/Readers/HTML.hs +++ b/test/Tests/Readers/HTML.hs @@ -83,7 +83,7 @@ tests = [ testGroup "base tag" , test htmlNativeDivs "<main role=X> becomes <div role=X>" $ "<main role=foobar>hello</main>" =?> doc (divWith ("", [], [("role", "foobar")]) (plain (text "hello"))) , test htmlNativeDivs "<main> has attributes preserved" $ "<main id=foo class=bar data-baz=qux>hello</main>" =?> - doc (divWith ("foo", ["bar"], [("role", "main"), ("data-baz", "qux")]) (plain (text "hello"))) + doc (divWith ("foo", ["bar"], [("role", "main"), ("baz", "qux")]) (plain (text "hello"))) , test htmlNativeDivs "<main> closes <p>" $ "<p>hello<main>main content</main>" =?> doc (para (text "hello") <> divWith ("", [], [("role", "main")]) (plain (text "main content"))) , test htmlNativeDivs "<main> followed by text" $ "<main>main content</main>non-main content" =?> |