Search code examples
mediawikisemantic-mediawiki

Evaluate format template content in (Semantic-)Mediawiki


I am using semantic mediawiki to store and describe information about scientific papers. In this context I would like to build a citation template that links to the page where the paper is described.

Every Paper has an identifier which is a combination of first author and year with the property like this: [[Has citekey:someauthor2019]]. I use a template to cite this paper as {{Cite | someauthor2019}} and combine the Cite template with a format template to render it as a link to the page with the name of the citekey.

The problem is that when I do it with the templates below, it will actually display the wikitext:

[[Name of the page | someauthor2019 ]]

instead of evaluating it to appear as the named link:

someauthor2019

This is the semantic-mediawiki ask query to get the paper information:

  • Template:Cite
{{#ask: [[Has citekey::{{{1}}}]]
 |?Has citekey
 |format=template
 |template=Cite Text
}}

This is the format template to deal with the results of the query:

  • Template:Cite_Text
[[{{{1}}} | {{{2}}}]]

How can I get the avaluated result of a named link to be displayed instead of the wikitext?

Thank you in advance for any help!


Solution

  • Try to use

     |link=none
    

    this will pass {{{1}}} result as raw text to your template

    You request becomes :

    {{#ask: [[Has citekey::{{{1}}}]]
     |?Has citekey
     |format=template
     |template=Cite Text
     |link=none
    }}
    

    Source :

    https://www.semantic-mediawiki.org/wiki/Help:Inline_queries#Standard_parameters_for_inline_queries