Mediawiki 模板选项

Mediawiki Template options

我有自己的模板,大部分情况下它确实有效,但有两处错误。我希望进度条在页面左侧对齐,我还希望显示百分比。

<div style="
width:{{{width|25%}}};
{{#ifeq: {{{center|yes}}} | yes |
margin:auto;
text-align:center;}}">
{{#ifeq: {{{header|yes}}} | yes
| <p>
{{{text|completed <small>(estimate)</small>}}}
</p>
}}
<p style="border:{{{border|1px solid gray}}}; padding:{{{padding|1px}}};    overflow:hidden;">
<span style="
width: {{#expr: {{{1|<noinclude>2</noinclude>0}}} / {{{total|100}}} *   100}}%;
height: {{{height|2}}}px;
background:{{{color1|#5FDB00}}};
float:left;">&nbsp;</span>
<span style="
 width:{{#expr: 100 - {{{1|<noinclude>2</noinclude>0}}} / {{{total|100}}}    * 100}}%;
 height:{{{height|2}}}px;
 background:{{{color2|#efefef}}};
 float:left;
 ">&nbsp;</span>
 </p>
 </div>

我的例子

 {{Progress bar|90|text=KTG Image Rebuild}}

在此示例中,任务已完成 90%,但未显示在进度条上或上方。

试一试。您实际上并没有尝试将进度文本放入其中,不确定您为什么期望它在那里。它作为 div 添加到进度条上方 <p>.

<div style="float:left; width:{{{width|25%}}}; {{#ifeq: {{{center|yes}}} | yes | margin:auto; text-align:center;}}">
{{#ifeq: {{{header|yes}}} | yes | <p>
{{{text|completed <small>(estimate)</small>}}}
</p>
}}
<div style="float:right; text-align:right; font-size:10px; line-height:10px;">{{{1|20}}}%</div>
<p style="border:{{{border|1px solid gray}}}; padding:{{{padding|1px}}}; overflow:hidden; float:left; width:80%">
<span style="width:{{#expr: {{{1|20}}} / {{{total|100}}} * 100}}%; height:{{{height|2}}}px; background:{{{color1|#5FDB00}}}; float:left;">&nbsp;</span>
<span style="width:{{#expr: 100 - {{{1|20}}} / {{{total|100}}} * 100}}%; height:{{{height|2}}}px; background:{{{color2|#efefef}}}; float:left;">&nbsp;</span>
</p>
</div>