Mediawiki 如何选择具有模板默认值的页面?
所以我们有这个模板:Mediawiki 如何选择具有模板默认值的页面?,mediawiki,Mediawiki,所以我们有这个模板: {| class="wikitable" |- | [[Saplings]] || ''{{{saplings|Lower}}}'' || [[Sappiness]] || ''{{{sappiness|Lowest}}}'' |- | [[Matures]] || ''{{{matures|Average}}}'' || [[Effect (Tree)|Effect]] || ''{{{effect|None}}}'' |- | [[Height]] || ''{{{he
{| class="wikitable"
|-
| [[Saplings]] || ''{{{saplings|Lower}}}'' || [[Sappiness]] || ''{{{sappiness|Lowest}}}''
|-
| [[Matures]] || ''{{{matures|Average}}}'' || [[Effect (Tree)|Effect]] || ''{{{effect|None}}}''
|-
| [[Height]] || ''{{{height|Small}}}'' || [[Growth (Forestry)|Growth]] || ''{{{growth|Light}}}''
|-
| [[Girth]] || ''{{{girth|1}}}x{{{girth|1}}}'' || [[Tolerates]] || ''{{{tolerates| }}}''
|-
| [[Yield]] || ''{{{yield|Lowest}}}'' || [[Fruits]] || ''{{{fruits|None}}}''
|}<noinclude>{{Documentation}}</noinclude>
而其他文件则明确包含默认值:
{{Tree-Attributes
| saplings = Lower
| height = Large
| yield = Lowest
| sappiness = Lower
| fruits = none
| girth = 2
}}
使用下面的DPL命令,我可以看到所有具有显式“Lower”值的。我如何获得该值以及保留默认值的值
{{#dpl:
|category = Trees
|uses = Template:Tree
|includematch = ,/saplings\s*=\s*Lower\s*/i
|include = {Tree}:name, {Tree-Attributes}:speed
|table = class="wikitable",-,Lower
|tablerow = ²{P{{!}}%% Sapling{{!}}F}² [[%%]]<span style="display:none;">«nowiki»,«/nowiki»</span>
|allowcachedresults = true
}}
{{#dpl:
|类别=树
|uses=Template:Tree
|includematch=,/saplings\s*=\s*Lower\s*/i
|include={Tree}:name,{Tree Attributes}:speed
|table=class=“wikitable”,-,更低
|tablerow=²{P{{!}}%%树苗{{!}F}²[[%%]]«诺维基»,«/诺维基»
|allowcachedresults=true
}}
[顺便说一句,我不知道为什么在没有定义“速度”属性的情况下,会有对“速度”属性的引用…]自我回答:我暂时不会选择这个答案,看看是否有其他人能想出更好的答案 通过改变,我得到了我想要的结果
includematch = ,/saplings\s*=\s*Lower\s*/i
到
includematch = ,/saplings\s*=\s*Lower\s*/i
includematch = ,/(saplings\s*=\s*Lower\s*){{!}}(^((?!saplings)(.{{!}}\n))+$)/i