jgm / pandoc

Universal markup converter
https://pandoc.org
Other
34.03k stars 3.35k forks source link

mediawiki --> markdown breaks links to other wiki pages #1983

Closed peterjc closed 9 years ago

peterjc commented 9 years ago

Simple example based on http://www.mediawiki.org/wiki/Help:Links using the three simplest link types:

$ echo "Internal link to [[Main Page]], also [[Main Page|different text]] works. Also [http://example.org external sites] possible." | pandoc -f mediawiki -t markdown
Internal link to [Main Page](Main Page "wikilink"), also [different
text](Main Page "wikilink") works. Also [external
sites](http://example.org) possible.

Where does this "wikilink" come from?

Expected output (assuming the other wiki pages will also be converted) might be as follows:

Internal link to [Main Page](Main_Page), also [different
text](Main_Page) works. Also [external sites](http://example.org)
possible.

This seems to work much better with for example RST output (see also #1982 for the space/underscore query):

$ echo "Internal link to [[Main Page]], also [[Main Page|different text]] works. Also [http://example.org external sites] possible." | pandoc -f mediawiki -t rst
Internal link to `Main Page <Main Page>`__, also `different
text <Main Page>`__ works. Also `external sites <http://example.org>`__
possible.

I am using the current release, on Mac OS X,

$ pandoc -v
pandoc 1.13.2
Compiled with texmath 0.8.0.1, highlighting-kate 0.5.11.1.
Syntax highlighting is supported for the following languages:
    abc, actionscript, ada, agda, apache, asn1, asp, awk, bash, bibtex, boo, c,
    changelog, clojure, cmake, coffee, coldfusion, commonlisp, cpp, cs, css,
    curry, d, diff, djangotemplate, dockerfile, dot, doxygen, doxygenlua, dtd,
    eiffel, email, erlang, fasm, fortran, fsharp, gcc, glsl, gnuassembler, go,
    haskell, haxe, html, ini, isocpp, java, javadoc, javascript, json, jsp,
    julia, latex, lex, lilypond, literatecurry, literatehaskell, lua, m4,
    makefile, mandoc, markdown, mathematica, matlab, maxima, mediawiki,
    metafont, mips, modelines, modula2, modula3, monobasic, nasm, noweb,
    objectivec, objectivecpp, ocaml, octave, opencl, pascal, perl, php, pike,
    postscript, prolog, pure, python, r, relaxng, relaxngcompact, rest, rhtml,
    roff, ruby, rust, scala, scheme, sci, sed, sgml, sql, sqlmysql,
    sqlpostgresql, tcl, tcsh, texinfo, verilog, vhdl, xml, xorg, xslt, xul,
    yacc, yaml, zsh
Default user data directory: /Users/peterjc/.pandoc
Copyright (C) 2006-2014 John MacFarlane
Web:  http://johnmacfarlane.net/pandoc
This is free software; see the source for copying conditions.
There is no warranty, not even for merchantability or fitness
for a particular purpose.
peterjc commented 9 years ago

Actually this is just a (harmless) URL title isn't it? I can just ignore it. Sorry for the noise.

jgm commented 9 years ago

+++ Peter Cock [Mar 01 15 03:09 ]:

Actually this is just a (harmless) URL title isn't it? I can just ignore it. Sorry for the noise.

Yes. The mediawiki reader inserts it so that writers can tell that the link is a wikilink. Some writers may want to handle wikilinks differently from other links.