FixURL

Summary: Encode special characters in link addresses
Version: 20150722
Prerequisites: $EnableGUIButtons, PmWiki 2.2.79
Status: Beta
Maintainer: Petko
Categories: Editing, Links, PHP55, PHP72
Users: +3 (view / edit)
Discussion: FixURL-Talk
License: GPL2+

A GUIEdit button to encode special characters in link addresses.

Description

The PmWiki Links markup considers some characters special. Parentheses indicate for PmWiki a part of the address that shouldn't be displayed in the page, a vertical bar separates the link address from the link text, and quotes are used to set a tooltip title:

* [[(https://)www.pmwiki.org(/wiki/)]]
* [[https://www.pmwiki.org/"This is a tooltip title"|PmWiki]]

If a link address actually contains some of the characters <>"{}|\^`()[]', they need to be replaced by their percent-encoded value in the form %28 or %5B. This could be difficult or annoying for wiki editors.

* [[https://en.wikipedia.org/wiki/Wiki%20%28disambiguation%29 | Wiki (disambiguation)]] at Wikipedia.

The recipe installs a new button in the edit toolbar. While editing the page, select a URL address containing special characters and press the button to encode the special characters. The "encoded" address points to the same external page and works both in PmWiki and in all browsers.

The recipe is now installed on PmWiki.org, you can test it in the WikiSandbox.

Installation

PmWiki 2.2.119 or newer:

PmWiki 2.2.118 or older:

  • Copy fixurl.phpΔ to your pmwiki/cookbook directory.
  • Copy the button picture file to your pmwiki/pub/guiedit directory. IF you are using the EditToolbar recipe copy to your pmwiki/pub/edittoolbar directory..
  • Add to config.php such a line:
    if ($action == 'edit') include_once("$FarmD/cookbook/fixurl.php");

Configuration

International wikis can translate the tooltip title of the button, eg. in a French XLPage:

  'Encode special characters in URL link addresses' => "Codage de caractères spéciaux d'adresses URL"

Notes

  • $EnableGUIButtons needs to be set.
  • You need to select the text to be encoded -- if nothing is selected, the button does nothing.

Change log / Release notes

  • 20150722 - adapted for changes to guiedit.js since PmWiki 2.2.79.
  • 20111101 - first public release, ready to be tested.

See also

Contributors

  • Recipe written and maintained by Petko (5ko [snail] 5ko [period] fr).
  • If this recipe helps you or saves you time, you can help support its continued development by .

Comments

See discussion at FixURL-Talk

User notes +3: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.