Template:Codeblock: Difference between revisions

From TF2 Classified Wiki
Jump to navigation Jump to search
NinjaV (talk | contribs)
just bare with this for a bit, im checking some stuff out for a custom weapon tutorial
 
NinjaV (talk | contribs)
reformatted! looks acceptable now. examples!
Line 2: Line 2:


<onlyinclude><!--
<onlyinclude><!--
         --><div style="overflow:hidden;background-color:{{#switch:{{{style|}}}|1=rgba(0,0,0,.1)|rgba(0,0,0,.4)}};{{#switch:{{{style|}}}|1=border:1px solid rgba(48,48,48,1);|}}border-radius:4px; font-family:monospace,monospace; line-height:1.125rem; text-indent:0; white-space:pre-wrap; margin: {{{margin|.3em 0 .3em 0}}}"><!--
         --><div style="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.5rem<!--lines-->; text-indent:0; white-space:pre-wrap; margin: {{{margin|.3em 0 .3em 0}}}"><!--
             -->{{#if:{{{src|{{{lang|}}}}}}|<div style="display:flex;justify-content:space-between;background-color:rgba(0,0,0,.1); border-bottom:1px solid rgba(255,255,255,.1); font-family:monospace,monospace;line-height:1.125rem; text-indent:0; white-space:pre-wrap; padding:.5em"><!--
             -->{{#if:{{{src|{{{lang|}}}}}}|<div style="display:flex;justify-content:space-between;background-color:rgba(88, 58, 49, 1); border-bottom:1px solid rgba(0,255,0,.1); font-family:monospace,monospace; color: white; line-height:1.125rem<!--header-->; text-indent:0; white-space:pre-wrap; padding:.5em"><!--
--><!--
--><!--
                 --><div>{{{src|The source was not specified}}}</div><!--
                 --><div>{{{src|The source was not specified}}}</div><!--
Line 11: Line 11:
--><!--
--><!--
             --><div style="width:100%"><!--
             --><div style="width:100%"><!--
                 --><div style="scrollbar-color:#373737 #101010; position:relative;width:100%;display:flex;max-height:{{{height|unset}}};overflow:auto"><!--
                 --><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 0 .4em 0;background-color:{{#switch:{{{style|}}}|1=rgb(31,31,31)|rgb(24,24,24)}};border-right:1px solid rgb(48,48,48)"><!--
                     -->{{#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(0,0,255)|rgb(0, 255, 0)}};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 23:
                     --></div>}}<!--
                     --></div>}}<!--
--><!--
--><!--
                     --><div style="width:100%;text-indent:0;line-height:1.6em;white-space:{{#if:{{{softwrap|}}}|pre-wrap|pre}};height:100%;tab-size:4;"><!--
                     --><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 45: Line 45:


</includeonly>
</includeonly>
== 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>
}}
The line code is partially broke and isnt aligned fully
{{codeblock|
lines=16| <!--amount of number lines-->
height=100px <!--height of it, if list is longer, scroll appears. Ignore to make it fully expand-->
|<nowiki>A1
B2
C3
D4
E5
F6
G7
H8
I9
J10
K11
L12
M13
N14
O15
P16</nowiki>}}

Revision as of 22:28, 16 August 2025


Examples

with header

tf2classic/scripts/items/items_game.txt (directory)
txt (file type)
(code) This is a test! "Beep Boop!" - Soldier ''no italics'' - - - '''no bold''' <nowiki> tag makes formatting no format for code stuff!

yes italics - - - yes bold

Codey code code

without header

(code) Hello, world! I'm headerless :( ''"blah blah blah"''

The line code is partially broke and isnt aligned fully

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
A1 B2 C3 D4 E5 F6 G7 H8 I9 J10 K11 L12 M13 N14 O15 P16