Templates 将多行文本块作为MediaWiki模板参数传递
我希望制作一个折叠模板来隐藏一块文本,并通过单击展开来显示它。 我发现这样的代码如下Templates 将多行文本块作为MediaWiki模板参数传递,templates,parameters,mediawiki,Templates,Parameters,Mediawiki,我希望制作一个折叠模板来隐藏一块文本,并通过单击展开来显示它。 我发现这样的代码如下 <div class="mw-collapsible mw-collapsed" style="background-color: #E6E6E6; border-style: thin black; font-style:italic; "> <p><i>Try it by yourself before expanding on the right!</i>&
<div class="mw-collapsible mw-collapsed" style="background-color: #E6E6E6; border-style: thin black; font-style:italic; ">
<p><i>Try it by yourself before expanding on the right!</i></p>
<div class="mw-collapsible-content">
some text or wiki encoded text content (better for formatings and images)
that will remain hidden
until expand is clicked
</div>
</div>
但是我没有成功地使用{{{1}}传递输入文本块,因为我的内容充满了换行符和其他格式标记
我需要在模板中还是在调用wrap中执行操作,以及使用哪个标记?
欢迎任何帮助。您需要创建两个模板:
{{Collapse Begin}}
内容包括:
<div class="mw-collapsible mw-collapsed" style="background-color: #E6E6E6; border-style: thin black; font-style:italic; ">
<p><i>Try it by yourself before expanding on the right!</i></p>
<div class="mw-collapsible-content">
</div>
</div>
内容包括:
<div class="mw-collapsible mw-collapsed" style="background-color: #E6E6E6; border-style: thin black; font-style:italic; ">
<p><i>Try it by yourself before expanding on the right!</i></p>
<div class="mw-collapsible-content">
</div>
</div>
您需要创建两个模板:
{{Collapse Begin}}
内容包括:
<div class="mw-collapsible mw-collapsed" style="background-color: #E6E6E6; border-style: thin black; font-style:italic; ">
<p><i>Try it by yourself before expanding on the right!</i></p>
<div class="mw-collapsible-content">
</div>
</div>
内容包括:
<div class="mw-collapsible mw-collapsed" style="background-color: #E6E6E6; border-style: thin black; font-style:italic; ">
<p><i>Try it by yourself before expanding on the right!</i></p>
<div class="mw-collapsible-content">
</div>
</div>
显然,命名参数允许使用多行输入(不要问我为什么!) 下面的代码为我做了这项工作,但感谢您ankap的聪明想法,我将在其他地方重用它 我添加了一个可选的边距,以便在列表中使用时缩进彩色框,并为以折叠模式显示的消息添加了一个单独的参数
<!-- takes tup to three parameters
* margin: to indent the block in the page, useful if the collapse is within a bullet list
* comment: to show a warning on the expand line
* content: the actual content to hide
# adding additional div improved support for lists etc...
-->
<div class="mw-collapsible mw-collapsed" style="background-color: #E6E6E6;
border-style: thin black; font-style:italic; margin-left: {{{margin|0px}}}; ">
<includeonly><i>{{{comment|<nowiki>
Try it by yourself before expanding on the right!</nowiki>}}}</i><includeonly>
<div class="mw-collapsible-content"><div>{{{content|{{{1}}}}}}</div></div>
</div>
{{{{注释|
在右侧展开之前,请自己尝试!}}
{{{content}{{1}}
享受吧 显然,命名参数允许使用多行输入(不要问我为什么!) 下面的代码为我做了这项工作,但感谢您ankap的聪明想法,我将在其他地方重用它 我添加了一个可选的边距,以便在列表中使用时缩进彩色框,并为以折叠模式显示的消息添加了一个单独的参数
<!-- takes tup to three parameters
* margin: to indent the block in the page, useful if the collapse is within a bullet list
* comment: to show a warning on the expand line
* content: the actual content to hide
# adding additional div improved support for lists etc...
-->
<div class="mw-collapsible mw-collapsed" style="background-color: #E6E6E6;
border-style: thin black; font-style:italic; margin-left: {{{margin|0px}}}; ">
<includeonly><i>{{{comment|<nowiki>
Try it by yourself before expanding on the right!</nowiki>}}}</i><includeonly>
<div class="mw-collapsible-content"><div>{{{content|{{{1}}}}}}</div></div>
</div>
{{{{注释|
在右侧展开之前,请自己尝试!}}
{{{content}{{1}}
享受吧 “但我没有成功”到底发生了什么?实际结果是什么?与预期结果有何不同?“但我没有成功”到底发生了什么?实际结果是什么?与预期结果有何不同?