git.iko.soy/typeable/pandoc
on master help sign in
MediaWiki reader: Support `<math>` tag.
commitb703c76540ebdfd026d4bd3c48bb3f03dd459d2b authorJohn MacFarlane <fiddlosopher@gmail.com> dateWed 12 Sep 2012, 19:54 (14 years ago) parentdef768c
3 files changed+11−2
src/Text/Pandoc/Readers/MediaWiki.hs+4−1 tests/mediawiki-reader.native+3−1 tests/mediawiki-reader.wiki+4
src/Text/Pandoc/Readers/MediaWiki.hs+4−1
@@ -39,7 +39,6 @@ _ support internal links http://www.mediawiki.org/wiki/Help:Links
3939_ support external links (partially implemented)
4040_ support images http://www.mediawiki.org/wiki/Help:Images
4141_ support tables http://www.mediawiki.org/wiki/Help:Tables
42−_ support <math> tag for latex math
4342_ raw mediawiki:
4443 _ templates or anything in {{}} (can be postprocessed)
4544 _ category links
@@ -259,6 +258,7 @@ inline = whitespace
259258 <|> strikeout
260259 <|> subscript
261260 <|> superscript
261+ <|> math
262262 <|> code
263263 <|> hask
264264 <|> B.singleton <$> charRef
@@ -320,6 +320,9 @@ superscript = B.superscript <$> inlinesInTags "sup"
320320subscript :: MWParser Inlines
321321subscript = B.subscript <$> inlinesInTags "sub"
322322
323+math :: MWParser Inlines
324+math = B.math <$> charsInTags "math"
325+
323326code :: MWParser Inlines
324327code = B.code <$> (charsInTags "code" <|> charsInTags "tt")
325328
tests/mediawiki-reader.native+3−1
@@ -129,4 +129,6 @@ Pandoc (Meta {docTitle = [], docAuthors = [], docDate = []})
129129 [[Plain [Str "five",Space,Str "sub",Space,Str "1"]
130130 ,OrderedList (1,DefaultStyle,DefaultDelim)
131131 [[Plain [Str "five",Space,Str "sub",Space,Str "1",Space,Str "sub",Space,Str "1"]]]]
132− ,[Plain [Str "five",Space,Str "sub",Space,Str "2"]]]]]]
132+ ,[Plain [Str "five",Space,Str "sub",Space,Str "2"]]]]]
133+,Header 2 [Str "math"]
134+,Para [Str "Here",Space,Str "is",Space,Str "some",Space,Math InlineMath "x=\\frac{y^\\pi}{z}",Str "."]]
tests/mediawiki-reader.wiki+4
@@ -189,3 +189,7 @@ ends the list.
189189### five sub 1 sub 1
190190## five sub 2
191191
192+== math ==
193+
194+Here is some <math>x=\frac{y^\pi}{z}</math>.
195+