Template:TrainzTip/doc

From Wikibooks, open books for an open world
Jump to navigation Jump to search
Sample calls ... appears as
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.




Setting 50% for MW (max-width) of the first above shows
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

Arguments (options)[edit source]

This templated can be used as a general purpose message box, including supporting embedding an image, and supports just about any HTML style element(S) inside the Table wrapper, such as font-family, font-face, font-size, width, etc. as well as size parametrics like padding, margins, colors and positioning. The first below, 'AS' is coded as situated at the end of the style string, so most browsers will interpret it last, and so it may override preceding element parameters. Normally it produces nothing, unless defined.


In Alphabetical Order...
ALN - Alignment of the outer wrapper
align:{{{ALN|left}}} (left=default)
AS - defaults to vaporware, last formating field of wrapper. (mnemonic: ANY STYLE)
      Font commands here (face |size | family) are inherited below and functional.
B   - outer table border 
B2  - inner text border:(default's to class="pretty-table"'s by inheritance)
BG  - (background, #dfdfdf), of the Framing Table, defaults to a light blue-grey
BG2 - (background), of the main text window—default is #daebfa
CLR - defaults to clear:left
FLT - float: left is default (Wrapper table)
M   - Overrides Margin '4x up' defaults -- to margin of the inner table text box
M2  - Overrides Margin '4x up' defaults -- to margin of the inner table text box
ML  & MR  - margin-left and margin-right -- for the bounding wrapper / outer table element.
ML2 & MR2 - margin-left and margin-right  -- Textbox (inner) table.
MW  - max-width of the outer wrapper table.
MW2 - max-width of the textbox table.
P   - padding of the outer wrapper table.  -- default is 2px
P2  - padding of the textbox table.        -- default is padding:{{{P2|3px 2px 3px 2px;}}}
text- also {{{1}}}  -- Output text box, |text= overrides |1=  
VA2 - textbox vertical-alignment
 W2 - W for width

Parameters[edit source]

All the parameters are employed using the same simple syntax:

| Arg=<value> | ... next Arg=

The values parametrics are provided HTML_KeyWord: {{{ Arg | default }}}; and parameters are always ALL capital letters. The style line below is the actual beginning of the box formatting, the wrapper:

style="clear:{{{CLR|left}}}; float:{{{FLT|left}}}; align: left; max-width:{{{MW|96%}}}; margin-left:{{{ML|0%}}}; margin-right:{{{MR|0.2%}}};   ..."

which is rendered into the default actually building the page code:

style="clear:left; float:left; align: left; max-width:96%; margin-left:0%; margin-right:0.2%;   ..."

  • The Templates first unnamed parameter is the desired text inside the box. If the box also contains template calls,
    you might need to express this as | 1= some text with templates or inside a template
  • image (optional) : the image to be used.
    • Adapted from {{textBox}} but totally rewritten since in table form as a more robust template with default formatting.
Some optional parameters that can be adjusted
Note: most should be left as is, unless using the template as a sub-template as {{TRS-warning}} did with this.
Note as well: this is a double table wrapper around inner table with image and text areas, and these parameters below do not give you full control! Parts of each table are As Is!
  1.  AS - defaults to vaporware, this can be used to add any HTML style element(S) inside the Table wrapper, such as font-family, font-face, font-size, width, etc.
    Situated at the end of the style string, most browsers will interpret it last, and so it may override preceding element parameters.
  2.   B - outer table border:2px solid blue (is the default)
  3.  B2 - inner text border:(default's to class="pretty-table"'s by inheritance)
  4. BG  - (background), of the main text window
  5. BG2 - (background, #dfdfdf), of the Framing Table, defaults to a light blue-grey
  6. CLR - defaults to clear:left
  7. FLT - float: left is default
  8. M  - defaults to margin: 0px 2px of the inner table text box, different margin from the following which are mainly provided to affect the outer wrapper box.
  9. ML & MR - margin-left:0 and margin-right:0.2% respectively (shown with defaults) for the bounding / outer table element.
  10. ML2 & MR2 - margin-left:0 and margin-right:0.2% respectively (shown with defaults) for the inner text-table element. ONLY has effect if M is undefined.
  11. MW2  - max-width:96% (default value again)
  12. MW  - max-width:96% (default value again) -Hint: 50% works well on small monitors nested beside a right side element like an image.
    The outer table bounds and forces the text box and image table to stay inside it. Another adjustment should be unnecessary for the inner and outer widths could then be mismatched.
  13.   P - padding:2px (default) of the outer wrapper table.
  14.   P2- padding:3px 2px (default) of the textbox table.
  15.  VA - textbox vertical-alignment ('middle' is the default)
  16.   W - W for width, this overrides the outer table max-width and the inner text box


Note
The suffix '2' on a mnemonic parameter varies table to table. '2' versions seem most likely to NOT be customized adjustment desires.