From 4f2eac88aa1cd26d096a88450ad3ae929980e7a6 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 19 Nov 2021 09:05:19 -0800 Subject: MediaWiki writer: fix code for generating spans for header IDs. We need to generate a span when the header's ID doesn't match the one MediaWiki would generate automatically. But MediaWiki's generation scheme is different from ours (it uses uppercase letters, and `_` instead of `-`, for example). This means that in going from markdown -> mediawiki, we'll now get spans before almost every heading, unless explicit identifiers are used that correspond to the ones MediaWiki auto-generates. This is uglier output but it's necessary for internal links to work properly. See #7697. --- src/Text/Pandoc/Writers/MediaWiki.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Text/Pandoc') diff --git a/src/Text/Pandoc/Writers/MediaWiki.hs b/src/Text/Pandoc/Writers/MediaWiki.hs index e5e2dfde2..3954c62a6 100644 --- a/src/Text/Pandoc/Writers/MediaWiki.hs +++ b/src/Text/Pandoc/Writers/MediaWiki.hs @@ -130,7 +130,7 @@ blockToMediaWiki HorizontalRule = return "\n-----\n" blockToMediaWiki (Header level (ident,_,_) inlines) = do opts <- gets stOptions - let autoId = uniqueIdent (writerExtensions opts) inlines mempty + let autoId = T.replace " " "_" $ stringify inlines contents <- inlineListToMediaWiki inlines let eqs = T.replicate level "=" return $ -- cgit v1.2.3