Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/qt/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Templates 将多行文本块作为MediaWiki模板参数传递_Templates_Parameters_Mediawiki - Fatal编程技术网

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}}

享受吧

“但我没有成功”到底发生了什么?实际结果是什么?与预期结果有何不同?“但我没有成功”到底发生了什么?实际结果是什么?与预期结果有何不同?