Template:Boxcode: Difference between revisions
Jump to navigation
Jump to search
m (New configurable parameter "margin". Can be used to prevent linebreaks inside the <syntaxhighlight> area, is a dirty hack but it works) |
m (Removed the "margin" hack. It was intended to prevent line wrapping but now the "white-space:pre" is applyed globally to <pre> and <syntaxhighlight> tags since 2021/09/09) |
||
Line 6: | Line 6: | ||
{{clear}} | {{clear}} | ||
<div style="border:1px dashed #8080b0; height:{{{height|auto}}}; overflow:auto;"> | <div style="border:1px dashed #8080b0; height:{{{height|auto}}}; overflow:auto;"> | ||
<div style="margin-top:-14px; margin-bottom:-14px | <div style="margin-top:-14px; margin-bottom:-14px;">{{{code|code}}}</div> | ||
</div> | </div> | ||
</div> | </div> | ||
Line 24: | Line 24: | ||
<br>...or...<br> | <br>...or...<br> | ||
<nowiki>{{</nowiki>Boxcode|'''float='''right|'''width='''50%|'''height='''500px|'''title='''Custom Title|'''code='''Code Sample<nowiki>}}</nowiki> | <nowiki>{{</nowiki>Boxcode|'''float='''right|'''width='''50%|'''height='''500px|'''title='''Custom Title|'''code='''Code Sample<nowiki>}}</nowiki> | ||
== Examples == | == Examples == | ||
Line 32: | Line 30: | ||
lines | lines | ||
<!--here--> | <!--here--> | ||
very long lines adds a horizontal scroll bar at bottom of the template to preserve the width of the wiki pages ...............................................................................................................................................................................................................................................................................................o/sup | very long lines adds a horizontal scroll bar at bottom of the template to preserve the width of the wiki pages | ||
................................. ........................... ............................................ ....................................... ....................................................... ..................................... ....................... .............................o/sup | |||
</syntaxhighlight>}} | </syntaxhighlight>}} | ||
Line 41: | Line 40: | ||
very long lines adds a horizontal scroll bar at bottom of the template to preserve the width of the wiki pages | very long lines adds a horizontal scroll bar at bottom of the template to preserve the width of the wiki pages | ||
</syntaxhighlight>}} | </syntaxhighlight>}} | ||
{{Boxcode|width=50% | {{Boxcode|width=50%|float=right|title=width=50% float=right|code=<syntaxhighlight lang="xml"> | ||
<code> | <code> | ||
lines | lines | ||
Line 81: | Line 80: | ||
<!--here--> | <!--here--> | ||
very long lines adds a horizontal scroll bar | very long lines adds a horizontal scroll bar | ||
</syntaxhighlight>}} | </syntaxhighlight>}} | ||
{{Boxcode|width=auto|height=auto|float=left|title=width=auto height=auto float=left|code=<syntaxhighlight lang="xml"> | {{Boxcode|width=auto|height=auto|float=left|title=width=auto height=auto float=left|code=<syntaxhighlight lang="xml"> | ||
Line 93: | Line 91: | ||
<!--here--> | <!--here--> | ||
</syntaxhighlight>}} | </syntaxhighlight>}} | ||
[[Category:templates]]</noinclude> | [[Category:templates]]</noinclude> |
Revision as of 09:32, 9 September 2021
Code Sample
code
Usage
All the parameters in bold are optional, for a good look the "code sample" should start with either a <pre> or a <syntaxhighlight>
{{Boxcode|code=Code Sample}}
...or...
{{Boxcode|title=Custom Title|code=Code Sample}}
...or...
{{Boxcode|float=left|title=Custom Title|code=Code Sample}}
...or...
{{Boxcode|float=left|width=50%|title=Custom Title|code=Code Sample}}
...or...
{{Boxcode|float=right|width=50%|height=500px|title=Custom Title|code=Code Sample}}
Examples
Custom Title
<code>
lines
<!--here-->
very long lines adds a horizontal scroll bar at bottom of the template to preserve the width of the wiki pages
................................. ........................... ............................................ ....................................... ....................................................... ..................................... ....................... .............................o/sup
width=50% float=left
<code>
lines
<!--here-->
very long lines adds a horizontal scroll bar at bottom of the template to preserve the width of the wiki pages
width=50% float=right
<code>
lines
<!--here-->
very long lines adds a horizontal scroll bar at bottom of the template to preserve the width of the wiki pages
width=700px float=left
<code>
lines
<!--here-->
very long lines adds a horizontal scroll bar
width=auto float=right
<code>
lines
<!--here-->
very long lines adds a horizontal scroll bar
width=auto float=right
<code>
lines
<!--here-->
very long lines adds a horizontal scroll bar
width=350px height=200px float=right
<code>
lines
<!--here-->
very long lines adds a horizontal scroll bar
<code>
lines
<!--here-->
very long lines adds a horizontal scroll bar
<code>
lines
<!--here-->
very long lines adds a horizontal scroll bar
width=auto height=auto float=left
<code>
lines
<!--here-->
width=150px height=auto float=left
<code>
lines
<!--here-->