Template:Cnw

From RobotX
Jump to navigation Jump to search

Template documentation[view] [edit] [history] [purge]

Combination of <code> and <nowiki>.

Unlike with <pre>, wrapping still works.

Usage

Write "|" between braces of the wikitext to be displayed (and if its last character is a closing brace, also after that), and also inside tags, to avoid their interpretation by the server.

Write "|" in the desired wikitext as {{!}}.


a{{cnw|'''bold''' ''italics'' {|{tc}|} [[link]] '''bold''' ''italics'' '''bold''' ''italics''}}b


gives:


a'''bold''' ''italics'' {{tc}} [[link]] '''bold''' ''italics'' '''bold''' ''italics''b


If a line of wikitext has man braces and/or pipes it is easier to use <code><nowiki>..</nowiki></code>.

Limitations

The "|" does not avoid interpretation by the browser. For example, a code like &rarr; is not shown but interpreted by the browser. Also, both a single and multiple newlines are displayed as a space by the browser.


{{cnw|arrow      &rarr; {{tc}}

''italics''
[[link]]}}

gives:


arrow → #REDIRECT [[Template:Template link code]] <table class="box-Redirect_category_shell plainlinks ombox ombox-move" role="presentation" style="margin-top: 1.1em; border: solid 1px darkblue; border-left-width: 0.5em;"><tr><td class="mbox-empty-cell"></td><td class="mbox-text" style="padding-top: 0.9em; padding-bottom: 0.9em;">[[File:Symbol redirect arrow with gradient.svg|25px|link=]] '''This page is a [[Wikipedia:Redirect|redirect]]:''' <div class="rcat "> *'''[[:Category:Redirects from template shortcuts|From a template shortcut]]''': This is a redirect from a shortcut page name '''in ''any'' [[WP:namespace|namespace]]''' to a page in [[WP:template namespace|template namespace]]. ** ''If target page is '''not''' a template, then use {{[[Template:R from shortcut|R from shortcut]]}} instead.'' ** Template shortcuts are [[wikilink]]ed on community pages, talk pages and edit summaries, but not in [[wp:mainspace|mainspace]] articles. [[WP:Transclusion|Transclusion]]s in mainspace are common and do not need to be "[[WP:NOTBROKEN|fixed]]". ** '''Note:''' ''Template talk pages are in a [[wp:talk namespace|talk namespace]]; they are '''''not''''' in the template namespace. All shortcuts to talk pages should be tagged with <span class="nowrap"><code>{{R from shortcut}}</code></span>.''</div>[[Category:Redirects from template shortcuts]] [[:Template:R from high-use template]] <div class="rcat "> *'''[[:Category:Redirects from moves|From a page move]]''': This is a redirect from a page that has been moved (renamed). This page was kept as a redirect to avoid breaking links, both internal and external, that may have been made to the old page name.</div>[[Category:Redirects from moves]][[Category:Redirects from moves]] ''<small>When appropriate, [[Wikipedia:Protection policy|protection levels]] are automatically sensed, described and categorized.</small>''</td></tr></table> ''italics'' [[link]]


To preserve paragraphs, apply the template for each line separately. To preserve also single newlines, use also <poem> tags.


<poem>
{{cnw|{|{tc}|}}}

{{cnw|''italics''}}
{{cnw|[[link]]}}
</poem>

gives:


{{tc}}

''italics''
[[link]]


See also