Demo:Links in values

From semantic-mediawiki.org
Jump to: navigation, search

Instead of using in-text annotation it is possible to use the #set parser function to avoid having to touch the $smwgLinksInValues configuration parameter.

Method 1

Step 1 - Annotate the data

This is done by using the #set parser function without utilizing the "template" parameter.
Syntax:

{{#set: Has text=This text contains an internal link to the [[Main Page]] of this wiki and an external link to the [http://sandbox.semantic-mediawiki.org/wiki/Main_Page Main Page] of another wiki.}}

Step 2 - Query the data

Using the #show parser function

Syntax:

{{#show:
 {{FULLPAGENAME}}
 |?Has text
}}

Result:
This text contains an internal link to the Main Page of this wiki and an external link to the Main Page of another wiki.

Using the #ask parser function

Syntax:

{{#ask:
 [[{{FULLPAGENAME}}]]
 |?Has text
}}

Result:

 Has text
Links in valuesThis text contains an internal link to the Main Page of this wiki and an external link to the Main Page of another wiki.

Method 2

Annotate and display the data

This is done by using the #set parser function and utilizing the "template" parameter.
Syntax of the annotation:

{{#set:
 Has text=This text contains an internal link to the [[Main Page]] of this wiki and an external link to the [http://sandbox.semantic-mediawiki.org/wiki/Main_Page Main Page] of another wiki.
 |template=BySetTemplateSimpleValueOutput
}}

Syntax of the BySetTemplateSimpleValueOutput template:

<includeonly>{{{value}}}</includeonly>

Result:
This text contains an internal link to the Main Page of this wiki and an external link to the Main Page of another wiki.