Difference between revisions of "Template:Scroll box"

From Philosophical Vegan Wiki
Jump to: navigation, search
(Created page with "== Usage == <div style="border: 1px #ccc solid; padding:1em;"> <code> '''{{scroll box'''<br /> '''|width='''''<span style="color:blue">width (in pixel or in percent)...")
 
 
Line 1: Line 1:
== Usage ==
+
{{Documentation subpage}}
<div style="border: 1px #ccc solid; padding:1em;">
+
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
<code>
 
'''&#123;&#123;scroll box'''<br />
 
'''|width='''''<span style="color:blue">width (in pixel or in percent)</span>''<br />
 
'''|height='''''<span style="color:blue">height (in pixel)</span>''<br />
 
'''|text='''''<span style="color:green">contents</span>''<br />
 
'''&#125;&#125;'''
 
</code>
 
</div>
 
  
The colored text should be properly replaced as here described:
+
{{tl|{{PAGENAME}}}} uses <code>[[HTML element#Other containers|&lt;pre&gt;]]</code> tags, but with text that is either [[word wrap|wrapped]] or is contained in a horizontal scrollbox. This means the text will not stretch past the right side of the screen.
  
<span style="color:blue">width</span>
+
As it uses real &lt;pre&gt; tags (unlike {{tl|pre}}), it will be displayed correctly regardless of how the user's Wikipedia [[WP:SKIN|skin]] renders &lt;pre&gt; boxes.
:The width of the box, expressed in pixel or in percent. ('''default=100%''')
+
 
<span style="color:blue">height</span>
+
If you want to disable [[WP:Wikitext|wikitext]] in it, you should use &lt;nowiki> tags inside the template (see [[#wikitext|below]]).
:The height of the box, you should express this value exclusively in pixel. ('''default=230px''')
+
 
<span style="color:green">contents</span>
+
==Usage==
:The text that should be displayed inside this frame. Note that the scroll bar will appear only if the text is long enough to overflow the given height. ('''required field''', no default value)
+
===Wrapped text===
 +
<span style="background-color:white"><code><nowiki>{{Pre2|Text to be displayed. And more and more and more... and a paragraph break.</nowiki>
 +
<p>
 +
<nowiki>And then more and more...}}</nowiki></code></span>
 +
:produces:
 +
{{Pre2|Text to be displayed. And more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and a paragraph break.
 +
 
 +
And then more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more.}}
 +
 
 +
===Scrollbox===
 +
<span style="background:white"><code><nowiki>{{Pre2|scroll|Text to be displayed. And more and more and more... and a paragraph break.</nowiki>
 +
<p>
 +
<nowiki>And then more and more...}}</nowiki></code></span>
 +
:produces:
 +
{{Pre2|scroll|Text to be displayed. And more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and a paragraph break.
 +
 
 +
And then more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more.}}
 +
 
 +
===Style===
 +
When the text contains links is better to change the text color, thus highlighting:
 +
 
 +
<span style="background:black"><code><nowiki>{{Pre2|style=color:green|Text to be [[Hyperlink|link]]. WARNING! A{{=}}B, you must use Template:=. And more and more and more... and a paragraph break.</nowiki>
 +
<p>
 +
<nowiki>And then more and more...}}</nowiki></code></span>
 +
:produces:
 +
{{Pre2|style=color:green|Text to be [[Hyperlink|link]]. WARNING! A{{=}}B, you must use Template:{{=}}. And more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and a paragraph break.}}
 +
 
 +
==Using wikitext {{anchor|wikitext}}==
 +
 
 +
To disable [[WP:Wikitext|wikitext]] (e.g. <nowiki>[[</nowiki>[[WP:Wikilink|links]]<nowiki>]]</nowiki>), &lt;nowiki> tags must be used in the form:
 +
 
 +
<span style="background:white"><code><nowiki>{{Pre2|&lt;nowiki>Your [[text]]{{dn|name=Pre2}}, which ''might'' include {{tl|templates}}.<noinclude>[[Category:Examples]]</noinclude>&lt;/nowiki>}}</nowiki></code></span>
 +
 
 +
This will produce this:
 +
{{Pre2|<nowiki>Your [[text]]{{dn|name=Pre2}}, which ''might'' include {{tl|templates}}.<noinclude>[[Category:Examples]]</noinclude></nowiki>}}
 +
 
 +
as opposed to:
 +
{{Pre2|Your [[text]]{{dn|name=Pre2}}, which ''might'' include {{tl|templates}}.<noinclude>[[Category:Examples]]</noinclude>}}
 +
 
 +
==See also==
 +
* {{tl|pre}}, which mimics &lt;pre&gt; tags as rendered with the monobook Wikipedia skin
 +
* [[HTML element#Other block elements|<nowiki><pre>…</pre></nowiki>]]
 +
* [[Word wrap]]ping
 +
 
 +
<includeonly>
 +
{{#ifeq:{{SUBPAGENAME}}|sandbox | |
 +
<!-- CATEGORIES HERE, THANKS -->
 +
[[Category:Programming typing-aid templates]]
 +
[[Category:Wikipedia XHTML tag-replacing templates]]
 +
}}
 +
</includeonly>

Latest revision as of 00:53, 11 December 2017

Template:Documentation subpage

Template:Tl uses <pre> tags, but with text that is either wrapped or is contained in a horizontal scrollbox. This means the text will not stretch past the right side of the screen.

As it uses real <pre> tags (unlike Template:Tl), it will be displayed correctly regardless of how the user's Wikipedia skin renders <pre> boxes.

If you want to disable wikitext in it, you should use <nowiki> tags inside the template (see below).

Usage

Wrapped text

{{Pre2|Text to be displayed. And more and more and more... and a paragraph break.

And then more and more...}}</code></span>

produces:
Template:Pre2

Scrollbox

<code>{{Pre2|scroll|Text to be displayed. And more and more and more... and a paragraph break. <p> And then more and more...}}</code>

produces:

Template:Pre2

Style

When the text contains links is better to change the text color, thus highlighting:

<code>{{Pre2|style=color:green|Text to be [[Hyperlink|link]]. WARNING! A{{=}}B, you must use Template:=. And more and more and more... and a paragraph break. <p> And then more and more...}}</code>

produces:

Template:Pre2

Using wikitext Template:Anchor

To disable wikitext (e.g. [[links]]), <nowiki> tags must be used in the form:

<code>{{Pre2|<nowiki>Your [[text]]{{dn|name=Pre2}}, which ''might'' include {{tl|templates}}.<noinclude>[[Category:Examples]]</noinclude></nowiki>}}</code>

This will produce this: Template:Pre2

as opposed to: Template:Pre2

See also