aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2019-03-25 08:43:59 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2019-03-25 08:43:59 -0700
commit052684712b8a36854c622468f5d4ddd367199c1c (patch)
treed5bdf4faa964cbcfa18aaa7b9fab84b53bf49b22 /src/Text/Pandoc
parente91af0a8a32d68af4c533fdf4b7caaafade577ef (diff)
downloadpandoc-052684712b8a36854c622468f5d4ddd367199c1c.tar.gz
HTML reader: read `data-foo` attribute into `foo`.
The HTML writer adds the `data-` prefix for HTML5 for nonstandard attributes. But the attributes are represented in the AST without the `data-` prefix, so we should strip this when reading HTML. Closes #5392.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Readers/HTML.hs3
1 files changed, 2 insertions, 1 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