This contains information about "extended" links on Everything web sites.
Overview of Extended Links
Extended links allow a user to create more specific links than the normal text-only links.
Both old-style links and these links are denoted by enclosing text in square brackets, [
and ]
although extended links are indicated by having a pipe character, |
, as the first character of the link, which becomes: [|
stuff]
.
Old-style links are in the form [
link]
or [
link|
display]
, where link is the node title to link to, and display is the (optional) text to display as the link instead.
Extended links are in the form [|
special]
or [|
special|
link]
or [|
special|
link|
display]
, in which special modifies the link by adding more detailed information.
Test Examples
This is an example of a testing table generated by the included test program bettertest.pl
.
In some browsers, when you hover the mouse over a link, the link's destination is displayed.
Note the relative links in this table won't actually go anywhere, since this isn't an Everything-engine based site.
text link | correct tip | correct display | correct link | result | correct? | comment |
---|---|---|---|---|---|---|
[normal] | [normal] | normal | ?node=normal | normal | yes | normal link |
[link here|show this] | [link here] | show this | ?node=link+here | show this | yes | normal pipe link |
[|node_id=9740] | id:9740 | id:9740 | ?node_id=9740 | id:9740 | yes | link to a specific node |
[|node_id=9740||N-Wing] | id:9740 | N-Wing | ?node_id=9740 | N-Wing | yes | link to a specific node and show alternate text |
[|type=user|N-Wing] | [N-Wing] (user) | N-Wing | ?node=N-Wing&type=user | N-Wing | yes | specifies which type wanted |
[|type=user&node=N-Wing] | [N-Wing] (user) | N-Wing | ?node=N-Wing&type=user | N-Wing | yes | all link information created from extended part of link |
[|node_id=9740|weirdo] | id:9740 | id:9740 | ?node_id=9740 | id:9740 | yes | this is an improper link since the node_id has priority over node's title; the resultant link will just drop the weirdo part, since it would be ignored anyway |
[|node_id=9740||weirdo] | id:9740 | weirdo | ?node_id=9740 | weirdo | yes | this is probably what the link creator of the previous example meant to do |
[|node=N-Wing&type=user|weirdo] | [N-Wing] (user) | N-Wing | ?node=N-Wing&type=user | N-Wing | yes | another improper link: the weirdo value is ignored, since the node's name is already set in the extended part of the link, which has priority |
[|node=weirdo&node=N-Wing] | [N-Wing] | N-Wing | ?node=N-Wing | N-Wing | yes | if key is repeated, the last valid one listed is set |
[|node_id=yeow] | yes | if node_id doesn't match /^[1-9]\d*$/, and no other information is given, it is invalid, so don't try linking | ||||
[|op=logout||trying to log you out] | yes | op is not an allowed key, so no link is formed | ||||
[|type=nodelet|other users] | [other users] (nodelet) | other users | ?node=other+users&type=nodelet | other users | yes | |
[|site=pm|N-Wing] | (Perl Monks) [N-Wing] | N-Wing | http://www.perlmonks.org/?node=N-Wing | N-Wing | yes | node N-Wing on Perl Monks |
[|site=e2&type=user|N-Wing] | (Everything 2) [N-Wing] (user) | N-Wing | http://www.everything2.com/?node=N-Wing&type=user | N-Wing | yes | N-Wing's homenode on Everything 2 |
[|site=jj&node=N-Wing] | (Java Junkies) [N-Wing] | N-Wing | http://www.javajunkies.org/?node=N-Wing | N-Wing | yes | node N-Wing on Java Junkies |
[|site=cpan|CGI] | (CPAN) [CGI] | CGI | http://search.cpan.org/search?mode=modules&query=CGI | CGI | yes | off-site link |
[|site=cpan&node=CGI] | (CPAN) [CGI] | CGI | http://search.cpan.org/search?mode=modules&query=CGI | CGI | yes | off-site link |
[|site=cpan&node=CGI||CGI (on CPAN)] | (CPAN) [CGI] | CGI (on CPAN) | http://search.cpan.org/search?mode=modules&query=CGI | CGI (on CPAN) | yes | off-site link with alternate display |
[|site=cpan|CGI|CGI (on CPAN)] | (CPAN) [CGI] | CGI (on CPAN) | http://search.cpan.org/search?mode=modules&query=CGI | CGI (on CPAN) | yes | off-site link with alternate display |
[id://9740] | id:9740 | id:9740 | ?node_id=9740 | id:9740 | yes | old-style way of linking to a node_id |
[id://9740|weirdo] | id:9740 | weirdo | ?node_id=9740 | weirdo | yes | old-style way of linking to a node_id, with a pipe link giving display text |
[cpan://CGI] | (CPAN) [CGI] | CGI | http://search.cpan.org/search?mode=modules&query=CGI | CGI | yes | old-style way of linking to an external site |
23 tested: 23 passed, 0 failed (100% correct) | yes |
Install
CHANGEME
in the "ELinker.pm" file to make changes you may want to make.testit
or testit.bat
, which will create a table in HTML similar to the one above with the results of the test. Every column should say "yes"; if not, something is wrong somewhere. :(CHANGEME
in the "ELinker.pm" file and make the changes that talk about testing vs. "real thing".linkNodeTitle
".linkNodeTitleV2
", just copy the one found in "ELinker.pm
" into the Everything::HTML
Perl module (Everything/HTML.pm); if you want to take immediate advantage of the new version, you'll have to change all calls to "linkNodeTitle
" to "linkNodeTitleV2
"linkNodeTitle
" with "linkNodeTitleV2
", rename the "linkNodeTitleV2
" function to "linkNodeTitle
", then replace the one found in the the Everything::HTML
Perl module (Everything/HTML.pm)%allowedLinkKeys
(and optionally %otherESites
and %otherESitesNames
, if you're going to allow off-site links) hash[es] to a logical place in "Everything/HTML.pm".Warnings
Most, if not all, of the time, this replacement function ("linkNodeTitleV2
") will take longer to execute than the original version. (This was made to provide more power, not speed.)
This change has not been tested on an Everything server (yet), so it is not guaranteed to work properly, or at all. It may even blow up your computer. In any event, Nathan Bronecke and any associated persons and/or entities (like the Everything Development Company) deny all responsibility and liability.
If you decide to replace the function "linkNodeTitle
" (instead of just adding "linkNodeTitleV2
"), this assumes certain things in the core haven't changed. However, the core parts relative to this function have not changed for a while (before 0.8 to 1.0), so it should be pretty safe.
Miscellaneous
This modification is released under the same license as the main Everything engine. Information about that license is available on the EDC site.
NPB FIXME is link still correct?This second version of the extended link proposal, and implementation (version 0.1 only), was introduced on EveryDevel.com under [extended link (v2)].
Available Implementation Versions
If you are viewing a local copy of this page, you may want to check the online version to see if there is an updated version available. (Version 0.3 and later include a copy of this page in the download.)
version | .zip | .tar.gz |
---|---|---|
0.3 | e-better-link-0.3.zip (??k) | e-better-link-0.3.tar.gz (??k) |
0.2 | e-better-link-0.2.zip (8k) | |
0.1 | e-better-link-0.1.zip (6k) |