Manual:External editors

From MediaWiki.org
Jump to: navigation, search
Language: English  • Deutsch • español • français • italiano • português do Brasil • 中文(简体)‎


MediaWiki 1.5 to 1.21 allows you to edit any resource using any external tool. This is accomplished using a very simple system:

  1. When a resource is requested for being edited externally, MediaWiki sends out a control file that contains information about the resource; most importantly, its network location (URL) and the interface that is to be used for changing it. See Manual:External editors: control files for the specifications.
  2. User browser has to be configured to call a special helper application (see below).
  3. That helper application processes the control file, retrieves the resource, launches the favored application to edit it, and, if desired, saves the resource back to the server.
This feature is only for using external programs to seamlessly edit content. You can still manually download content and then reupload content after editing with an external program
Editing an image with Inkscape
Editing a wiki page using KWrite

Starting external editing

In your personal MediaWiki preferences you can set up external editing as a default edit action: Preferences → Editing → "Use external editor by default".

However a more practical approach is to add this as an extra option, using the special externaledit=true MediaWiki URL parameter.

  • You can make the "external edit link" appear on all pages next to the usual edit link by adding an External editor script to your .js file.
  • Or you can set up a special bookmarklet in your browser: create a new bookmark/favorite and copy this into the URL field:
javascript:location=location+'?action=edit&externaledit=true';


Configure your browser

You have to configure your browser so that the MIME type application/x-external-editor is associated with your helper application.

  • Make application/x-external-editor files be opened by the script ee.pl. Instructions for Firefox.
    Also, on FreeBSD and Linux you can edit /etc/mailcap (or ~/.mailcap):
    application/x-external-editor;/usr/bin/ee.pl %s
  • Opera: via Tools→Preferences→Advanced→Downloads→Add
  • For Internet Explorer and Google Chrome you can try to associate the helper application with the .php file extension

Helper application

ee.pl

There is a reference implementation for the helper application called ee.pl (available here, see README for usage and INSTALL for setup instructions). It is written in Perl and may be difficult to set up. However, it provides a complete set of features. Developers are welcome to write a more user friendly implementation. You may also need Windows XP or Ubuntu tips.

Note that the ee.pl GUI makes it very easy to save the data back to the server, including an edit summary, or to cancel the edit. You can also make multiple edits on the server by using the "Save and continue" button.

Please make sure you are using the latest version of the script if it is not working as expected.

For each wiki you want to use ee.pl with, add an entry like this to ee.ini:

[MediaWiki]
URL match=//www.mediawiki.org/w
Username=(MyUsername)
Password=(MyPassword)

This is necessary so people can log in – it does not know your password otherwise! Note that if you are active on many wikis, such as multiple Wikipedia languages editions, and you use the same username and password, you can simply use something like "wikipedia.org" or "wikimedia.org" with this authentication information as the URL match pattern (or indeed ".org" if you only intend to access these sites). An example generic entry:

[Generic]
URL match=edia.org
Username=(MyUsername)
Password=(MyPassword)

Less is more! Just using URL match= meta or URL match= commons is sufficient, whereas adding the whole URL often causes an error.

If you want to edit files, you need to use something like URL match=upload.wikimedia.org because files are on that host.

XExternalEdit

XExternalEdit is a helper application written in java, with a graphical user interface. See http://sourceforge.net/projects/xexternaleditor/ for more information.

Alternatives

Several Mozilla Firefox extensions provide another way to use external text editors, see Wikipedia:Text editor support. Particularly, for Linux users, the use of It's All Text is a much simpler procedure to invoke an external editor than that described above (particularly when some helper applications such as ee.pl, written in Perl, "may be difficult to set up").