Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

FixURL

Summary: Encode special characters in link addresses
Version: 20111101
Prerequisites:
Status: Beta
Maintainer: Petko
Categories: Editing Links
Users: +2 (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:

* [[(http://)www.pmwiki.org(/wiki/)]]
* [[http://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

  • Copy fixurl.phpΔ to your pmwiki/cookbook directory.
  • Copy the button picture file to your pmwiki/pub/guiedit 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

You need to select the text to be encoded -- if nothing is selected, the button does nothing.

Change log / Release notes

  • 20111101 - first public release, ready to be tested.

See also

Contributors

Recipe written and maintained by Petko. The FixSelectedURL() function is based on insMarkup() by Patrick Michaud.

Comments

See discussion at FixURL-Talk

User notes +2: 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.

Edit - History - Print - Recent Changes - Search
Page last modified on July 18, 2014, at 03:00 AM