User:Nathan Larson/Red-green-blue wikilinks

The red-green-blue project is a project to make wikilinks appear different colors depending on the pointed-to page's existence on the local wiki and on an external wiki.

Purpose
This tool will be useful for having articles whose wikilinks reference articles that may have been deleted from an external wiki (such as Wikipedia), or not yet added there. It will also be possible to use this tool to implement pure wiki deletion.

Specifications
This project involves making wikilinks appear differently, for instance as follows:
 * Red link – page exists neither on the local wiki, nor on the external wiki
 * Orange link – blanked page exists on the local wiki; no page with this title exists on the external wiki
 * Yellow link – page does not exist on this wiki; blanked page exists on the external wiki
 * Green link – page does not exist on this wiki, but it exists on the external wiki
 * Blue link – page exists on this wiki, but it does not exist on the external wiki
 * Indigo link – blanked page exists on both the local wiki and the external wiki
 * Purple link – page exists on both this wiki and the external wiki

(The current scheme, of course, is a blue link if the page exists on this wiki and a red link if it does not.)

Other colors may be used as well to indicate that a page used to exist, but was deleted; etc. This is not as high a priority, however.

Customization

 * Legible and differentiable colors should be set as defaults, and it should be possible to modify the defaults, and for each user to modify the color scheme in their user preferences.
 * It should be possible to configure the system so that wikilink color will reveal page existence on more than one other external wiki in addition to the local wiki; or based on two or more external wikis without regard to the local wiki; or based on only one external wiki without regard to the local wiki.
 * It should be possible to define "blanked" in various ways. For instance, having no content might cause a page to be considered blanked; or being in or another category defined by the admin might cause it to be considered blanked.

Behavior of a clicked wikilink
The behavior of a clicked wikilink can vary based on user preferences. Obviously, an orange or blue clicked wikilink will go to the corresponding page on this wiki; and a green clicked wikilink will go to the corresponding page on the external wiki. A red clicked wikilink, presumably, will default to create a new article on this wiki; although the user might specify that it could default to create a new article on the external wiki, or that it could ask the user where he wants to create a new article.

Any number of possibilities exist for purple clicked wikilinks, e.g.:
 * Visit the corresponding page on the external wiki
 * Visit the corresponding page on the local wiki
 * Ask the user whether he wants to visit the corresponding page on the external or on the local wiki
 * Visit the longer of the two pages (presumably the longer page has more developed content)

Implementation
A list of all pages on an external wiki will likely need to be established and maintained in current status. In parsing the wikilinks in a page, the name will be checked against the list of pages on the local wiki and against the list of pages on the external wiki. The color will be set accordingly.

It is crucial that the implementation not put excess load on the server of the remote wiki. I.e., it must not access the remote wiki every time a page is loaded that needs to detect the presence of pages on the remote wiki. This is the reason for using the list of all pages on an external wiki – so that checks can be made against that list instead of against the external wiki directly.