【问题标题】:Evaluate format template content in (Semantic-)Mediawiki评估 (Semantic-)Mediawiki 中的格式模板内容
【发布时间】:2019-10-08 15:46:20
【问题描述】:

我正在使用语义媒体维基来存储和描述有关科学论文的信息。在这种情况下,我想构建一个引用模板,链接到描述论文的页面。

每篇论文都有一个标识符,它是第一作者和年份的组合,其属性如下:[[Has citekey:someauthor2019]]。我使用模板将这篇论文引用为{{Cite | someauthor2019}},并将 Cite 模板与格式模板结合起来,以将其呈现为带有 citekey 名称的页面的链接。

问题是,当我使用下面的模板进行操作时,它实际上会显示 wikitext:

[[Name of the page | someauthor2019 ]]

而不是将其评估为显示为命名链接:

someauthor2019

这是获取论文信息的语义媒体维基询问查询:

  • 模板:引用
{{#ask: [[Has citekey::{{{1}}}]]
 |?Has citekey
 |format=template
 |template=Cite Text
}}

这是处理查询结果的格式模板:

  • 模板:Cite_Text
[[{{{1}}} | {{{2}}}]]

如何获得命名链接的评估结果而不是 wikitext?

提前感谢您的帮助!

【问题讨论】:

    标签: mediawiki semantic-mediawiki


    【解决方案1】:

    尝试使用

     |link=none
    

    这会将 {{{1}}} 结果作为原始文本传递给您的模板

    你的要求变成:

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

    来源:

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

    【讨论】:

      猜你喜欢
      • 2021-03-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-10
      相关资源
      最近更新 更多