切换搜索
搜索
切换菜单
notifications
切换个人菜单
查看“模板:Nowraplinks/doc”的源代码
来自决策链云智库
更多操作
←
模板:Nowraplinks/doc
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{Documentation subpage}} __NOTOC__ <!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE --> This is the {{tl|nowraplinks}} template. This template works in conjunction with {{tl|nowraplinks end}} to prevent word wraps (line breaks) inside links that include a space or spaces while allowing wraps between links and in normal text. This can be useful, for instance, in long lists of links. It is similar to {{tl|nowrap begin}}...{{tl|nowrap end}}. Reading [[Wikipedia:Line-break handling]] is recommended before starting to use this template. ====Usage==== <syntaxhighlight lang="wikitext"> {{nowraplinks}} [[This link will not wrap]] - [[This link also won't wrap]] - [[And so on]] - But this sentence might word wrap. {{nowraplinks end}} </syntaxhighlight> <syntaxhighlight lang="wikitext"> {{nowraplinks | [[This link will not wrap]] - [[This link also won't wrap]] - [[And so on]] - But this sentence might word wrap. }} </syntaxhighlight> Both examples will render something like this: :[[Template:Nowraplinks end|This link will not wrap]] - <br> :[[Template:Nowraplinks end|This link also won't wrap]] - <br> :[[Template:Nowraplinks end|And so on]] - But this sentence <br> :might word wrap. But they will ''not'' render like this: :[[Template:Nowraplinks end|This link will not wrap]] - [[Template:Nowraplinks end|This link]]<br> :[[Template:Nowraplinks end|shouldn't have wrapped]] - [[Template:Nowraplinks end|And so on]] -<br> :But this sentence might word wrap. ===Advanced usage=== Most of the functionality in this template is implemented as a CSS class in [[MediaWiki:Common.css|common.css]]. That class can be used together with pretty much any HTML tag or any box to prevent links to word wrap. For instance like this: :<code><nowiki><div class="nowraplinks"> Lots of text and links </div></nowiki></code> Or like this: :<code><nowiki><span class="nowraplinks"> Lots of text and links </span></nowiki></code> If the nowraplinks class is applied in the header of a table it will prevent line wrapping of links in ''all'' cells in the table. Note that in a table header there usually is a need to apply several classes. Then the class names should be separated by spaces in the class tag, not by commas or semicolons. Like this: <syntaxhighlight lang="wikitext"> {| class="wikitable nowraplinks" | [[This link will not wrap]]{{·}} [[This link also won't wrap]]{{·}} [[And so on]]{{·}} But this sentence might word wrap. | [[This link will not wrap]]{{·}} [[This link also won't wrap]]{{·}} [[And so on]]{{·}} But this sentence might word wrap. |} </syntaxhighlight> It will render this: {| class="wikitable nowraplinks" | [[Template:Nowraplinks end|This link will not wrap]]{{·}} [[Template:Nowraplinks end|This link also won't wrap]]{{·}} [[Template:Nowraplinks end|And so on]]{{·}} But this sentence might word wrap. | [[Template:Nowraplinks end|This link will not wrap]]{{·}} [[Template:Nowraplinks end|This link also won't wrap]]{{·}} [[Template:Nowraplinks end|And so on]]{{·}} But this sentence might word wrap. |} To really see the nowrap effect on the links above you can drag the width of your web browser window so it becomes smaller and smaller. ===Technical details=== The actual code that does the job is this [[CSS]] code in [[MediaWiki:Common.css|Common.css]]. <syntaxhighlight lang="css"> .nowraplinks a, .nowraplinks .selflink { white-space: nowrap; } </syntaxhighlight> It simply means that any white-space inside links (HTML A tags) and bold "links" to the page itself are not allowed to wrap. It is then invoked like this: :<code><nowiki><span class="nowraplinks"> Lots of text and links </span></nowiki></code> That span code is what the {{tl|nowraplinks}} and {{tl|nowraplinks end}} tags are packaging in an easy to use way. The [[Template:Navbox|standard navboxes]] use the .nowraplinks class, thus automatically handling most wrapping problems in those navboxes. ===See also=== {{List of nowrap-like templates}} <includeonly>{{Sandbox other|| <!-- ADD CATEGORIES BELOW THIS LINE --> [[Category:Line-handling templates]] [[et:Mall:Nowraplinks]] [[ja:Template:Nowraplinks]] }}</includeonly>
本页使用的模板:
模板:Documentation subpage
(
查看源代码
)
模板:List of nowrap-like templates
(
查看源代码
)
模板:Mbox
(
查看源代码
)
模板:Strong
(
查看源代码
)
模板:Terminate sentence
(
查看源代码
)
模板:Tl
(
查看源代码
)
模板:·
(
查看源代码
)
模块:Arguments
(
查看源代码
)
模块:Message box
(
查看源代码
)
模块:Message box/configuration
(
查看源代码
)
模块:Message box/ombox.css
(
查看源代码
)
模块:Text
(
查看源代码
)
模块:Yesno
(
查看源代码
)
返回
模板:Nowraplinks/doc
。