Question

I have a Tiki page with some headlines formatted like this.

!!!schedule(%milliSeconds, %method, %arguments)

On another place (same wiki page) I have a simplified reference.

schedule()

Can Tiki automatically make a reference from schedule() to schedule(%milliSeconds, %method, %arguments) Meaning that schedule () will reference !!!schedule (%milliSeconds, %method, %arguments)

I hope this description makes sense :)

Was it helpful?

Solution

OK, here is an example:

{JQ()}
$('.wikitext p').html( function(){
    return $(this).html().replace(/\s([^\)\s)]+)\(\)/gi, ' <a href="#$1_a_b_c_">$1()</a>');
});
{JQ}

You can put this JQ plugin with jQuery code to top of a wiki page (or if you want it on every page then without the JQ plugin to the Customization > Custom JavaScript section of Look & Feel admin panel). Then if there is foo() or bar() or any function() mentioned in any paragraph of the page it will be converted to link pointing to an anchor on the same page, e.g.

<a href="#function_a_b_c_">function()</a>

where _a_b_c_ are the params (a,b,c) in the heading, for example

!!Function(a,b,c)

You need to change that _a_b_c_ to match your anchors as they are rendered (check the HTML source) or adjust the regular expression. That is out of the scope of this answer. You can see a demo here.

OTHER TIPS

I am not sure I understand correctly but perhaps you could use the Hotwords feature, where you define schedule() as a "hotword" linking to YourWikiPageName#schedule(%milliSeconds, %method, %arguments). Then every mention of schedule() in Tiki will point to that anchor on that page.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top