最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How can I access a Semantic MediaWiki property that's been set by "#set"? - Stack Overflow

programmeradmin2浏览0评论

I'm working with a wiki template that sets a property using "#set":

{{#set:Is foo=Y}}

Is there a way to access the value of that property within the template or within a document using that template? I've tried {{{Is foo}}}, but that only works with document params. The broader context is that I need to ensure that documents currently missing that property have a default applied, along the lines of:

{{#if:{{{Is foo|}}}{{{Is foo|}}}|{{#set:Is foo=N}}

Documentation: :Setting_values

I'm working with a wiki template that sets a property using "#set":

{{#set:Is foo=Y}}

Is there a way to access the value of that property within the template or within a document using that template? I've tried {{{Is foo}}}, but that only works with document params. The broader context is that I need to ensure that documents currently missing that property have a default applied, along the lines of:

{{#if:{{{Is foo|}}}{{{Is foo|}}}|{{#set:Is foo=N}}

Documentation: https://www.semantic-mediawiki.org/wiki/Help:Setting_values

Share Improve this question asked Jan 18 at 17:25 MothOnMarsMothOnMars 2,3693 gold badges22 silver badges24 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

I think wha you want is a template {{Some template}} defined thus:

{{#set:Is foo={{{foo|default value for Is foo}}}}}

The template is called like this: {{Some template|foo=Non-default value for Is foo}} or {{Some template}} (will set the default value).

发布评论

评论列表(0)

  1. 暂无评论