Webtags/Parameters (preserving history): Difference between revisions

From Cumulus Wiki
Jump to navigationJump to search
m
m (Corrections)
(2 intermediate revisions by the same user not shown)
Line 138: Line 138:
Your options are described under the following subheadings:
Your options are described under the following subheadings:
* [[#Rounding to a specific number of decimal places]]
* [[#Rounding to a specific number of decimal places]]
* [[Multiple Output Format Modifier parameters for times and dates]]
* [[#Multiple Output Format Modifier parameters for times and dates]]


===Additional output modification parameters that are only available for MX users===
===Additional output modification parameters that are only available for MX users===
Line 565: Line 565:
|}
|}


====Month formats====
===Month formats===


All locales offer both numerical and alphabetical formats for representing months.
All locales offer both numerical and alphabetical formats for representing months.
Line 609: Line 609:
|}
|}


====Day formats====
===Day formats===


All locales offer both numerical and alphabetical formats for representing a day.
All locales offer both numerical and alphabetical formats for representing a day.
Line 648: Line 648:
|}
|}


====Date formats====
===Date formats===


The [[#Year formats]], [[#Month formats]], and [[#Day formats]] listed above can be combined to make up a date output modifier, but there are some other modifiers available that can produce whole dates.
The [[#Year formats]], [[#Month formats]], and [[#Day formats]] listed above can be combined to make up a date output modifier, but there are some other modifiers available that can produce whole dates.
Line 713: Line 713:
|}
|}


=== Literals in scripts===
If you are considering use of literals (such as a space) within a output format modifier in a script, then don't. Instead include whatever precedes the literal in a tag specification, then concatenate on the literal, and finally concatenate another tag specification for whatever is to follow the literal.  An example to make this clearer is <code>$MXDateTime = '<#date format=yyyy-MM-dd>' . 'T' . '<#time format=hh:mm:ss>';</code>, which is written in PHP Hypertext Pre-processor format, the literal 'T' has been inserted by using two separate web tags surrounding the literal.  The same approach applies if you wanted to replace that "T" with a space.  (The explanation is that Cumulus (1 and MX) requires single quotes round a literal, but the script language requires any string to be enclosed in quotes, and double quotes are required by Cumulus round any complex specifier including any that include a space or other literal).


===Use of spaces===
===Use of spaces===
If you are considering use of literals (such as a space) within a output format modifier in a script, then don't. Instead include whatever precedes the literal in a tag specification, then concatenate on the literal, and finally concatenate another tag specification for whatever is to follow the literal.  An example to make this clearer is <code>$MXDateTime = '<#date format=yyyy-MM-dd>' . 'T' . '<#time format=hh:mm:ss>';</code>, which is written in PHP Hypertext Pre-processor format, the literal 'T' has been inserted by using two separate web tags surrounding the literal.  The same approach applies if you wanted to replace that "T" with a space.  (The explanation is that Cumulus (1 and MX) requires single quotes round a literal, but the script language requires any string to be enclosed in quotes, and double quotes are required by Cumulus round any complex specifier including any that include a space or other literal).


[[File:Badge vMx.png]]The first complication is that the parser that interprets time/date characters has two ways of interpreting a space character, depending on what immediately follows.  In the tables, below, I have used a "%" in various places. In any of those places with a "%", you can insert a space instead,  understanding that space is not a gap between format characters, but simply an alternative to "%" as a special character.  To explain the two ways of interpreting spaces consider as an example '''<#TpressTH format=" h:mm tt">'''. In that example the two spaces are interpreted in two different ways! The "space" before "h" is treated as the same as "%", but as the ''mm'' and ''tt'' are multi-character symbols, that does insert a space after the minutes but before the am/pm. I discuss this later in [[#Migrating from legacy Cumulus 1 to MX]] section.
[[File:Badge vMx.png]]The first complication is that the parser that interprets time/date characters has two ways of interpreting a space character, depending on what immediately follows.  In the tables, below, I have used a "%" in various places. In any of those places with a "%", you can insert a space instead,  understanding that space is not a gap between format characters, but simply an alternative to "%" as a special character.  To explain the two ways of interpreting spaces consider as an example '''<#TpressTH format=" h:mm tt">'''. In that example the two spaces are interpreted in two different ways! The "space" before "h" is treated as the same as "%", but as the ''mm'' and ''tt'' are multi-character symbols, that does insert a space after the minutes but before the am/pm. I discuss this later in [[#Migrating from legacy Cumulus 1 to MX]] section.
Line 729: Line 730:


Literals are discussed fully in the [[#Including literals in format parameters]] sub-section later. If we want to include other characters not to be interpreted by the date time parameter parser, and spaces, then both double and single quotes must be used, and the spaces must be within the single quotes.  An example, that shows all the options that MX allows, with literals is <code> <#TpressH format="\a't 'h:mm'&nbsp;' tt' <nowiki><small>on 'd/M/yyyy' </small></nowiki>'"> </code>.
Literals are discussed fully in the [[#Including literals in format parameters]] sub-section later. If we want to include other characters not to be interpreted by the date time parameter parser, and spaces, then both double and single quotes must be used, and the spaces must be within the single quotes.  An example, that shows all the options that MX allows, with literals is <code> <#TpressH format="\a't 'h:mm'&nbsp;' tt' <nowiki><small>on 'd/M/yyyy' </small></nowiki>'"> </code>.


=Some Extra Information=
=Some Extra Information=
5,838

edits

Navigation menu