aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2019-01-25 17:10:49 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2019-01-25 17:10:49 -0800
commita5ac58f82fbcad86d62b3fb66188635b9763b961 (patch)
treef26fea04ffda413d82ecb9ffd1148388bea59961 /src/Text/Pandoc
parent2e7cfe1bbaa522fda0f79ecc6e5fb4ea3653f2d6 (diff)
downloadpandoc-a5ac58f82fbcad86d62b3fb66188635b9763b961.tar.gz
MediaWiki reader: use `_` instead of `-` in auto-identifiers.
Partially addresses #4731. We may not still be exactly matching mediawiki's algorithm for identifiers.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Readers/MediaWiki.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/MediaWiki.hs b/src/Text/Pandoc/Readers/MediaWiki.hs
index c7a3bcfc7..d7f52c697 100644
--- a/src/Text/Pandoc/Readers/MediaWiki.hs
+++ b/src/Text/Pandoc/Readers/MediaWiki.hs
@@ -411,9 +411,14 @@ header = try $ do
lev <- length <$> many1 (char '=')
guard $ lev <= 6
contents <- trimInlines . mconcat <$> manyTill inline (count lev $ char '=')
- attr <- registerHeader nullAttr contents
+ attr <- modifyIdentifier <$> registerHeader nullAttr contents
return $ B.headerWith attr lev contents
+-- See #4731:
+modifyIdentifier :: Attr -> Attr
+modifyIdentifier (ident,cl,kv) = (ident',cl,kv)
+ where ident' = map (\c -> if c == '-' then '_' else c) ident
+
bulletList :: PandocMonad m => MWParser m Blocks
bulletList = B.bulletList <$>
( many1 (listItem '*')