Template:Codeblock: Difference between revisions
Template page
More actions
just bare with this for a bit, im checking some stuff out for a custom weapon tutorial |
VivaRomania (talk | contribs) mNo edit summary |
||
| (6 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
<div style="max-width:{{{width|unset}}}; overflow:hidden;background-color:{{#switch:{{{style|}}}|1=rgba(241, 233, 203, 1)|rgba(241, 233, 203, 1)}};{{#switch:{{{style|}}}|1=border:1px solid rgba(48,48,48,1);|}}border-radius:4px; font-family:monospace,monospace; color: black; line-height:1.52rem<!--lines-->; text-indent:0; white-space:pre-wrap; margin: {{{margin|.3em 0 .3em 0}}}"><!-- | |||
-->{{#if:{{{src|{{{lang|}}}}}}|<div style="width=100%; display:flex;justify-content:space-between;background-color:rgba(88, 58, 49, 1); | |||
border-bottom:1px solid rgba(164, 145, 126, 1); font-family:monospace,monospace; color: white; line-height:1.125rem<!--header-->; text-indent:0; white-space:pre-wrap; padding:.5em"><!-- | |||
-->{{#if:{{{src|{{{lang|}}}}}}|<div style="display:flex;justify-content:space-between;background-color:rgba( | |||
--><!-- | --><!-- | ||
--><div>{{{src|The source was not specified}}}</div><!-- | --><div>{{{src|The source was not specified}}}</div><!-- | ||
| Line 11: | Line 9: | ||
--><!-- | --><!-- | ||
--><div style="width:100%"><!-- | --><div style="width:100%"><!-- | ||
--><div style="scrollbar-color:# | --><div style="scrollbar-color:#f1e9cb #583a31; position:relative;width:100%;display:flex;max-height:{{{height|unset}}};overflow:auto"><!-- | ||
-->{{#if:{{{lines|}}}|<div style="z-index:1;display:flex;position:sticky;left:0;height:100%;padding:.5em | -->{{#if:{{{lines|}}}|<div style="z-index:1;display:flex;position:sticky;left:0;height:100%;padding:.45em .5em;color: white;background-color:{{#switch:{{{style|}}}|1=rgb(88, 58, 49)|rgb(88, 58, 49);}};border-right:1px solid rgb(48,48,48)"><!-- | ||
--><ol start="{{{start|1}}}" style="text-align:right;pointer-events:none;white-space:nowrap;list-style-position:inside;margin-left:8px;margin-top:0;user-select:none;margin-right:-10px;text-indent:0"><!-- | --><ol start="{{{start|1}}}" style="text-align:right;pointer-events:none;white-space:nowrap;list-style-position:inside;margin-left:8px;margin-top:0;user-select:none;margin-right:-10px;text-indent:0"><!-- | ||
-->{{padright:|{{#expr:5 * {{{lines}}}}}|<li> }}{{#ifexpr:{{{lines}}} > 100<!-- | -->{{padright:|{{#expr:5 * {{{lines}}}}}|<li> }}{{#ifexpr:{{{lines}}} > 100<!-- | ||
| Line 23: | Line 21: | ||
--></div>}}<!-- | --></div>}}<!-- | ||
--><!-- | --><!-- | ||
--><div style="width:100%;text-indent:0;line-height:1. | --><div style="width:100%;text-indent:0;line-height:1.6rem<!--code-->;white-space:{{#if:{{{softwrap|}}}|pre-wrap|pre}};height:100%;tab-size:4;"><!-- | ||
-->{{#if:{{{lightamount1|{{{lightstart1|}}}}}}|<div style="position:sticky;z-index:0"><!-- | -->{{#if:{{{lightamount1|{{{lightstart1|}}}}}}|<div style="position:sticky;z-index:0"><!-- | ||
--><div style="width:100%;background:rgba(255,128,0,0.1);margin-top:calc((1.6em * ({{{lightstart1|1}}} - 1)) + .45em);margin-bottom:.45em;height:calc(1.6em * {{{lightamount1|1}}});position:absolute;left:0;user-select:none;pointer-events:none"><!-- | --><div style="width:100%;background:rgba(255,128,0,0.1);margin-top:calc((1.6em * ({{{lightstart1|1}}} - 1)) + .45em);margin-bottom:.45em;height:calc(1.6em * {{{lightamount1|1}}});position:absolute;left:0;user-select:none;pointer-events:none"><!-- | ||
| Line 42: | Line 40: | ||
--></div><!-- | --></div><!-- | ||
--><!-- | --><!-- | ||
--></div></ | --></div> | ||
<noinclude> | |||
== Documentation == | |||
Just go to Valve Dev Community for their documentation, only difference is formatting (styling). | |||
Link: [https://developer.valvesoftware.com/w/index.php?title=Template:CodeBlock VDC Code Documentation] | |||
== Examples == | |||
=== With header === | |||
{{codeblock| | |||
lang=txt (file type)| | |||
src=tf2classic/scripts/items/items_game.txt (directory)| | |||
<nowiki>(code) | |||
This is a test! | |||
"Beep Boop!" - Soldier | |||
''no italics'' - - - '''no bold''' | |||
<nowiki> tag makes formatting no format for code stuff! </nowiki> | |||
''yes italics'' - - - '''yes bold''' | |||
Codey code code | |||
}} | |||
=== Without header === | |||
{{codeblock| | |||
<nowiki>(code) | |||
Hello, world! | |||
I'm headerless :( | |||
''"blah blah blah"'' | |||
</nowiki> | |||
}} | |||
=== With lines enabled + Locked Height/Width === | |||
'''Note''':It is not fully aligned and may break with lots of lines. Fast scrolling also breaks alignment but will refix. | |||
{{codeblock| | |||
lines=16| | |||
height=250px| <!--cannot be percentage--> | |||
width=25%| | |||
lang=txt| | |||
<nowiki>A1 | |||
B2 | |||
C3 | |||
D4 | |||
Start of Long Line ----------------- End of Long Line | |||
You can also leave gaps | |||
9 | |||
10 | |||
11 | |||
12 | |||
13 | |||
14 | |||
15 | |||
16</nowiki>}} | |||
</ | [[Category:Layout templates]] | ||
</noinclude> | |||