diff options
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/Writers/MediaWiki.hs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/MediaWiki.hs b/src/Text/Pandoc/Writers/MediaWiki.hs index 513693389..d1912caa6 100644 --- a/src/Text/Pandoc/Writers/MediaWiki.hs +++ b/src/Text/Pandoc/Writers/MediaWiki.hs @@ -135,15 +135,22 @@ blockToMediaWiki (Header level _ inlines) = do let eqs = T.replicate level "=" return $ eqs <> " " <> contents <> " " <> eqs <> "\n" -blockToMediaWiki (CodeBlock (_,classes,_) str) = do +blockToMediaWiki (CodeBlock (_,classes,keyvals) str) = do let at = Set.fromList classes `Set.intersection` highlightingLangs + let numberLines = any (`elem` ["number","numberLines", "number-lines"]) + classes + let start = lookup "startFrom" keyvals return $ case Set.toList at of [] -> "<pre" <> (if null classes then ">" else " class=\"" <> T.unwords classes <> "\">") <> escapeText str <> "</pre>" - (l:_) -> "<source lang=\"" <> l <> "\">" <> str <> "</source>" + (l:_) -> "<syntaxhighlight lang=\"" <> l <> "\"" <> + (if numberLines then " line" else "") <> + maybe "" (\x -> " start=\"" <> x <> "\"") start <> + ">" <> str <> + "</syntaxhighlight>" -- note: no escape! even for <! blockToMediaWiki (BlockQuote blocks) = do |