Template:U/doc: Difference between revisions

From Citizendium
Jump to navigation Jump to search
imported>David Yamakuchi
mNo edit summary
m (Text replacement - "Periodic Table of Elements" to "Periodic table of elements")
 
(2 intermediate revisions by one other user not shown)
Line 4: Line 4:


#Format the units notation such that it can be compactly displayed in tables, etc.  
#Format the units notation such that it can be compactly displayed in tables, etc.  
#Remove the units for certain pages (currently Periodic Table of Elements /Sandbox and /Data pages) that may need to do math with the numeric (magnitude) value.
#Remove the units for certain pages (currently Periodic table of elements /Sandbox and /Data pages) that may need to do math with the numeric (magnitude) value.
#Specify conditions under which the data is valid.
#Specify conditions under which the data is valid.


Line 22: Line 22:


<pre><includeonly>{{#switch: {{SUBPAGENAME}}
<pre><includeonly>{{#switch: {{SUBPAGENAME}}
|Other Properties='''''<small>{{{1|}}}</small>'''''{{#if:{{{2|}}}|<nowiki>*</nowiki> }}{{#if:{{{3|}}}|<sup><small>†</small></sup>}}{{#if:{{{4|}}}|<sup><small>‡</small></sup>}}
|Doc
|Doc
|doc
|doc
|Other Properties='''''<small>{{{1|}}}</small>'''''{{#if:{{{2|}}}|<nowiki>*</nowiki> }}{{#if:{{{3|}}}|<sup><small>†</small></sup>}}{{#if:{{{4|}}}|<sup><small>‡</small></sup>}}
|Properties='''''<small>{{{1|}}}</small>'''''{{#if:{{{2|}}}|<nowiki>*</nowiki>}}{{#if:{{{3|}}}|<sup><small>†</small></sup>}}{{#if:{{{4|}}}|<sup><small>‡</small></sup>}}
|Properties='''''<small>{{{1|}}}</small>'''''{{#if:{{{2|}}}|<nowiki>*</nowiki>}}{{#if:{{{3|}}}|<sup><small>†</small></sup>}}{{#if:{{{4|}}}|<sup><small>‡</small></sup>}}
|Sandbox=
|Sandbox=
|Data=
|Data=
|{{BASEPAGENAME}}={{{1|}}}{{#if:{{{2|}}}|<nowiki>*</nowiki>}}
|{{BASEPAGENAME}}={{#switch: {{BASEPAGENAME}}
                    |Periodic table of elements=
                    |{{#ifeq:{{NAMESPACE}}|Template||{{{1|}}}{{#if:{{{2|}}}|<nowiki>*</nowiki>}}}}
}}
|'''''<small>{{{1|}}}</small>'''''{{#if:{{{2|}}}|<nowiki>*</nowiki>}}{{#if:{{{3|}}}|<sup>†</sup>}}{{#if:{{{4|}}}|<sup>‡</sup>}}{{#if:{{{2|}}}|<blockquote><nowiki>*</nowiki>{{{2|}}}</blockquote>}}{{#if:{{{3|}}}|<blockquote>†{{{3|}}}</blockquote>}}{{#if:{{{4|}}}|<blockquote>‡{{{4|}}}</blockquote>}}
|'''''<small>{{{1|}}}</small>'''''{{#if:{{{2|}}}|<nowiki>*</nowiki>}}{{#if:{{{3|}}}|<sup>†</sup>}}{{#if:{{{4|}}}|<sup>‡</sup>}}{{#if:{{{2|}}}|<blockquote><nowiki>*</nowiki>{{{2|}}}</blockquote>}}{{#if:{{{3|}}}|<blockquote>†{{{3|}}}</blockquote>}}{{#if:{{{4|}}}|<blockquote>‡{{{4|}}}</blockquote>}}
}}</includeonly><noinclude>{{TlDoc}}</noinclude>
}}</includeonly><noinclude>{{TlDoc}}</noinclude>
</pre>
</pre>


== Explanation of code ==
== Explanation of code ==
Line 43: Line 46:
*In the case the subpage is a /Sandbox or a /Data page, do nothing.  don't include any unit info.  ''This'' subpage can do arithmetic operations on the data and won't want pesky unit information making things difficult.
*In the case the subpage is a /Sandbox or a /Data page, do nothing.  don't include any unit info.  ''This'' subpage can do arithmetic operations on the data and won't want pesky unit information making things difficult.


*In the case of SUBPAGENAME = BASEPAGENAME , we are '''''in''''' an article!  Just show a small, bold, italicized, unit with an asterisk if there are notes.  Don't actually show the notes themselves, or even more symbols if there are multiple notes.   
*In the case of SUBPAGENAME = BASEPAGENAME , we are '''''in''''' an article!  Just show a small, bold, italicized, unit with an asterisk if there are notes.  Don't actually show the notes themselves, or even more symbols if there are multiple notes.  The only exception is the Periodic table of elements article, where property values are displayed on the main article page without units.
 
*In all other cases show:
*In all other cases show:
**the small, bold, italicized, '''''<small>unit</small>'''''<sup>*†‡</sup> immediately followed by any symbols indicating notes.
**the small, bold, italicized, '''''<small>unit</small>'''''<sup>*†‡</sup> immediately followed by any symbols indicating notes.

Latest revision as of 04:42, 6 March 2024

Usage

This template is multi-purpose:

  1. Format the units notation such that it can be compactly displayed in tables, etc.
  2. Remove the units for certain pages (currently Periodic table of elements /Sandbox and /Data pages) that may need to do math with the numeric (magnitude) value.
  3. Specify conditions under which the data is valid.

Please see Oxygen/Boiling_point, {{Unit/Doc/Properties}}, and {{Unit/Doc/Data}} for examples of usage in context.

{{Unit|kJ/mol}}

Example:

{{Unit|kJ/mol}}

gives:

kJ/mol

Code

<includeonly>{{#switch: {{SUBPAGENAME}}
|Other Properties='''''<small>{{{1|}}}</small>'''''{{#if:{{{2|}}}|* }}{{#if:{{{3|}}}|<sup><small>†</small></sup>}}{{#if:{{{4|}}}|<sup><small>‡</small></sup>}}
|Doc
|doc
|Properties='''''<small>{{{1|}}}</small>'''''{{#if:{{{2|}}}|*}}{{#if:{{{3|}}}|<sup><small>†</small></sup>}}{{#if:{{{4|}}}|<sup><small>‡</small></sup>}}
|Sandbox=
|Data=
|{{BASEPAGENAME}}={{#switch: {{BASEPAGENAME}}
                    |Periodic table of elements=
                    |{{#ifeq:{{NAMESPACE}}|Template||{{{1|}}}{{#if:{{{2|}}}|*}}}}
}}
|'''''<small>{{{1|}}}</small>'''''{{#if:{{{2|}}}|*}}{{#if:{{{3|}}}|<sup>†</sup>}}{{#if:{{{4|}}}|<sup>‡</sup>}}{{#if:{{{2|}}}|<blockquote>*{{{2|}}}</blockquote>}}{{#if:{{{3|}}}|<blockquote>†{{{3|}}}</blockquote>}}{{#if:{{{4|}}}|<blockquote>‡{{{4|}}}</blockquote>}}
}}</includeonly><noinclude>{{TlDoc}}</noinclude>

Explanation of code

The behavior is controlled (#switched) by the SUBPAGENAME.

  • In the case the subpage is a /Doc, a /doc, or a /Properties, Show a small, bold, italicized, unit ({{{1|}}}) with an asterisk for note (#if: {{{2|}}}), sword for note2 (#if: {{{3|}}}), etc. Don't actually show the notes themselves.
  • In the case the subpage is a /Sandbox or a /Data page, do nothing. don't include any unit info. This subpage can do arithmetic operations on the data and won't want pesky unit information making things difficult.
  • In the case of SUBPAGENAME = BASEPAGENAME , we are in an article! Just show a small, bold, italicized, unit with an asterisk if there are notes. Don't actually show the notes themselves, or even more symbols if there are multiple notes. The only exception is the Periodic table of elements article, where property values are displayed on the main article page without units.
  • In all other cases show:
    • the small, bold, italicized, unit*†‡ immediately followed by any symbols indicating notes.

*Then do a line break and show each symbol again,

†followed by it's note.

‡Up to three notes are supported, separated by line breaks.