Skip to content

Mediawiker protocol handler

tosher edited this page Apr 21, 2014 · 4 revisions

Table of Contents

Register protocol in mediawiki

Add line to LocalSettings.php

$wgUrlProtocols[] = "mediawiker://";

After that we can, for example:

Add link to sidebar:

mediawiker://{{FULLPAGENAMEE}}|Edit in Sublime

Windows

Create mediawiker.reg file:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\mediawiker]
@="URL:mediawiker Protocol"
"URL Protocol"=""

[HKEY_CLASSES_ROOT\mediawiker\shell]

[HKEY_CLASSES_ROOT\mediawiker\shell\open]

[HKEY_CLASSES_ROOT\mediawiker\shell\open\command]
@="PATH_TO_SUBLIME_DIR\\sublime_text.exe --command \"mediawiker_cli {\\\"url\\\": \\\"%1\\\"}\""

And run it.

Linux (Ubuntu)

Create a .desktop file

  • /usr/share/applications/mediawiker.desktop
[Desktop Entry]
Name=Sublime Text Mediawiker Scheme Handler
GenericName=Text Editor
Comment=Handle Mediawiker Scheme mediawiker://
Exec=/home/your_username/mediawiker_handler %u
Terminal=false
Type=Application
MimeType=x-scheme-handler/mediawiker;
Icon=sublime-text
Categories=TextEditor;Development;Utility;
Name[en_US]=Sublime Text Mediawiker Scheme Handler

Don’t forget to replace your_username with the good one.

Update the MIME-types database

sudo update-desktop-database

Create the mediawiker-handler file

  • ~/bin/mediawiker-handler
#!/usr/bin/env bash

/opt/sublime_text/sublime_text --command "mediawiker_cli {\"url\": \"$1\"}"
chmod +x mediawiker-handler

Firefox

Click on mediawiker:// link and select mediawiker_handler as application

Crome/Chromium

sudo xdg-mime default mediawiker-handler.desktop x-scheme-handler/mediawiker

Must works after click on mediawiker:// link.

Clone this wiki locally