Module:Addlink/doc: Difference between revisions

From The Sims Wiki, a collaborative database for The Sims series
Jump to navigation Jump to search
Content added Content deleted
(Created page with "This module sanitizies link input. It will add <code><nowiki>[[ ]]</nowiki></code> around text given to it, but will ignore it if it sees that square brackets a...")
 
No edit summary
Line 2: Line 2:


==Examples==
==Examples==
:<code><nowiki>{{#invoke:InfoboxLink|[[Foo]]}}</nowiki></code>
:<code><nowiki>{{#invoke:InfoboxLink|wrapInLink|[[Foo]]}}</nowiki></code>


:<code><nowiki>{{#invoke:InfoboxLink|Foo}}</nowiki></code>
:<code><nowiki>{{#invoke:InfoboxLink|wrapInLink|Foo}}</nowiki></code>


Both produce the following output:
Both produce the following output:


:{{#invoke:InfoboxLink|Foo}}
:{{#invoke:InfoboxLink|wrapInLink|Foo}}


Piped links also work.
Piped links also work.


:<code><nowiki>{{#invoke:InfoboxLink|[[Foo|Bar]]}}</nowiki></code>
:<code><nowiki>{{#invoke:InfoboxLink|wrapInLink|[[Foo|Bar]]}}</nowiki></code>


:<code><nowiki>{{#invoke:InfoboxLink|Foo{{!}}Bar}}</nowiki></code>
:<code><nowiki>{{#invoke:InfoboxLink|wrapInLink|Foo{{!}}Bar}}</nowiki></code>


Both produce:
Both produce:


:{{#invoke:InfoboxLink|[[Foo|Bar]]}}
:{{#invoke:InfoboxLink|wrapInLink|[[Foo|Bar]]}}


<includeonly>[[Category:Modules for general use]]</includeonly><noinclude>[[Category:Module documentation]]</noinclude>
<includeonly>[[Category:Modules for general use]]</includeonly><noinclude>[[Category:Module documentation]]</noinclude>

Revision as of 16:55, 30 April 2019

This module sanitizies link input. It will add [[ ]] around text given to it, but will ignore it if it sees that square brackets are already present.

Examples

{{#invoke:InfoboxLink|wrapInLink|[[Foo]]}}
{{#invoke:InfoboxLink|wrapInLink|Foo}}

Both produce the following output:

Script error: No such module "InfoboxLink".

Piped links also work.

{{#invoke:InfoboxLink|wrapInLink|[[Foo|Bar]]}}
{{#invoke:InfoboxLink|wrapInLink|Foo{{!}}Bar}}

Both produce:

Script error: No such module "InfoboxLink".