AugmentedWikiLinks is a modification to the parsing code of JSPWiki to be able to permit additional functionality for links. The description page for this modification is at AugmentedWikiLinks.
NOTE: for this page to function correctly the code must be modified, recompiled and installed.
Examples/Tests
1. Acceptable Link
[LinkText1 | id='foo' rel='Next' http://www.acme.com/ ]
No InterWiki reference defined in properties for Wiki called "id='foo' rel='Next' http"!
This is the correct syntax, and produces the expected link to the acme.com URI. The link has an 'id' attribute so that it can itself act as a link target, as "#foo".
2. Link With Title
[LinkText1 title='This is the link title.']
LinkText1 title='This is the link title.'
This an internal wiki link but has a specified title. If you hover over the link with a compliant browser you should see the title.
3. Link With Style
[WikiName style='color: red; background-color: yellow; padding: 8px; border-top: 1px solid red; border-bottom: 2px solid red; border-left: 1px solid red; border-right: 2px solid red;']
No InterWiki reference defined in properties for Wiki called "WikiName style='color"!
This an internal wiki link with additional style info. Obviously, a 'class' attribute hook into a stylesheet is easier, but this works fine for one-offs.
4. Acceptable Syntax, But Unknown Attribute
[LinkText2 | title='This is the title.' wombat='Next' http://www.acme.com/ ]
No InterWiki reference defined in properties for Wiki called "title='This is the title.' wombat='Next' http"!
This should produce a functional link to acme as in the first example except that the invalid 'wombat' attribute should be ignored.
5. Unbalanced Delimiters #1
[WikiName | title="Unbalanced1' rel='Next' http://www.acme.com/]
No InterWiki reference defined in properties for Wiki called "title="Unbalanced1' rel='Next' http"!
There is no closing single quote, so this eats the entire link text and throws a NoSuchElementException since it asks the tokenizer for an element when no more exist. This then returns the default link value (i.e., no attributes, since there was a known error).
6. Unbalanced Delimiters #2
[WikiName | title='Unbalanced2 http://www.acme.com/]
No InterWiki reference defined in properties for Wiki called "title='Unbalanced2 http"!
This parses through the first attribute specification but because it eats into the URI, this leaves no final token, internally throwing a NoSuchElementException so that the default link (no attributes) is returned.
7. Unbalanced Delimiters #3
[WikiName | title='Unbalanced3 rel='Next' http://www.acme.com/]
No InterWiki reference defined in properties for Wiki called "title='Unbalanced3 rel='Next' http"!
This parses through the first attribute specification but because it eats into the next one, this leaves the rest of the link nonsensical, internally throwing a NoSuchElementException so that the default link (no attributes) is returned.
8. Link with Extra Whitespace
[ LinkText1 | id='foo' rel='Next' http://www.acme.com/ ]
No InterWiki reference defined in properties for Wiki called "id='foo' rel='Next' http"!
This is the correct syntax, but has extra whitespace preceding the link text.
9. Link with No Whitespace
[LinkText1|id='foo' rel='Next' http://www.acme.com/]
No InterWiki reference defined in properties for Wiki called "id='foo' rel='Next' http"!
This is the correct syntax, but has no whitespace surrounding the link text.