Template:Su: Difference between revisions

From Zoophilia Wiki
Jump to navigationJump to search
meta>Wikid77
set to show {p}/{b} example when standalone; fixed IE6 text-align by using 1 <span> to show both {p}/{b}. Lowered {p} superscript by "line-height:1.1em" for Konqueror 3.5.8; +more NOTES comments
Ookami (talk | contribs)
m 90 revisions imported
 
(33 intermediate revisions by 11 users not shown)
Line 1: Line 1:
{{#if:{{{p|<noinclude>x</noinclude>}}}
{{{{{|safesubst:}}}#invoke:Su|main}}<noinclude>
  |{{#if:{{{b|<noinclude>x</noinclude>}}}
{{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
--
-- NOTE T6: Other templates are used unless {p} & {b} are
--      both specified together:
--        Template:sup - shows superscript when only {p}
--        Template:sub - shows subscript when only {b}
--        {documentation} - to display the /doc subpage.
--
--------------------------------------------------------------
--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>

Latest revision as of 14:07, 3 September 2020