mirror of
https://github.com/jgm/pandoc.git
synced 2026-08-28 17:20:47 +08:00
MediaWiki: better handling of inline tags.
`<mark>`, `<var>`, `<samp>`, and `<kbd>` now produce Code or Span elements with classes, which can be handled by multiple output formats, instead of simply being parsed as raw HTML tags. Closes #11299.
This commit is contained in:
@@ -659,6 +659,10 @@ inlineTag = do
|
||||
TagOpen "del" _ -> B.strikeout <$> inlinesInTags "del"
|
||||
TagOpen "sub" _ -> B.subscript <$> inlinesInTags "sub"
|
||||
TagOpen "sup" _ -> B.superscript <$> inlinesInTags "sup"
|
||||
TagOpen "var" _ -> B.codeWith ("",["variable"],[]) <$> textInTags "var"
|
||||
TagOpen "samp" _ -> B.codeWith ("",["sample"],[]) <$> textInTags "samp"
|
||||
TagOpen "kbd" _ -> B.spanWith ("",["kbd"],[]) <$> inlinesInTags "kbd"
|
||||
TagOpen "mark" _ -> B.spanWith ("",["mark"],[]) <$> inlinesInTags "mark"
|
||||
TagOpen "code" _ -> encode <$> inlinesInTags "code"
|
||||
TagOpen "tt" _ -> do
|
||||
inTT <- mwInTT <$> getState
|
||||
|
||||
+23
-1
@@ -1,6 +1,28 @@
|
||||
```
|
||||
% pandoc -f mediawiki -t native
|
||||
<foo>
|
||||
|
||||
<samp>x</samp>
|
||||
|
||||
<kbd>x</kbd>
|
||||
|
||||
<var>x</var>
|
||||
|
||||
<mark>This is ''highlighted''</mark>
|
||||
^D
|
||||
[ Para [ Str "<foo>" ] ]
|
||||
[ Para [ Str "<foo>" ]
|
||||
, Para [ Code ( "" , [ "sample" ] , [] ) "x" ]
|
||||
, Para [ Span ( "" , [ "kbd" ] , [] ) [ Str "x" ] ]
|
||||
, Para [ Code ( "" , [ "variable" ] , [] ) "x" ]
|
||||
, Para
|
||||
[ Span
|
||||
( "" , [ "mark" ] , [] )
|
||||
[ Str "This"
|
||||
, Space
|
||||
, Str "is"
|
||||
, Space
|
||||
, Emph [ Str "highlighted" ]
|
||||
]
|
||||
]
|
||||
]
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user