git.iko.soy/typeable/pandoc
on master help sign in
Added MediaWiki writer.

+ Added Text/Pandoc/Writers/MediaWiki.hs + Added to pandoc.cabal + Added to Main.hs and Text/Pandoc.hs exports. + Added tests for mediawiki writer & table writer. + Added information on MediaWiki writer to README. + Added mediawiki markup to list of formats in pandoc(1) man page. + Updated debian/control with mediawiki output format. + Added mediawiki markup to description in macports portfile. + Updated freebsd package description to include mediawiki format. + Mention MediaWiki output format in web page index. + Added mediawiki demo to website. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1337 788f1e2b-df1e-0410-8736-df70ead52e1b

commitddaec05d8f49308363c694718240bdaf58466659 authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> dateSun 27 Jul 2008, 03:25 (18 years ago) parent891e06d
15 files changed+1172−30
Main.hs+1 README+16−12 Text/Pandoc.hs+2 Text/Pandoc/Writers/MediaWiki.hs+394 debian/control+9−6 freebsd/pkg-descr+2−2 macports/Portfile.in+2−2 man/man1/pandoc.1.md+6−4 pandoc.cabal+3−1 tests/generate.sh+1 tests/runtests.pl+1−1 tests/tables.mediawiki+123 tests/writer.mediawiki+605 web/demos+4 web/index.txt.in+3−2
Main.hs+1
@@ -88,6 +88,7 @@ writers = [("native" , (writeDoc, ""))
8888 ,("man" , (writeMan, ""))
8989 ,("markdown" , (writeMarkdown, ""))
9090 ,("rst" , (writeRST, ""))
91+ ,("mediawiki" , (writeMediaWiki, ""))
9192 ,("rtf" , (writeRTF, defaultRTFHeader))
9293 ]
9394
README+16−12
@@ -6,9 +6,9 @@ Pandoc is a [Haskell] library for converting from one markup format to
66another, and a command-line tool that uses this library. It can read
77[markdown] and (subsets of) [reStructuredText], [HTML], and [LaTeX], and
88it can write [markdown], [reStructuredText], [HTML], [LaTeX], [ConTeXt],
9−[RTF], [DocBook XML], [OpenDocument XML], [GNU Texinfo], [groff man]
10−pages, and [S5] HTML slide shows. Pandoc's version of markdown contains
11−some enhancements, like footnotes and embedded LaTeX.
9+[RTF], [DocBook XML], [OpenDocument XML], [GNU Texinfo], [MediaWiki markup],
10+[groff man] pages, and [S5] HTML slide shows. Pandoc's version of
11+markdown contains some enhancements, like footnotes and embedded LaTeX.
1212
1313In contrast to existing tools for converting markdown to HTML, which
1414use regex substitutions, Pandoc has a modular design: it consists of a
@@ -26,6 +26,7 @@ or output format requires only adding a reader or writer.
2626[RTF]: http://en.wikipedia.org/wiki/Rich_Text_Format
2727[DocBook XML]: http://www.docbook.org/
2828[OpenDocument XML]: http://opendocument.xml.org/
29+[MediaWiki markup]: http://www.mediawiki.org/wiki/Help:Formatting
2930[groff man]: http://developer.apple.com/DOCUMENTATION/Darwin/Reference/ManPages/man7/groff_man.7.html
3031[Haskell]: http://www.haskell.org/
3132[GNU Texinfo]: http://www.gnu.org/software/texinfo/
@@ -73,15 +74,16 @@ To convert `hello.html` from html to markdown:
7374Supported output formats include `markdown`, `latex`, `context`
7475(ConTeXt), `html`, `rtf` (rich text format), `rst` (reStructuredText),
7576`docbook` (DocBook XML), `opendocument` (OpenDocument XML), `texinfo`,
76−`man` (groff man), and `s5` (which produces an HTML file that acts
77−like powerpoint). Supported input formats include `markdown`, `html`,
78−`latex`, and `rst`. Note that the `rst` reader only parses a subset of
79−reStructuredText syntax. For example, it doesn't handle tables, option
80−lists, or footnotes. But for simple documents it should be adequate. The
81−`latex` and `html` readers are also limited in what they can do. Because
82−the `html` reader is picky about the HTML it parses, it is recommended
83−that you pipe HTML through [HTML Tidy] before sending it to `pandoc`, or
84−use the `html2markdown` script described below.
77+`mediawiki` (MediaWiki markup), `man` (groff man), and `s5` (which
78+produces an HTML file that acts like powerpoint). Supported input
79+formats include `markdown`, `html`, `latex`, and `rst`. Note that the
80+`rst` reader only parses a subset of reStructuredText syntax. For
81+example, it doesn't handle tables, option lists, or footnotes. But for
82+simple documents it should be adequate. The `latex` and `html` readers
83+are also limited in what they can do. Because the `html` reader is picky
84+about the HTML it parses, it is recommended that you pipe HTML through
85+[HTML Tidy] before sending it to `pandoc`, or use the `html2markdown`
86+script described below.
8587
8688If you don't specify a reader or writer explicitly, `pandoc` will
8789try to determine the input and output format from the extensions of
@@ -927,6 +929,8 @@ In Texinfo output, it will be rendered inside a `@math` command.
927929
928930In groff man output, it will be rendered verbatim without $'s.
929931
932+In MediaWiki output, it will be rendered inside `<math>` tags.
933+
930934In RTF, Docbook, and OpenDocument output, it will be rendered, as far as
931935possible, using unicode characters, and will otherwise appear verbatim.
932936Unknown commands and symbols, and commands that cannot be dealt with
Text/Pandoc.hs+2
@@ -76,6 +76,7 @@ module Text.Pandoc
7676 , writeDocbook
7777 , writeOpenDocument
7878 , writeMan
79+ , writeMediaWiki
7980 , writeRTF
8081 , prettyPandoc
8182 -- * Writer options used in writers
@@ -105,6 +106,7 @@ import Text.Pandoc.Writers.Docbook
105106import Text.Pandoc.Writers.OpenDocument
106107import Text.Pandoc.Writers.Man
107108import Text.Pandoc.Writers.RTF
109+import Text.Pandoc.Writers.MediaWiki
108110import Text.Pandoc.DefaultHeaders
109111import Text.Pandoc.UTF8
110112import Text.Pandoc.Shared
Text/Pandoc/Writers/MediaWiki.hsnew file+394
@@ -0,0 +1,394 @@
1+{-
2+Copyright (C) 2008 John MacFarlane <jgm@berkeley.edu>
3+
4+This program is free software; you can redistribute it and/or modify
5+it under the terms of the GNU General Public License as published by
6+the Free Software Foundation; either version 2 of the License, or
7+(at your option) any later version.
8+
9+This program is distributed in the hope that it will be useful,
10+but WITHOUT ANY WARRANTY; without even the implied warranty of
11+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+GNU General Public License for more details.
13+
14+You should have received a copy of the GNU General Public License
15+along with this program; if not, write to the Free Software
16+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17+-}
18+
19+{- |
20+ Module : Text.Pandoc.Writers.MediaWiki
21+ Copyright : Copyright (C) 2006-7 John MacFarlane
22+ License : GNU GPL, version 2 or above
23+
24+ Maintainer : John MacFarlane <jgm@berkeley.edu>
25+ Stability : alpha
26+ Portability : portable
27+
28+Conversion of 'Pandoc' documents to MediaWiki markup.
29+
30+MediaWiki: <http://www.mediawiki.org/wiki/MediaWiki>
31+-}
32+module Text.Pandoc.Writers.MediaWiki ( writeMediaWiki ) where
33+import Text.Pandoc.Definition
34+import Text.Pandoc.Shared
35+import Text.Pandoc.XML ( escapeStringForXML )
36+import Data.List ( intersect )
37+import Network.URI ( isURI )
38+import Control.Monad.State
39+
40+data WriterState = WriterState {
41+ stNotes :: Bool -- True if there are notes
42+ , stListLevel :: [Char] -- String at beginning of list items, e.g. "**"
43+ , stUseTags :: Bool -- True if we should use HTML tags because we're in a complex list
44+ }
45+
46+-- | Convert Pandoc to MediaWiki.
47+writeMediaWiki :: WriterOptions -> Pandoc -> String
48+writeMediaWiki opts document =
49+ evalState (pandocToMediaWiki opts document)
50+ (WriterState { stNotes = False, stListLevel = [], stUseTags = False })
51+
52+-- | Return MediaWiki representation of document.
53+pandocToMediaWiki :: WriterOptions -> Pandoc -> State WriterState String
54+pandocToMediaWiki opts (Pandoc _ blocks) = do
55+ let before = writerIncludeBefore opts
56+ let after = writerIncludeAfter opts
57+ let head' = if writerStandalone opts
58+ then writerHeader opts
59+ else ""
60+ let toc = if writerTableOfContents opts
61+ then "__TOC__\n"
62+ else ""
63+ body <- blockListToMediaWiki opts blocks
64+ notesExist <- get >>= return . stNotes
65+ let notes = if notesExist
66+ then "\n== Notes ==\n<references />"
67+ else ""
68+ return $ head' ++ before ++ toc ++ body ++ after ++ notes
69+
70+-- | Escape special characters for MediaWiki.
71+escapeString :: String -> String
72+escapeString = escapeStringForXML
73+
74+-- | Convert Pandoc block element to MediaWiki.
75+blockToMediaWiki :: WriterOptions -- ^ Options
76+ -> Block -- ^ Block element
77+ -> State WriterState String
78+
79+blockToMediaWiki _ Null = return ""
80+
81+blockToMediaWiki opts (Plain inlines) =
82+ inlineListToMediaWiki opts inlines
83+
84+blockToMediaWiki opts (Para inlines) = do
85+ useTags <- get >>= return . stUseTags
86+ listLevel <- get >>= return . stListLevel
87+ contents <- inlineListToMediaWiki opts inlines
88+ return $ if useTags
89+ then "<p>" ++ contents ++ "</p>"
90+ else contents ++ if null listLevel then "\n" else ""
91+
92+blockToMediaWiki _ (RawHtml str) = return str
93+
94+blockToMediaWiki _ HorizontalRule = return "\n-----\n"
95+
96+blockToMediaWiki opts (Header level inlines) = do
97+ contents <- inlineListToMediaWiki opts inlines
98+ let eqs = replicate (level + 1) '='
99+ return $ eqs ++ " " ++ contents ++ " " ++ eqs ++ "\n"
100+
101+blockToMediaWiki _ (CodeBlock (_,classes,_) str) = do
102+ let at = classes `intersect` ["actionscript", "ada", "apache", "applescript", "asm", "asp",
103+ "autoit", "bash", "blitzbasic", "bnf", "c", "c_mac", "caddcl", "cadlisp", "cfdg", "cfm",
104+ "cpp", "cpp-qt", "csharp", "css", "d", "delphi", "diff", "div", "dos", "eiffel", "fortran",
105+ "freebasic", "gml", "groovy", "html4strict", "idl", "ini", "inno", "io", "java", "java5",
106+ "javascript", "latex", "lisp", "lua", "matlab", "mirc", "mpasm", "mysql", "nsis", "objc",
107+ "ocaml", "ocaml-brief", "oobas", "oracle8", "pascal", "perl", "php", "php-brief", "plsql",
108+ "python", "qbasic", "rails", "reg", "robots", "ruby", "sas", "scheme", "sdlbasic",
109+ "smalltalk", "smarty", "sql", "tcl", "", "thinbasic", "tsql", "vb", "vbnet", "vhdl",
110+ "visualfoxpro", "winbatch", "xml", "xpp", "z80"]
111+ let (beg, end) = if null at
112+ then ("<pre>", "</pre>")
113+ else ("<source lang=\"" ++ head at ++ "\">", "</source>")
114+ return $ beg ++ escapeString str ++ end
115+
116+blockToMediaWiki opts (BlockQuote blocks) = do
117+ contents <- blockListToMediaWiki opts blocks
118+ return $ "<blockquote>" ++ contents ++ "</blockquote>"
119+
120+blockToMediaWiki opts (Table caption aligns widths headers rows) = do
121+ let alignStrings = map alignmentToString aligns
122+ captionDoc <- if null caption
123+ then return ""
124+ else do
125+ c <- inlineListToMediaWiki opts caption
126+ return $ "<caption>" ++ c ++ "</caption>"
127+ colHeads <- colHeadsToMediaWiki opts alignStrings widths headers
128+ rows' <- mapM (tableRowToMediaWiki opts alignStrings) rows
129+ return $ "<table>\n" ++ captionDoc ++ colHeads ++ vcat rows' ++ "\n</table>"
130+
131+blockToMediaWiki opts x@(BulletList items) = do
132+ oldUseTags <- get >>= return . stUseTags
133+ let useTags = oldUseTags || not (isSimpleList x)
134+ if useTags
135+ then do
136+ modify $ \s -> s { stUseTags = True }
137+ contents <- mapM (listItemToMediaWiki opts) items
138+ modify $ \s -> s { stUseTags = oldUseTags }
139+ return $ "<ul>\n" ++ vcat contents ++ "</ul>\n"
140+ else do
141+ modify $ \s -> s { stListLevel = stListLevel s ++ "*" }
142+ contents <- mapM (listItemToMediaWiki opts) items
143+ modify $ \s -> s { stListLevel = init (stListLevel s) }
144+ return $ vcat contents
145+
146+blockToMediaWiki opts x@(OrderedList attribs items) = do
147+ oldUseTags <- get >>= return . stUseTags
148+ let useTags = oldUseTags || not (isSimpleList x)
149+ if useTags
150+ then do
151+ modify $ \s -> s { stUseTags = True }
152+ contents <- mapM (listItemToMediaWiki opts) items
153+ modify $ \s -> s { stUseTags = oldUseTags }
154+ return $ "<ol" ++ listAttribsToString attribs ++ ">\n" ++ vcat contents ++ "</ol>\n"
155+ else do
156+ modify $ \s -> s { stListLevel = stListLevel s ++ "#" }
157+ contents <- mapM (listItemToMediaWiki opts) items
158+ modify $ \s -> s { stListLevel = init (stListLevel s) }
159+ return $ vcat contents
160+
161+blockToMediaWiki opts x@(DefinitionList items) = do
162+ oldUseTags <- get >>= return . stUseTags
163+ let useTags = oldUseTags || not (isSimpleList x)
164+ if useTags
165+ then do
166+ modify $ \s -> s { stUseTags = True }
167+ contents <- mapM (definitionListItemToMediaWiki opts) items
168+ modify $ \s -> s { stUseTags = oldUseTags }
169+ return $ "<dl>\n" ++ vcat contents ++ "</dl>\n"
170+ else do
171+ modify $ \s -> s { stListLevel = stListLevel s ++ ";" }
172+ contents <- mapM (definitionListItemToMediaWiki opts) items
173+ modify $ \s -> s { stListLevel = init (stListLevel s) }
174+ return $ vcat contents
175+
176+-- Auxiliary functions for lists:
177+
178+-- | Convert ordered list attributes to HTML attribute string
179+listAttribsToString :: ListAttributes -> String
180+listAttribsToString (startnum, numstyle, _) =
181+ let numstyle' = camelCaseToHyphenated $ show numstyle
182+ in (if startnum /= 1
183+ then " start=\"" ++ show startnum ++ "\""
184+ else "") ++
185+ (if numstyle /= DefaultStyle
186+ then " style=\"list-style-type: " ++ numstyle' ++ ";\""
187+ else "")
188+
189+-- | Convert bullet or ordered list item (list of blocks) to MediaWiki.
190+listItemToMediaWiki :: WriterOptions -> [Block] -> State WriterState String
191+listItemToMediaWiki opts items = do
192+ contents <- blockListToMediaWiki opts items
193+ useTags <- get >>= return . stUseTags
194+ if useTags
195+ then return $ "<li>" ++ contents ++ "</li>"
196+ else do
197+ marker <- get >>= return . stListLevel
198+ return $ marker ++ " " ++ contents
199+
200+-- | Convert definition list item (label, list of blocks) to MediaWiki.
201+definitionListItemToMediaWiki :: WriterOptions
202+ -> ([Inline],[Block])
203+ -> State WriterState String
204+definitionListItemToMediaWiki opts (label, items) = do
205+ labelText <- inlineListToMediaWiki opts label
206+ contents <- blockListToMediaWiki opts items
207+ useTags <- get >>= return . stUseTags
208+ if useTags
209+ then return $ "<dt>" ++ labelText ++ "</dt>\n<dd>" ++ contents ++ "</dd>"
210+ else do
211+ marker <- get >>= return . stListLevel
212+ return $ marker ++ " " ++ labelText ++ "\n" ++ (init marker ++ ": ") ++ contents
213+
214+-- | True if the list can be handled by simple wiki markup, False if HTML tags will be needed.
215+isSimpleList :: Block -> Bool
216+isSimpleList x =
217+ case x of
218+ BulletList items -> all isSimpleListItem items
219+ OrderedList (num, sty, _) items -> all isSimpleListItem items &&
220+ num == 1 && sty `elem` [DefaultStyle, Decimal]
221+ DefinitionList items -> all isSimpleListItem $ map snd items
222+ _ -> False
223+
224+-- | True if list item can be handled with the simple wiki syntax. False if
225+-- HTML tags will be needed.
226+isSimpleListItem :: [Block] -> Bool
227+isSimpleListItem [] = True
228+isSimpleListItem [x] =
229+ case x of
230+ Plain _ -> True
231+ Para _ -> True
232+ BulletList _ -> isSimpleList x
233+ OrderedList _ _ -> isSimpleList x
234+ DefinitionList _ -> isSimpleList x
235+ _ -> False
236+isSimpleListItem [x, y] | isPlainOrPara x =
237+ case y of
238+ BulletList _ -> isSimpleList y
239+ OrderedList _ _ -> isSimpleList y
240+ DefinitionList _ -> isSimpleList y
241+ _ -> False
242+isSimpleListItem _ = False
243+
244+isPlainOrPara :: Block -> Bool
245+isPlainOrPara (Plain _) = True
246+isPlainOrPara (Para _) = True
247+isPlainOrPara _ = False
248+
249+tr :: String -> String
250+tr x = "<tr>\n" ++ x ++ "\n</tr>"
251+
252+-- | Concatenates strings with line breaks between them.
253+vcat :: [String] -> String
254+vcat [] = ""
255+vcat [x] = x
256+vcat (x:xs) = x ++ "\n" ++ vcat xs
257+
258+-- Auxiliary functions for tables:
259+
260+colHeadsToMediaWiki :: WriterOptions
261+ -> [[Char]]
262+ -> [Float]
263+ -> [[Block]]
264+ -> State WriterState String
265+colHeadsToMediaWiki opts alignStrings widths headers = do
266+ heads <- sequence $ zipWith3
267+ (\alignment columnwidth item -> tableItemToMediaWiki opts "th" alignment columnwidth item)
268+ alignStrings widths headers
269+ return $ tr $ vcat heads
270+
271+alignmentToString :: Alignment -> [Char]
272+alignmentToString alignment = case alignment of
273+ AlignLeft -> "left"
274+ AlignRight -> "right"
275+ AlignCenter -> "center"
276+ AlignDefault -> "left"
277+
278+tableRowToMediaWiki :: WriterOptions
279+ -> [[Char]]
280+ -> [[Block]]
281+ -> State WriterState String
282+tableRowToMediaWiki opts aligns columns =
283+ (sequence $ zipWith3 (tableItemToMediaWiki opts "td") aligns (repeat 0) columns) >>=
284+ return . tr . vcat
285+
286+tableItemToMediaWiki :: WriterOptions
287+ -> [Char]
288+ -> [Char]
289+ -> Float
290+ -> [Block]
291+ -> State WriterState String
292+tableItemToMediaWiki opts tag' align' width' item = do
293+ contents <- blockListToMediaWiki opts item
294+ let attrib = " align=\"" ++ align' ++ "\"" ++
295+ if width' /= 0
296+ then " style=\"width: " ++ (show (truncate (100 * width') :: Integer)) ++ "%;\""
297+ else ""
298+ return $ "<" ++ tag' ++ attrib ++ ">" ++ contents ++ "<" ++ tag' ++ ">"
299+
300+-- | Convert list of Pandoc block elements to MediaWiki.
301+blockListToMediaWiki :: WriterOptions -- ^ Options
302+ -> [Block] -- ^ List of block elements
303+ -> State WriterState String
304+blockListToMediaWiki opts blocks =
305+ mapM (blockToMediaWiki opts) blocks >>= return . vcat
306+
307+-- | Convert list of Pandoc inline elements to MediaWiki.
308+inlineListToMediaWiki :: WriterOptions -> [Inline] -> State WriterState String
309+inlineListToMediaWiki opts lst =
310+ mapM (inlineToMediaWiki opts) lst >>= return . concat
311+
312+-- | Convert Pandoc inline element to MediaWiki.
313+inlineToMediaWiki :: WriterOptions -> Inline -> State WriterState String
314+
315+inlineToMediaWiki opts (Emph lst) = do
316+ contents <- inlineListToMediaWiki opts lst
317+ return $ "''" ++ contents ++ "''"
318+
319+inlineToMediaWiki opts (Strong lst) = do
320+ contents <- inlineListToMediaWiki opts lst
321+ return $ "'''" ++ contents ++ "'''"
322+
323+inlineToMediaWiki opts (Strikeout lst) = do
324+ contents <- inlineListToMediaWiki opts lst
325+ return $ "<s>" ++ contents ++ "</s>"
326+
327+inlineToMediaWiki opts (Superscript lst) = do
328+ contents <- inlineListToMediaWiki opts lst
329+ return $ "<sup>" ++ contents ++ "</sup>"
330+
331+inlineToMediaWiki opts (Subscript lst) = do
332+ contents <- inlineListToMediaWiki opts lst
333+ return $ "<sub>" ++ contents ++ "</sub>"
334+
335+inlineToMediaWiki opts (SmallCaps lst) = inlineListToMediaWiki opts lst
336+
337+inlineToMediaWiki opts (Quoted SingleQuote lst) = do
338+ contents <- inlineListToMediaWiki opts lst
339+ return $ "&lsquo;" ++ contents ++ "&rsquo;"
340+
341+inlineToMediaWiki opts (Quoted DoubleQuote lst) = do
342+ contents <- inlineListToMediaWiki opts lst
343+ return $ "&ldquo;" ++ contents ++ "&rdquo;"
344+
345+inlineToMediaWiki _ EmDash = return "&mdash;"
346+
347+inlineToMediaWiki _ EnDash = return "&ndash;"
348+
349+inlineToMediaWiki _ Apostrophe = return "&rsquo;"
350+
351+inlineToMediaWiki _ Ellipses = return "&hellip;"
352+
353+inlineToMediaWiki _ (Code str) =
354+ return $ "<tt>" ++ (escapeString str) ++ "</tt>"
355+
356+inlineToMediaWiki _ (Str str) = return $ escapeString str
357+
358+inlineToMediaWiki _ (Math str) = return $ "<math>" ++ str ++ "</math>"
359+ -- note: str should NOT be escaped
360+
361+inlineToMediaWiki _ (TeX _) = return ""
362+
363+inlineToMediaWiki _ (HtmlInline str) = return str
364+
365+inlineToMediaWiki _ (LineBreak) = return "<br />\n"
366+
367+inlineToMediaWiki _ Space = return " "
368+
369+inlineToMediaWiki opts (Link txt (src, _)) = do
370+ link <- inlineListToMediaWiki opts txt
371+ let useAuto = txt == [Code src]
372+ let src' = if isURI src
373+ then src
374+ else if take 1 src == "/"
375+ then "http://{{SERVERNAME}}" ++ src
376+ else "http://{{SERVERNAME}}/" ++ src
377+ return $ if useAuto
378+ then src'
379+ else "[" ++ src' ++ " " ++ link ++ "]"
380+
381+inlineToMediaWiki opts (Image alt (source, tit)) = do
382+ alt' <- inlineListToMediaWiki opts alt
383+ let txt = if (null tit)
384+ then if null alt
385+ then ""
386+ else "|" ++ alt'
387+ else "|" ++ tit
388+ return $ "[[Image:" ++ source ++ txt ++ "]]"
389+
390+inlineToMediaWiki opts (Note contents) = do
391+ contents' <- blockListToMediaWiki opts contents
392+ modify (\s -> s { stNotes = True })
393+ return $ "<ref>" ++ contents' ++ "</ref>"
394+ -- note - may not work for notes with multiple blocks
debian/control+9−6
@@ -18,8 +18,9 @@ Description: general markup converter
1818 Pandoc is a Haskell library for converting from one markup format to
1919 another, and a command-line tool that uses this library. It can read
2020 markdown and (subsets of) reStructuredText, HTML, and LaTeX, and it
21− can write markdown, reStructuredText, HTML, LaTeX, ConTeXt, DocBook,
22− OpenDocument XML, RTF, GNU Texinfo, groff man pages, and S5 HTML slide shows.
21+ can write markdown, reStructuredText, HTML, LaTeX, ConTeXt, DocBook XML,
22+ OpenDocument XML, RTF, GNU Texinfo, MediaWiki markup, groff man pages,
23+ and S5 HTML slide shows.
2324 .
2425 Pandoc extends standard markdown syntax with footnotes, embedded LaTeX,
2526 tables, definition lists, and other features. A compatibility mode is
@@ -43,8 +44,9 @@ Description: general markup converter
4344 Pandoc is a Haskell library for converting from one markup format to
4445 another, and a command-line tool that uses this library. It can read
4546 markdown and (subsets of) reStructuredText, HTML, and LaTeX, and it
46− can write markdown, reStructuredText, HTML, LaTeX, ConTeXt, DocBook,
47− OpenDocument XML, RTF, GNU Texinfo, groff man pages, and S5 HTML slide shows.
47+ can write markdown, reStructuredText, HTML, LaTeX, ConTeXt, DocBook XML,
48+ OpenDocument XML, RTF, GNU Texinfo, MediaWiki markup, groff man pages,
49+ and S5 HTML slide shows.
4850 .
4951 Pandoc extends standard markdown syntax with footnotes, embedded LaTeX,
5052 tables, definition lists, and other features. A compatibility mode is
@@ -68,8 +70,9 @@ Description: general markup converter
6870 Pandoc is a Haskell library for converting from one markup format to
6971 another, and a command-line tool that uses this library. It can read
7072 markdown and (subsets of) reStructuredText, HTML, and LaTeX, and it
71− can write markdown, reStructuredText, HTML, LaTeX, ConTeXt, DocBook,
72− OpenDocument XML, RTF, GNU Texinfo, groff man pages, and S5 HTML slide shows.
73+ can write markdown, reStructuredText, HTML, LaTeX, ConTeXt, DocBook XML,
74+ OpenDocument XML, RTF, GNU Texinfo, MediaWiki markup, groff man pages,
75+ and S5 HTML slide shows.
7376 .
7477 Pandoc extends standard markdown syntax with footnotes, embedded LaTeX,
7578 tables, definition lists, and other features. A compatibility mode is
freebsd/pkg-descr+2−2
@@ -1,8 +1,8 @@
11Pandoc is a command-line tool for converting from one markup format
22to another. It can read markdown and (subsets of) reStructuredText,
33HTML, and LaTeX, and it can write markdown, reStructuredText, HTML,
4−LaTeX, ConTeXt, DocBook, OpenDocument XML, RTF, GNU Texinfo, groff man
5−pages, and S5 HTML slide shows.
4+LaTeX, ConTeXt, DocBook XML, OpenDocument XML, RTF, GNU Texinfo,
5+MediaWiki markup, groff man pages, and S5 HTML slide shows.
66
77Pandoc extends standard markdown syntax with footnotes, embedded LaTeX,
88and other features. A compatibility mode is provided for those who
macports/Portfile.in+2−2
@@ -11,8 +11,8 @@ long_description \
1111 Pandoc is a command-line tool for converting from one markup format \
1212 to another. It can read markdown and (subsets of) reStructuredText, \
1313 HTML, and LaTeX, and it can write markdown, reStructuredText, HTML, \
14− LaTeX, ConTeXt, DocBook, OpenDocument XML, RTF, Texinfo, groff man, \
15− and S5 HTML slide shows.
14+ LaTeX, ConTeXt, DocBook XML, OpenDocument XML, RTF, Texinfo, \
15+ MediaWiki markup, groff man, and S5 HTML slide shows.
1616
1717homepage http://johnmacfarlane.net/pandoc/
1818platforms darwin
man/man1/pandoc.1.md+6−4
@@ -15,7 +15,8 @@ pandoc [*options*] [*input-file*]...
1515Pandoc converts files from one markup format to another. It can
1616read markdown and (subsets of) reStructuredText, HTML, and LaTeX, and
1717it can write markdown, reStructuredText, HTML, LaTeX, ConTeXt, Texinfo,
18−groff man, RTF, OpenDocument XML, DocBook XML, and S5 HTML slide shows.
18+groff man, MediaWiki markup, RTF, OpenDocument XML, DocBook XML,
19+and S5 HTML slide shows.
1920
2021If no *input-file* is specified, input is read from STDIN.
2122Otherwise, the *input-files* are concatenated (with a blank
@@ -67,9 +68,10 @@ to Pandoc. Or use `html2markdown`(1), a wrapper around `pandoc`.
6768: Specify output format. *FORMAT* can be `native` (native Haskell),
6869 `markdown` (markdown or plain text), `rst` (reStructuredText),
6970 `html` (HTML), `latex` (LaTeX), `context` (ConTeXt), `man` (groff man),
70− `texinfo` (GNU Texinfo), `docbook` (DocBook XML),
71− `opendocument` (OpenDocument XML), `s5` (S5 HTML and javascript slide
72− show), or `rtf` (rich text format).
71+ `mediawiki` (MediaWiki markup), `texinfo` (GNU Texinfo),
72+ `docbook` (DocBook XML), `opendocument` (OpenDocument XML),
73+ `s5` (S5 HTML and javascript slide show),
74+ or `rtf` (rich text format).
7375
7476-s, \--standalone
7577: Produce output with an appropriate header and footer (e.g. a
pandoc.cabal+3−1
@@ -17,7 +17,8 @@ Description: Pandoc is a Haskell library for converting from one markup
1717 this library. It can read markdown and (subsets of)
1818 reStructuredText, HTML, and LaTeX, and it can write
1919 markdown, reStructuredText, HTML, LaTeX, ConTeXt, Docbook,
20− OpenDocument, RTF, groff man pages, and S5 HTML slide shows.
20+ OpenDocument, RTF, MediaWiki, groff man pages, and
21+ S5 HTML slide shows.
2122 .
2223 Pandoc extends standard markdown syntax with footnotes,
2324 embedded LaTeX, definition lists, tables, and other
@@ -71,6 +72,7 @@ Library
7172 Text.Pandoc.Writers.Man,
7273 Text.Pandoc.Writers.Markdown,
7374 Text.Pandoc.Writers.RST,
75+ Text.Pandoc.Writers.MediaWiki,
7476 Text.Pandoc.Writers.RTF,
7577 Text.Pandoc.Writers.S5
7678 Other-Modules: Text.Pandoc.XML
tests/generate.sh+1
@@ -8,6 +8,7 @@
88../pandoc -r native -s -w texinfo testsuite.native > writer.texinfo
99../pandoc -r native -s -w rtf testsuite.native > writer.rtf
1010../pandoc -r native -s -w man testsuite.native > writer.man
11+../pandoc -r native -s -w mediawiki testsuite.native > writer.mediawiki
1112sed -e '/^, Header 1 \[Str "HTML",Space,Str "Blocks"\]/,/^, HorizontalRule/d' testsuite.native | ../pandoc -r native -w docbook -s > writer.docbook
1213sed -e '/^, Header 1 \[Str "LaTeX"\]/,/^, HorizontalRule/d' testsuite.native | ../pandoc -r native -w context -s > writer.context
1314
tests/runtests.pl+1−1
@@ -14,7 +14,7 @@ unless (-x $script) { die "$script is not executable.\n"; }
1414
1515print "Writer tests:\n";
1616
17−my @writeformats = ("html", "latex", "texinfo", "rst", "rtf", "markdown", "man", "native"); # docbook, context, and s5 handled separately
17+my @writeformats = ("html", "latex", "texinfo", "rst", "rtf", "markdown", "mediawiki", "man", "native"); # docbook, context, and s5 handled separately
1818my $source = "testsuite.native";
1919
2020sub test_results
tests/tables.mediawikinew file+123
@@ -0,0 +1,123 @@
1+Simple table with caption:
2+
3+<table>
4+<caption>Demonstration of simple table syntax.</caption><tr>
5+<th align="right" style="width: 15%;">Right<th>
6+<th align="left" style="width: 8%;">Left<th>
7+<th align="center" style="width: 16%;">Center<th>
8+<th align="left" style="width: 12%;">Default<th>
9+</tr><tr>
10+<td align="right">12<td>
11+<td align="left">12<td>
12+<td align="center">12<td>
13+<td align="left">12<td>
14+</tr>
15+<tr>
16+<td align="right">123<td>
17+<td align="left">123<td>
18+<td align="center">123<td>
19+<td align="left">123<td>
20+</tr>
21+<tr>
22+<td align="right">1<td>
23+<td align="left">1<td>
24+<td align="center">1<td>
25+<td align="left">1<td>
26+</tr>
27+</table>
28+Simple table without caption:
29+
30+<table>
31+<tr>
32+<th align="right" style="width: 15%;">Right<th>
33+<th align="left" style="width: 8%;">Left<th>
34+<th align="center" style="width: 16%;">Center<th>
35+<th align="left" style="width: 12%;">Default<th>
36+</tr><tr>
37+<td align="right">12<td>
38+<td align="left">12<td>
39+<td align="center">12<td>
40+<td align="left">12<td>
41+</tr>
42+<tr>
43+<td align="right">123<td>
44+<td align="left">123<td>
45+<td align="center">123<td>
46+<td align="left">123<td>
47+</tr>
48+<tr>
49+<td align="right">1<td>
50+<td align="left">1<td>
51+<td align="center">1<td>
52+<td align="left">1<td>
53+</tr>
54+</table>
55+Simple table indented two spaces:
56+
57+<table>
58+<caption>Demonstration of simple table syntax.</caption><tr>
59+<th align="right" style="width: 15%;">Right<th>
60+<th align="left" style="width: 8%;">Left<th>
61+<th align="center" style="width: 16%;">Center<th>
62+<th align="left" style="width: 12%;">Default<th>
63+</tr><tr>
64+<td align="right">12<td>
65+<td align="left">12<td>
66+<td align="center">12<td>
67+<td align="left">12<td>
68+</tr>
69+<tr>
70+<td align="right">123<td>
71+<td align="left">123<td>
72+<td align="center">123<td>
73+<td align="left">123<td>
74+</tr>
75+<tr>
76+<td align="right">1<td>
77+<td align="left">1<td>
78+<td align="center">1<td>
79+<td align="left">1<td>
80+</tr>
81+</table>
82+Multiline table with caption:
83+
84+<table>
85+<caption>Here's the caption. It may span multiple lines.</caption><tr>
86+<th align="center" style="width: 15%;">Centered Header<th>
87+<th align="left" style="width: 13%;">Left Aligned<th>
88+<th align="right" style="width: 16%;">Right Aligned<th>
89+<th align="left" style="width: 33%;">Default aligned<th>
90+</tr><tr>
91+<td align="center">First<td>
92+<td align="left">row<td>
93+<td align="right">12.0<td>
94+<td align="left">Example of a row that spans multiple lines.<td>
95+</tr>
96+<tr>
97+<td align="center">Second<td>
98+<td align="left">row<td>
99+<td align="right">5.0<td>
100+<td align="left">Here's another one. Note the blank line between rows.<td>
101+</tr>
102+</table>
103+Multiline table without caption:
104+
105+<table>
106+<tr>
107+<th align="center" style="width: 15%;">Centered Header<th>
108+<th align="left" style="width: 13%;">Left Aligned<th>
109+<th align="right" style="width: 16%;">Right Aligned<th>
110+<th align="left" style="width: 33%;">Default aligned<th>
111+</tr><tr>
112+<td align="center">First<td>
113+<td align="left">row<td>
114+<td align="right">12.0<td>
115+<td align="left">Example of a row that spans multiple lines.<td>
116+</tr>
117+<tr>
118+<td align="center">Second<td>
119+<td align="left">row<td>
120+<td align="right">5.0<td>
121+<td align="left">Here's another one. Note the blank line between rows.<td>
122+</tr>
123+</table>
tests/writer.mediawikinew file+605
@@ -0,0 +1,605 @@
1+This is a set of tests for pandoc. Most of them are adapted from John Gruber&rsquo;s markdown test suite.
2+
3+
4+-----
5+
6+== Headers ==
7+
8+=== Level 2 with an [http://{{SERVERNAME}}/url embedded link] ===
9+
10+==== Level 3 with ''emphasis'' ====
11+
12+===== Level 4 =====
13+
14+====== Level 5 ======
15+
16+== Level 1 ==
17+
18+=== Level 2 with ''emphasis'' ===
19+
20+==== Level 3 ====
21+
22+with no blank line
23+
24+=== Level 2 ===
25+
26+with no blank line
27+
28+
29+-----
30+
31+== Paragraphs ==
32+
33+Here&rsquo;s a regular paragraph.
34+
35+In Markdown 1.0.0 and earlier. Version 8. This line turns into a list item. Because a hard-wrapped line in the middle of a paragraph looked like a list item.
36+
37+Here&rsquo;s one with a bullet. * criminey.
38+
39+There should be a hard line break<br />
40+here.
41+
42+
43+-----
44+
45+== Block Quotes ==
46+
47+E-mail style:
48+
49+<blockquote>This is a block quote. It is pretty short.
50+</blockquote>
51+<blockquote>Code in a block quote:
52+
53+<pre>sub status {
54+ print &quot;working&quot;;
55+}</pre>
56+A list:
57+
58+# item one
59+# item two
60+Nested block quotes:
61+
62+<blockquote>nested
63+</blockquote>
64+<blockquote>nested
65+</blockquote></blockquote>
66+This should not be a block quote: 2 &gt; 1.
67+
68+And a following paragraph.
69+
70+
71+-----
72+
73+== Code Blocks ==
74+
75+Code:
76+
77+<pre>---- (should be four hyphens)
78+
79+sub status {
80+ print &quot;working&quot;;
81+}
82+
83+this code block is indented by one tab</pre>
84+And:
85+
86+<pre> this code block is indented by two tabs
87+
88+These should not be escaped: \$ \\ \&gt; \[ \{</pre>
89+
90+-----
91+
92+== Lists ==
93+
94+=== Unordered ===
95+
96+Asterisks tight:
97+
98+* asterisk 1
99+* asterisk 2
100+* asterisk 3
101+Asterisks loose:
102+
103+* asterisk 1
104+* asterisk 2
105+* asterisk 3
106+Pluses tight:
107+
108+* Plus 1
109+* Plus 2
110+* Plus 3
111+Pluses loose:
112+
113+* Plus 1
114+* Plus 2
115+* Plus 3
116+Minuses tight:
117+
118+* Minus 1
119+* Minus 2
120+* Minus 3
121+Minuses loose:
122+
123+* Minus 1
124+* Minus 2
125+* Minus 3
126+=== Ordered ===
127+
128+Tight:
129+
130+# First
131+# Second
132+# Third
133+and:
134+
135+# One
136+# Two
137+# Three
138+Loose using tabs:
139+
140+# First
141+# Second
142+# Third
143+and using spaces:
144+
145+# One
146+# Two
147+# Three
148+Multiple paragraphs:
149+
150+<ol style="list-style-type: decimal;">
151+<li><p>Item 1, graf one.</p>
152+<p>Item 1. graf two. The quick brown fox jumped over the lazy dog&rsquo;s back.</p></li>
153+<li><p>Item 2.</p></li>
154+<li><p>Item 3.</p></li></ol>
155+
156+=== Nested ===
157+
158+* Tab
159+** Tab
160+*** Tab
161+Here&rsquo;s another:
162+
163+# First
164+# Second:
165+#* Fee
166+#* Fie
167+#* Foe
168+# Third
169+Same thing but with paragraphs:
170+
171+# First
172+# Second:
173+#* Fee
174+#* Fie
175+#* Foe
176+# Third
177+=== Tabs and spaces ===
178+
179+* this is a list item indented with tabs
180+* this is a list item indented with spaces
181+** this is an example list item indented with tabs
182+** this is an example list item indented with spaces
183+=== Fancy list markers ===
184+
185+<ol start="2" style="list-style-type: decimal;">
186+<li>begins with 2</li>
187+<li><p>and now 3</p>
188+<p>with a continuation</p>
189+<ol start="4" style="list-style-type: lower-roman;">
190+<li>sublist with roman numerals, starting with 4</li>
191+<li>more items
192+<ol style="list-style-type: upper-alpha;">
193+<li>a subsublist</li>
194+<li>a subsublist</li></ol>
195+</li></ol>
196+</li></ol>
197+
198+Nesting:
199+
200+<ol style="list-style-type: upper-alpha;">
201+<li>Upper Alpha
202+<ol style="list-style-type: upper-roman;">
203+<li>Upper Roman.
204+<ol start="6" style="list-style-type: decimal;">
205+<li>Decimal start with 6
206+<ol start="3" style="list-style-type: lower-alpha;">
207+<li>Lower alpha with paren</li></ol>
208+</li></ol>
209+</li></ol>
210+</li></ol>
211+
212+Autonumbering:
213+
214+# Autonumber.
215+# More.
216+## Nested.
217+Should not be a list item:
218+
219+M.A.&#160;2007
220+
221+B. Williams
222+
223+
224+-----
225+
226+== Definition Lists ==
227+
228+Tight using spaces:
229+
230+; apple
231+: red fruit
232+; orange
233+: orange fruit
234+; banana
235+: yellow fruit
236+Tight using tabs:
237+
238+; apple
239+: red fruit
240+; orange
241+: orange fruit
242+; banana
243+: yellow fruit
244+Loose:
245+
246+; apple
247+: red fruit
248+; orange
249+: orange fruit
250+; banana
251+: yellow fruit
252+Multiple blocks with italics:
253+
254+<dl>
255+<dt>''apple''</dt>
256+<dd><p>red fruit</p>
257+<p>contains seeds, crisp, pleasant to taste</p></dd>
258+<dt>''orange''</dt>
259+<dd><p>orange fruit</p>
260+<pre>{ orange code block }</pre>
261+<blockquote><p>orange block quote</p></blockquote></dd></dl>
262+
263+== HTML Blocks ==
264+
265+Simple block on one line:
266+
267+<div>
268+foo
269+</div>
270+
271+And nested without indentation:
272+
273+<div>
274+<div>
275+<div>
276+foo
277+</div>
278+</div>
279+<div>
280+bar
281+</div>
282+</div>
283+
284+Interpreted markdown in a table:
285+
286+<table>
287+<tr>
288+<td>
289+This is ''emphasized''
290+</td>
291+<td>
292+And this is '''strong'''
293+</td>
294+</tr>
295+</table>
296+
297+<script type="text/javascript">document.write('This *should not* be interpreted as markdown');</script>
298+
299+Here&rsquo;s a simple block:
300+
301+<div>
302+
303+foo
304+</div>
305+
306+This should be a code block, though:
307+
308+<pre>&lt;div&gt;
309+ foo
310+&lt;/div&gt;</pre>
311+As should this:
312+
313+<pre>&lt;div&gt;foo&lt;/div&gt;</pre>
314+Now, nested:
315+
316+<div>
317+ <div>
318+ <div>
319+
320+foo
321+</div>
322+ </div>
323+</div>
324+
325+This should just be an HTML comment:
326+
327+<!-- Comment -->
328+
329+Multiline:
330+
331+<!--
332+Blah
333+Blah
334+-->
335+
336+<!--
337+ This is another comment.
338+-->
339+
340+Code block:
341+
342+<pre>&lt;!-- Comment --&gt;</pre>
343+Just plain comment, with trailing spaces on the line:
344+
345+<!-- foo -->
346+
347+Code:
348+
349+<pre>&lt;hr /&gt;</pre>
350+Hr&rsquo;s:
351+
352+<hr>
353+
354+<hr />
355+
356+<hr />
357+
358+<hr>
359+
360+<hr />
361+
362+<hr />
363+
364+<hr class="foo" id="bar" />
365+
366+<hr class="foo" id="bar" />
367+
368+<hr class="foo" id="bar">
369+
370+
371+-----
372+
373+== Inline Markup ==
374+
375+This is ''emphasized'', and so ''is this''.
376+
377+This is '''strong''', and so '''is this'''.
378+
379+An ''[http://{{SERVERNAME}}/url emphasized link]''.
380+
381+'''''This is strong and em.'''''
382+
383+So is '''''this''''' word.
384+
385+'''''This is strong and em.'''''
386+
387+So is '''''this''''' word.
388+
389+This is code: <tt>&gt;</tt>, <tt>$</tt>, <tt>\</tt>, <tt>\$</tt>, <tt>&lt;html&gt;</tt>.
390+
391+<s>This is ''strikeout''.</s>
392+
393+Superscripts: a<sup>bc</sup>d a<sup>''hello''</sup> a<sup>hello&#160;there</sup>.
394+
395+Subscripts: H<sub>2</sub>O, H<sub>23</sub>O, H<sub>many&#160;of&#160;them</sub>O.
396+
397+These should not be superscripts or subscripts, because of the unescaped spaces: a^b c^d, a~b c~d.
398+
399+
400+-----
401+
402+== Smart quotes, ellipses, dashes ==
403+
404+&ldquo;Hello,&rdquo; said the spider. &ldquo;&lsquo;Shelob&rsquo; is my name.&rdquo;
405+
406+&lsquo;A&rsquo;, &lsquo;B&rsquo;, and &lsquo;C&rsquo; are letters.
407+
408+&lsquo;Oak,&rsquo; &lsquo;elm,&rsquo; and &lsquo;beech&rsquo; are names of trees. So is &lsquo;pine.&rsquo;
409+
410+&lsquo;He said, &ldquo;I want to go.&rdquo;&rsquo; Were you alive in the 70&rsquo;s?
411+
412+Here is some quoted &lsquo;<tt>code</tt>&rsquo; and a &ldquo;[http://example.com/?foo=1&bar=2 quoted link]&rdquo;.
413+
414+Some dashes: one&mdash;two &mdash; three&mdash;four &mdash; five.
415+
416+Dashes between numbers: 5&ndash;7, 255&ndash;66, 1987&ndash;1999.
417+
418+Ellipses&hellip;and&hellip;and&hellip;.
419+
420+
421+-----
422+
423+== LaTeX ==
424+
425+*
426+*
427+* <math>2+2=4</math>
428+* <math>x \in y</math>
429+* <math>\alpha \wedge \omega</math>
430+* <math>223</math>
431+* <math>p</math>-Tree
432+* <math>\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}</math>
433+* Here&rsquo;s one that has a line break in it: <math>\alpha + \omega \times x^2</math>.
434+These shouldn&rsquo;t be math:
435+
436+* To get the famous equation, write <tt>$e = mc^2$</tt>.
437+* $22,000 is a ''lot'' of money. So is $34,000. (It worked if &ldquo;lot&rdquo; is emphasized.)
438+* Shoes ($20) and socks ($5).
439+* Escaped <tt>$</tt>: $73 ''this should be emphasized'' 23$.
440+Here&rsquo;s a LaTeX table:
441+
442+
443+
444+
445+-----
446+
447+== Special Characters ==
448+
449+Here is some unicode:
450+
451+* I hat: Î
452+* o umlaut: ö
453+* section: §
454+* set membership: ∈
455+* copyright: ©
456+AT&amp;T has an ampersand in their name.
457+
458+AT&amp;T is another way to write it.
459+
460+This &amp; that.
461+
462+4 &lt; 5.
463+
464+6 &gt; 5.
465+
466+Backslash: \
467+
468+Backtick: `
469+
470+Asterisk: *
471+
472+Underscore: _
473+
474+Left brace: {
475+
476+Right brace: }
477+
478+Left bracket: [
479+
480+Right bracket: ]
481+
482+Left paren: (
483+
484+Right paren: )
485+
486+Greater-than: &gt;
487+
488+Hash: #
489+
490+Period: .
491+
492+Bang: !
493+
494+Plus: +
495+
496+Minus: -
497+
498+
499+-----
500+
501+== Links ==
502+
503+=== Explicit ===
504+
505+Just a [http://{{SERVERNAME}}/url/ URL].
506+
507+[http://{{SERVERNAME}}/url/ URL and title].
508+
509+[http://{{SERVERNAME}}/url/ URL and title].
510+
511+[http://{{SERVERNAME}}/url/ URL and title].
512+
513+[http://{{SERVERNAME}}/url/ URL and title]
514+
515+[http://{{SERVERNAME}}/url/ URL and title]
516+
517+[http://{{SERVERNAME}}/url/with_underscore with_underscore]
518+
519+[mailto:nobody@nowhere.net Email link]
520+
521+[http://{{SERVERNAME}}/ Empty].
522+
523+=== Reference ===
524+
525+Foo [http://{{SERVERNAME}}/url/ bar].
526+
527+Foo [http://{{SERVERNAME}}/url/ bar].
528+
529+Foo [http://{{SERVERNAME}}/url/ bar].
530+
531+With [http://{{SERVERNAME}}/url/ embedded [brackets]].
532+
533+[http://{{SERVERNAME}}/url/ b] by itself should be a link.
534+
535+Indented [http://{{SERVERNAME}}/url once].
536+
537+Indented [http://{{SERVERNAME}}/url twice].
538+
539+Indented [http://{{SERVERNAME}}/url thrice].
540+
541+This should [not][] be a link.
542+
543+<pre>[not]: /url</pre>
544+Foo [http://{{SERVERNAME}}/url/ bar].
545+
546+Foo [http://{{SERVERNAME}}/url/ biz].
547+
548+=== With ampersands ===
549+
550+Here&rsquo;s a [http://example.com/?foo=1&bar=2 link with an ampersand in the URL].
551+
552+Here&rsquo;s a link with an amersand in the link text: [http://att.com/ AT&amp;T].
553+
554+Here&rsquo;s an [http://{{SERVERNAME}}/script?foo=1&bar=2 inline link].
555+
556+Here&rsquo;s an [http://{{SERVERNAME}}/script?foo=1&bar=2 inline link in pointy braces].
557+
558+=== Autolinks ===
559+
560+With an ampersand: http://example.com/?foo=1&bar=2
561+
562+* In a list?
563+* http://example.com/
564+* It should.
565+An e-mail address: [mailto:nobody@nowhere.net <tt>nobody@nowhere.net</tt>]
566+
567+<blockquote>Blockquoted: http://example.com/
568+</blockquote>
569+Auto-links should not occur here: <tt>&lt;http://example.com/&gt;</tt>
570+
571+<pre>or here: &lt;http://example.com/&gt;</pre>
572+
573+-----
574+
575+== Images ==
576+
577+From &ldquo;Voyage dans la Lune&rdquo; by Georges Melies (1902):
578+
579+[[Image:lalune.jpg|Voyage dans la Lune]]
580+
581+Here is a movie [[Image:movie.jpg|movie]] icon.
582+
583+
584+-----
585+
586+== Footnotes ==
587+
588+Here is a footnote reference,<ref>Here is the footnote. It can go anywhere after the footnote reference. It need not be placed at the end of the document.
589+</ref> and another.<ref>Here&rsquo;s the long note. This one contains multiple blocks.
590+
591+Subsequent blocks are indented to show that they belong to the footnote (as with list items).
592+
593+<pre> { &lt;code&gt; }</pre>
594+If you want, you can indent every line, but you can also be lazy and just indent the first line of each block.
595+</ref> This should ''not'' be a footnote reference, because it contains a space.[^my note] Here is an inline note.<ref>This is ''easier'' to type. Inline notes may contain [http://google.com links] and <tt>]</tt> verbatim characters, as well as [bracketed text].
596+</ref>
597+
598+<blockquote>Notes can go in quotes.<ref>In quote.
599+</ref>
600+</blockquote>
601+# And in list items.<ref>In list.</ref>
602+This paragraph should not be part of the note, as it is not indented.
603+
604+== Notes ==
605+<references />
web/demos+4
@@ -102,3 +102,7 @@ click on the name of the output file:
102102
103103@ markdown2odt @@README@@ -o @@example21.odt@@
104104
105+22. MediaWiki markup:
106+
107+@ pandoc -s -S -w mediawiki --toc @@README@@ -o @@example22.wiki@@
108+
web/index.txt.in+3−2
@@ -6,8 +6,8 @@ Pandoc is a [Haskell] library for converting from one markup format
66to another, and a command-line tool that uses this library. It can read
77[markdown] and (subsets of) [reStructuredText], [HTML], and [LaTeX],
88and it can write [markdown], [reStructuredText], [HTML], [LaTeX], [ConTeXt],
9−[RTF], [DocBook XML], [OpenDocument XML], [GNU Texinfo], [groff man]
10−pages, and [S5] HTML slide shows.
9+[RTF], [DocBook XML], [OpenDocument XML], [GNU Texinfo], [MediaWiki markup],
10+[groff man] pages, and [S5] HTML slide shows.
1111
1212Pandoc features
1313
@@ -170,6 +170,7 @@ kind.
170170[RTF]: http://en.wikipedia.org/wiki/Rich_Text_Format
171171[DocBook XML]: http://www.docbook.org/
172172[OpenDocument XML]: http://opendocument.xml.org/
173+[MediaWiki markup]: http://www.mediawiki.org/wiki/Help:Formatting
173174[groff man]: http://developer.apple.com/DOCUMENTATION/Darwin/Reference/ManPages/man7/groff_man.7.html
174175[GNU Texinfo]: http://www.gnu.org/software/texinfo/
175176[Haskell]: http://www.haskell.org/