SID-02080: Macros and Interwiki links
| Status: |
Answered |
TWiki version: |
4.1.1 |
Perl version: |
|
| Category: |
CategoryRendering |
Server OS: |
RedHat Linux |
Last update: |
10 years ago |
Hi Support Team,
Could you please help me in implementing below functionaliy.
My current environment details mentioned below
Twiki-4.1.1
Apache:2.2.15
How do i implement the below functionality using Macros?
ONTEXT:{TEXT} in Twiki markdown to expand to <a href=”https://test.com/browse/{TEXT}”>{TEXT}</a>
and
ONTINT:{TEXT} in Twiki markdown to expand to <a href=http://testcom/browsee/{TEXT}>{TEXT}</a>
where {TEXT} is whatever the Twiki author types in.
Please let me know if you need any other details.
Regards
Surendra
--
Surendra Udutha - 2015-06-29
Discussion and Answer
One canonical way to do this would be to ... upgrade to TWiki 6, where this feature is built-in. However, since you mention
MostPopularPlugin which, according to
TWiki:Plugins.MostPopularPlugin
is no longer maintained, this may not be feasible for you.
With TWiki 4, there are no user-definable macros with parameters. If you are a Perl coder, you could still implement it as a plugin.
--
Harald Jörg - 2015-06-29
Thanks Herald for the quick response.
Basically i am a twiki administrator,i would like to know is this functionality can be impemented by a Perl Coder or something an administrator can do this by enabling some feature.
In the last post i have selected wrong plugin(i am not sure about plugin,i have selected randomly from dropdown box).Please suggest.
One of the requestory was telling that this functionality already implemented in the environment,i would like to know how do i verify?please point me in right direction.
sorry if i confuse you.
Regards
surendra.
--
Surendra Udutha - 2015-06-30
Ah, I understand. You don't have to select a plugin from the list if you are unsure where it applies to.
I also might have a hunch what you are aiming at, from the hint that someone told you that this functionality was already implemented. It does
almost what you described: It expands a keyword to a link on a certain website, keeping the keyword in both the URL and the explanation text. This feature, which is indeed available in TWiki 4, is described in
InterwikiPlugin. In short, there's a topic (per default:
TWiki.InterWikis in your installation) which contains tables of declarations which "link prefix" should be expanded to which website. So, for example, you write
TWiki:Support.SID-02080
to link to our current topic, or
RFC:4998
links to an RFC describing evidence record syntax, and
Wikipedia:TWiki
links to the page on TWiki in wikipedia. A lot more useful alias names are predefined, but you can easily add your own.
Applied to your case, you would add to the table in your installation:
...and from there on, you can write ONTEXT:TEXT to expand to <a href="https://test.com/browse/TEXT">ONTEXT:TEXT</a> and
ONTINT:TEXT to expand to <a href="http://testcom/browsee/TEXT">ONTINT:TEXT</a>. Not quite the syntax you want, but pretty close.
--
Harald Jörg - 2015-06-30
Thanks Herald.
I will check from my end how to implement this.Do you suggest any step-by-step document?
Regards
surendra
--
Surendra Udutha - 2015-07-01
You don't have to
implement anything.
InterwikiPlugin is installed per default in TWiki, you just need to
use it by declaring the aliases
ONTEXT and
ONTINT, following the example I have given. If that isn't step-by-step enough, the plugin's description
InterwikiPlugin should help for details!
--
Harald Jörg - 2015-07-01
Thank you Harald.
--
Surendra Udutha - 2015-07-11
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.