Template>Headbomb |
|
(28 intermediate revisions by 12 users not shown) |
Line 1: |
Line 1: |
| {{#if:{{{p|}}} | | {{{{{|safesubst:}}}#invoke:Su|main}}<noinclude> |
| |{{#if:{{{b|}}}
| | {{documentation}} |
| |<span style="{{#ifeq:{{{w|}}}|f|font-family:monospace;}}font-size:{{{fontsize|80%}}};overflow:visible;display:inline-block; vertical-align:-0.4em; line-height:1.1em; margin-bottom:-0.2em;background:transparent;text-align:{{#switch:{{{a|}}}|r=right|c=center|left}}">{{{p|{{{p}}}}}}<br />{{{b|{{{b}}}}}}</span>
| | <!-- Categories go on the /doc subpage, and interwikis go on Wikidata. --> |
| |<sup>{{{p|}}}</sup>
| | </noinclude> |
| }}
| |
| |<sub>{{{b|}}}</sub>
| |
| }}<noinclude><!--endif {p} passed
| |
| --------------------------------------------------------------
| |
| --NOTES:
| |
| -- These comments are omitted by "noinclude" and not put
| |
| -- in pages sent over the Internet, only during edit.
| |
| --
| |
| -- NOTE A1: This template displays either a subscript {b} or
| |
| -- superscript {p}, or both in vertical alignment.
| |
| -- Usage: {{su | p=super | b=sub}}
| |
| --
| |
| -- NOTE C2: For compatibility with browser MS IE6, the result
| |
| -- with both subscripts is a span with vertical "<br />"
| |
| -- to align the superscript & subscript together.
| |
| --
| |
| -- NOTE F3: The font can be changed by w=f to select the
| |
| -- font-family:monospace, or by fontsize=nn% (default:
| |
| -- 80%) where 100% is the usual super/subscript size.
| |
| --
| |
| -- NOTE IE: Because IE6 often handles only 1 style="..." and
| |
| -- does not inherit the prior style, the 2 <span> tags
| |
| -- are combined as 1 <span> when {p}/{b} are both shown.
| |
| --
| |
| -- NOTE L5: The logic to select the typesetting, is shown by
| |
| -- the following 2 nested if-then-else statements:
| |
| --
| |
| -- IF superscript {p} exists
| |
| -- THEN IF subscript {b} exists
| |
| -- THEN show both aligned {p}<br>{b}
| |
| -- ELSE show superscript {p|} ENDIF
| |
| -- ELSE show subscript {b|} ENDIF
| |
| --
| |
| --------------------------------------------------------------
| |
| --HISTORY:
| |
| --09Apr08 Created for Template:PhysicsParticle & Template:val.
| |
| --21Dec10 Display super/subscript together by vertical <br>. | |
| --21Dec10 New parameter fontsize=80% to alter font size.
| |
| --21Dec10 Removed unnecessary "includeonly" tags.
| |
| --21Dec10 Moved {documentation} to bottom as typical.
| |
| --21Dec10 Added NOTES comments to explain template coding.
| |
| --21Dec10 Added HISTORY comments to log major changes.
| |
| --21Dec10 Used 1 <span> when both {p}/{b} for IE6 text-align.
| |
| --21Dec10 Lowered {p} "line-height:1.1em" for Konqueror 3.5.8.
| |
| --21Dec10 To avoid extra HTML, cut duplicate "line-height:1".
| |
| --
| |
| -->{{documentation}}<!--
| |
| -- PLEASE ADD CATEGORIES & INTERWIKIS TO /doc SUBPAGE - NOT HERE.
| |
| --></noinclude>
| |