模板討論:Infobox
跳至導覽
跳至搜尋
由MJH提出的對Template:Infobox的編輯請求
將以下內容:
{{Infobox/brick|column1= {{{Row 1 title|}}}|column1 style= {{{Row 1 titlestyle| {{{Row titlestyle|}}} }}} bgcolor="{{{left-column-color|#E0FFFF}}}"
|column2= {{{Row 1 info|}}}|column2 style={{{Row 1 infostyle| {{{Row infostyle|}}} }}} }}
{{Infobox/brick|column1= {{{Row 2 title|}}}|column1 style= {{{Row 2 titlestyle| {{{Row titlestyle|}}} }}} bgcolor="{{{left-column-color|#E0FFFF}}}"
|column2= {{{Row 2 info|}}}|column2 style={{{Row 2 infostyle| {{{Row infostyle|}}} }}} }}
{{Infobox/brick|column1= {{{Row 3 title|}}}|column1 style= {{{Row 3 titlestyle| {{{Row titlestyle|}}} }}} bgcolor="{{{left-column-color|#E0FFFF}}}"
|column2= {{{Row 3 info|}}}|column2 style={{{Row 3 infostyle| {{{Row infostyle|}}} }}} }}
{{Infobox/brick|column1= {{{Row 4 title|}}}|column1 style= {{{Row 4 titlestyle| {{{Row titlestyle|}}} }}} bgcolor="{{{left-column-color|#E0FFFF}}}"
|column2= {{{Row 4 info|}}}|column2 style={{{Row 4 infostyle| {{{Row infostyle|}}} }}} }}
{{Infobox/brick|column1= {{{Row 5 title|}}}|column1 style= {{{Row 5 titlestyle| {{{Row titlestyle|}}} }}} bgcolor="{{{left-column-color|#E0FFFF}}}"
|column2= {{{Row 5 info|}}}|column2 style={{{Row 5 infostyle| {{{Row infostyle|}}} }}} }}
{{Infobox/brick|column1= {{{Row 6 title|}}}|column1 style= {{{Row 6 titlestyle| {{{Row titlestyle|}}} }}} bgcolor="{{{left-column-color|#E0FFFF}}}"
|column2= {{{Row 6 info|}}}|column2 style={{{Row 6 infostyle| {{{Row infostyle|}}} }}} }}
{{Infobox/brick|column1= {{{Row 7 title|}}}|column1 style= {{{Row 7 titlestyle| {{{Row titlestyle|}}} }}} bgcolor="{{{left-column-color|#E0FFFF}}}"
|column2= {{{Row 7 info|}}}|column2 style={{{Row 7 infostyle| {{{Row infostyle|}}} }}} }}
{{Infobox/brick|column1= {{{Row 8 title|}}}|column1 style= {{{Row 8 titlestyle| {{{Row titlestyle|}}} }}} bgcolor="{{{left-column-color|#E0FFFF}}}"
|column2= {{{Row 8 info|}}}|column2 style={{{Row 8 infostyle| {{{Row infostyle|}}} }}} }}
{{Infobox/brick|column1= {{{Row 9 title|}}}|column1 style= {{{Row 9 titlestyle| {{{Row titlestyle|}}} }}} bgcolor="{{{left-column-color|#E0FFFF}}}"
|column2= {{{Row 9 info|}}}|column2 style={{{Row 9 infostyle| {{{Row infostyle|}}} }}} }}
{{Infobox/brick|column1= {{{Row 10 title|}}}|column1 style= {{{Row 10 titlestyle| {{{Row titlestyle|}}} }}} bgcolor="{{{left-column-color|#E0FFFF}}}"
|column2= {{{Row 10 info|}}}|column2 style={{{Row 10 infostyle| {{{Row infostyle|}}} }}} }}
{{Infobox/brick|column1= {{{Row 11 title|}}}|column1 style= {{{Row 11 titlestyle| {{{Row titlestyle|}}} }}} bgcolor="{{{left-column-color|#E0FFFF}}}"
|column2= {{{Row 11 info|}}}|column2 style={{{Row 11 infostyle| {{{Row infostyle|}}} }}} }}
{{Infobox/brick|column1= {{{Row 12 title|}}}|column1 style= {{{Row 12 titlestyle| {{{Row titlestyle|}}} }}} bgcolor="{{{left-column-color|#E0FFFF}}}"
|column2= {{{Row 12 info|}}}|column2 style={{{Row 12 infostyle| {{{Row infostyle|}}} }}} }}
{{Infobox/brick|column1= {{{Row 13 title|}}}|column1 style= {{{Row 13 titlestyle| {{{Row titlestyle|}}} }}} bgcolor="{{{left-column-color|#E0FFFF}}}"
|column2= {{{Row 13 info|}}}|column2 style={{{Row 13 infostyle| {{{Row infostyle|}}} }}} }}
{{Infobox/brick|column1= {{{Row 14 title|}}}|column1 style= {{{Row 14 titlestyle| {{{Row titlestyle|}}} }}} bgcolor="{{{left-column-color|#E0FFFF}}}"
|column2= {{{Row 14 info|}}}|column2 style={{{Row 14 infostyle| {{{Row infostyle|}}} }}} }}
{{Infobox/brick|column1= {{{Row 15 title|}}}|column1 style= {{{Row 15 titlestyle| {{{Row titlestyle|}}} }}} bgcolor="{{{left-column-color|#E0FFFF}}}"
|column2= {{{Row 15 info|}}}|column2 style={{{Row 15 infostyle| {{{Row infostyle|}}} }}} }}
{{Infobox/brick|column1= {{{Row 16 title|}}}|column1 style= {{{Row 16 titlestyle| {{{Row titlestyle|}}} }}} bgcolor="{{{left-column-color|#E0FFFF}}}"
|column2= {{{Row 16 info|}}}|column2 style={{{Row 16 infostyle| {{{Row infostyle|}}} }}} }}
{{Infobox/brick|column1= {{{Row 17 title|}}}|column1 style= {{{Row 17 titlestyle| {{{Row titlestyle|}}} }}} bgcolor="{{{left-column-color|#E0FFFF}}}"
|column2= {{{Row 17 info|}}}|column2 style={{{Row 17 infostyle| {{{Row infostyle|}}} }}} }}
{{Infobox/brick|column1= {{{Row 18 title|}}}|column1 style= {{{Row 18 titlestyle| {{{Row titlestyle|}}} }}} bgcolor="{{{left-column-color|#E0FFFF}}}"
|column2= {{{Row 18 info|}}}|column2 style={{{Row 18 infostyle| {{{Row infostyle|}}} }}} }}
{{Infobox/brick|column1= {{{Row 19 title|}}}|column1 style= {{{Row 19 titlestyle| {{{Row titlestyle|}}} }}} bgcolor="{{{left-column-color|#E0FFFF}}}"
|column2= {{{Row 19 info|}}}|column2 style={{{Row 19 infostyle| {{{Row infostyle|}}} }}} }}
{{Infobox/brick|column1= {{{Row 20 title|}}}|column1 style= {{{Row 20 titlestyle| {{{Row titlestyle|}}} }}} bgcolor="{{{left-column-color|#E0FFFF}}}"
|column2= {{{Row 20 info|}}}|column2 style={{{Row 20 infostyle| {{{Row infostyle|}}} }}} }}
{{Infobox/brick|column1= {{{Row 21 title|}}}|column1 style= {{{Row 21 titlestyle| {{{Row titlestyle|}}} }}} bgcolor="{{{left-column-color|#E0FFFF}}}"
|column2= {{{Row 21 info|}}}|column2 style={{{Row 21 infostyle| {{{Row infostyle|}}} }}} }}
{{Infobox/brick|column1= {{{Row 22 title|}}}|column1 style= {{{Row 22 titlestyle| {{{Row titlestyle|}}} }}} bgcolor="{{{left-column-color|#E0FFFF}}}"
|column2= {{{Row 22 info|}}}|column2 style={{{Row 22 infostyle| {{{Row infostyle|}}} }}} }}
{{Infobox/brick|column1= {{{Row 23 title|}}}|column1 style= {{{Row 23 titlestyle| {{{Row titlestyle|}}} }}} bgcolor="{{{left-column-color|#E0FFFF}}}"
|column2= {{{Row 23 info|}}}|column2 style={{{Row 23 infostyle| {{{Row infostyle|}}} }}} }}
{{Infobox/brick|column1= {{{Row 24 title|}}}|column1 style= {{{Row 24 titlestyle| {{{Row titlestyle|}}} }}} bgcolor="{{{left-column-color|#E0FFFF}}}"
|column2= {{{Row 24 info|}}}|column2 style={{{Row 24 infostyle| {{{Row infostyle|}}} }}} }}
{{Infobox/brick|column1= {{{Row 25 title|}}}|column1 style= {{{Row 25 titlestyle| {{{Row titlestyle|}}} }}} bgcolor="{{{left-column-color|#E0FFFF}}}"
|column2= {{{Row 25 info|}}}|column2 style={{{Row 25 infostyle| {{{Row infostyle|}}} }}} }}
{{Infobox/brick|column1= {{{Row 26 title|}}}|column1 style= {{{Row 26 titlestyle| {{{Row titlestyle|}}} }}} bgcolor="{{{left-column-color|#E0FFFF}}}"
|column2= {{{Row 26 info|}}}|column2 style={{{Row 26 infostyle| {{{Row infostyle|}}} }}} }}
{{Infobox/brick|column1= {{{Row 27 title|}}}|column1 style= {{{Row 27 titlestyle| {{{Row titlestyle|}}} }}} bgcolor="{{{left-column-color|#E0FFFF}}}"
|column2= {{{Row 27 info|}}}|column2 style={{{Row 27 infostyle| {{{Row infostyle|}}} }}} }}
{{Infobox/brick|column1= {{{Row 28 title|}}}|column1 style= {{{Row 28 titlestyle| {{{Row titlestyle|}}} }}} bgcolor="{{{left-column-color|#E0FFFF}}}"
|column2= {{{Row 28 info|}}}|column2 style={{{Row 28 infostyle| {{{Row infostyle|}}} }}} }}
{{Infobox/brick|column1= {{{Row 29 title|}}}|column1 style= {{{Row 29 titlestyle| {{{Row titlestyle|}}} }}} bgcolor="{{{left-column-color|#E0FFFF}}}"
|column2= {{{Row 29 info|}}}|column2 style={{{Row 29 infostyle| {{{Row infostyle|}}} }}} }}
{{Infobox/brick|column1= {{{Row 30 title|}}}|column1 style= {{{Row 30 titlestyle| {{{Row titlestyle|}}} }}} bgcolor="{{{left-column-color|#E0FFFF}}}"
|column2= {{{Row 30 info|}}}|column2 style={{{Row 30 infostyle| {{{Row infostyle|}}} }}} }}修改為:
{{#vardefine:maxidx|0}}{{#forargs:Row |k|v|{{#if:{{#vardefineecho:idx|{{str_match|str={{#var:k}}|ptn=^(%d+) title$}}}}|
{{#ifexpr:{{#var:maxidx}}<{{#var:idx}}|{{#vardefine:maxidx|{{#var:idx}}}}}}
}}}}<!-- 这里先loop一遍记录maxidx是为了绕过#forargs依赖参数顺序的特性,保证row 1 title始终排在row 2 title前面。 -->
{{#invoke:loop|loop|time=1|{{#var:maxidx}}
|do=<nowiki>
{{Infobox/brick|column1= {{{Row {{#var:time}} title|}}}|column1 style= {{{Row {{#var:time}} titlestyle| {{{Row titlestyle|}}} }}} bgcolor="{{{left-column-color|#E0FFFF}}}"
|column2= {{{Row {{#var:time}} info|}}}|column2 style={{{Row {{#var:time}} infostyle| {{{Row infostyle|}}} }}} }}
</nowiki>
}}此外,關於對#forargs依賴參數順序的特性的批判,參見User:MJH/evilforargs。——
- @MJH使用後顯示:表達式錯誤:無法識別的標點「[」,腳本錯誤:函數「loop」不存在。--悠遠的蒼穹 (Talk with me!) 2021年6月24日 (四) 09:33 (CST)
- 欸欸?!我可以看一下對應的沙盒頁面固定連結嗎…… --
M. J. H. 【觀】{{#forargs:}} is evil! 2021年6月24日 (四) 09:35 (CST)- 似乎{{#invoke:loop|loop|應該改為{{#invoke:loop|main|,還有我沒在這裏實驗,不過我想你應該知道我會在哪裏實驗。。。--悠遠的蒼穹 (Talk with me!) 2021年6月24日 (四) 09:37 (CST)
- @MJH你退群後,我失去了你的QQ,你可以加我的 QQ:850710247--悠遠的蒼穹 (Talk with me!) 2021年6月24日 (四) 09:42 (CST)
- 是不是那邊的loop模塊實現不一樣?這邊的loop模塊裏面loop和main是完全等價的,loop換成main沒道理造成任何影響。 --
M. J. H. 【晉】{{#forargs:}} is evil! 2021年6月24日 (四) 09:44 (CST)- 那裏的模塊沒更新,剛才我更了就好了,現在只顯示:表達式錯誤:無法識別的標點「[」。表達式錯誤:無法識別的標點「[」。表達式錯誤:無法識別的標點「[」。表達式錯誤:無法識別的標點「[」。表達式錯誤:無法識別的標點「[」。表達式錯誤:無法識別的標點「[」。表達式錯誤:無法識別的標點「[」。表達式錯誤:無法識別的標點「[」。
- 似乎{{#invoke:loop|loop|應該改為{{#invoke:loop|main|,還有我沒在這裏實驗,不過我想你應該知道我會在哪裏實驗。。。--悠遠的蒼穹 (Talk with me!) 2021年6月24日 (四) 09:37 (CST)
- 欸欸?!我可以看一下對應的沙盒頁面固定連結嗎…… --
| 原始碼 |
|---|
{| class="{{{class|infobox}}}" align={{{align|right}}} style="font-size:{{{font-size|89%}}}; {{{text-align|text-align:center}}}; width:{{{width|260px}}}; max-width:{{{max-width|100%}}}; float:{{{float|right}}}; background-color:{{{bg-color|#FFF}}};"
{{{title-main|{{!}} colspan="{{{colspan-site|2}}}" style="background-color:{{{title-color|#26ca9b}}}; color:{{{text-color|#FFFFFF}}}; font-size:100%; padding:1em;" {{!}} {{{Title|}}} }}}
|-
{{#if: {{{image|}}} |
{{!}} colspan= "{{{colspan-site|2}}}" {{!}} [[File:{{{image}}}|{{#if:{{{size|}}} | {{{size}}} | 280px}}]]<br/>{{{caption| }}}
|{{!}} colspan= "{{{colspan-site|2}}}" {{!}}{{{image-lostmessage|}}}
}}
|-
{{#if: {{{tabs| }}}|
{{!}} colspan="{{{colspan-site|2}}}" {{!}} {{{tabs| }}}
|
}}
{{Infobox/brick|column1= {{{Row x1|}}} |column1 style= {{{Row x1 style|}}} colspan="{{{colspan-site|2}}}" }}
{{Infobox/brick|column1= {{{Row x2|}}} |column1 style= {{{Row x2 style|}}} colspan="{{{colspan-site|2}}}" }}
{{#vardefine:maxidx|0}}{{#forargs:Row |k|v|{{#if:{{#vardefineecho:idx|{{str_match|str={{#var:k}}|ptn=^(%d+) title$}}}}|
{{#ifexpr:{{#var:maxidx}}<{{#var:idx}}|{{#vardefine:maxidx|{{#var:idx}}}}}}
}}}}
{{#invoke:loop|main|time=1|{{#var:maxidx}}
|do=<nowiki>
{{Infobox/brick|column1= {{{Row {{#var:time}} title|}}}|column1 style= {{{Row {{#var:time}} titlestyle| {{{Row titlestyle|}}} }}} bgcolor="{{{left-column-color|#E0FFFF}}}"
|column2= {{{Row {{#var:time}} info|}}}|column2 style={{{Row {{#var:time}} infostyle| {{{Row infostyle|}}} }}} }}
}}
{{Infobox/brick|column1= {{{Row h1 title|}}} |column1 style= {{{Row h1 titlestyle|}}} colspan="{{{colspan-site|2}}}" bgcolor="{{{under-column-color|#62bca9}}}" }}
{{Infobox/brick|column1= {{clear}}
{{{Row h1 info|}}} |column1 style= {{{Row h1 infostyle|}}} colspan="{{{colspan-site|2}}}" }}
{{Infobox/brick|column1= {{{Row h2 title|}}} |column1 style= {{{Row h2 titlestyle|}}} colspan="{{{colspan-site|2}}}" bgcolor="{{{under-column-color|#62bca9}}}" }}
{{Infobox/brick|column1= {{clear}}
{{{Row h2 info|}}} |column1 style= {{{Row h2 infostyle|}}} colspan="{{{colspan-site|2}}}" }}
|-
{{{Row b1| }}}
|-
{{{Row b2| }}}
|}</nowiki>
|
- 你在那邊ping我一下我看看吧,有點怪…… --
M. J. H. 【艮】{{#forargs:}} is evil! 2021年6月24日 (四) 09:56 (CST)
- 你在那邊ping我一下我看看吧,有點怪…… --
@MJH情況就是這樣,不要看模板下面的介紹文件,那個是嵌入萌百的,請查看嵌入此模板的條目--<img src="https://www.hmoegirl.com/images/avatars/574894/128.png?ver=1598093246" style="width: 2.5em;border-radius: 50%;"/> =海豚=(留言 · 貢獻 · 討論) 2021年6月24日 (四) 10:05 (CST)