Webtags (preserving history): Difference between revisions

m
Line 167: Line 167:
=== Output Parameter Differences between Cumulus 1 and Cumulus MX (Cumulus 3) ===
=== Output Parameter Differences between Cumulus 1 and Cumulus MX (Cumulus 3) ===


There are a number of differences between Cumulus 1 (C1) and Cumulus MX (MX). C1 can work with times in 14.24 format using a full stop to separate the figures, MX must have ':' between hour and minute numbers. The characters used to represent year, month, day, hour, minute, second, microsecond differ betweeb C1 and MX.
There are a number of differences between Cumulus 1 (C1) and Cumulus MX (MX). C1 can work with times in 14.24 format using a full stop to separate the figures, MX must have ':' between hour and minute numbers.  
 
The characters used to represent year, month, day, hour, minute, second, microsecond, also differ between C1 and MX.
 
In Cumulus 1 we are able to use "m" or "M" for two different meanings (minutes or month) depending on context. Similarly, in MX the same character sometimes has two different meanings depending on context, but this applies to lots of characters and the context is whether the character is used on its own or with other characters. '''Sounds confusing?''' Well it is complicated.


==== Explanation ====
==== Explanation ====
Line 179: Line 183:
==== When it causes problems ====
==== When it causes problems ====


This can cause problems when somebody moves from using Cumulus 1 to using MX. They need to revisit any templates or scripts where they use output modifiers to specify a date and/or time format. We have already explored this for [[Webtags#The_format_used_for_naming|NOAA report naming]].  
This can cause problems when somebody moves from using Cumulus 1 to using MX. They need to revisit any templates or scripts where they use output modifiers to specify a date and/or time format. We have already explored a very simple impact of this for [[Webtags#The_format_used_for_naming|NOAA report naming]].  


For web tags it is much more complicated, not only do we need to select the right case, we also have to cope with MX selectors having different meanings when they are on their own and when they appear with other selectors, finally where you put quotes within these format specifiers varies between Cumulus 1 and MX partly because the reserved characters change and partly because MX introduces the concept of escaping characters.  
For web tags it is much more complicated, not only do we need to select the right case, we also have to cope with MX selectors having different meanings when they are on their own and when they appear with other selectors, finally where you put quotes within these format specifiers varies between Cumulus 1 and MX partly because the reserved characters change and partly because MX introduces the concept of escaping characters.  


Confused now? I'm not surprised, but maybe some examples will help before we actually list the available modifiers.
'''Confused even more now?''' I'm not surprised, but maybe some examples will help before we actually list the available modifiers.


==== Examples ====
==== Examples ====
Line 199: Line 203:
*#Similarly, ''<#MonthTempHD format="%M">'' is NOT a single character format modifier and therefore the 'M' acts as a custom modifier and causes the same date for the highest temperature in the month to be returned as the month number '7'.
*#Similarly, ''<#MonthTempHD format="%M">'' is NOT a single character format modifier and therefore the 'M' acts as a custom modifier and causes the same date for the highest temperature in the month to be returned as the month number '7'.


The other change with the "format" parameter is the different way that MONO and .NET  escape any characters that are not being used as format specifiers.
In both Cumulus 1 and MX if you want a space character within your output, the output specifiers must be enclosed in double quotes. If that space character is next to a non modifier (e.g. around word "at") then the single quote needing to surround the at should be widened to include the spaces in MX, but Cumulus 1 does not care if single quotes excluded spaces. However, with MX, single quotes enclose multiple characters, but there is an alternative way to deal with some single verbatim characters to cover next.
 
So let us compare these two alternative ways that MONO and .NET  escape any characters that are not being used as format specifiers.
* In [[File:badge v1.png]]Delphi you can put the 'verbatim' characters inside single quotes (Cumulus 1); this is often used to (in English) include words like ' on ' and ' at ' in the formatted output.
* In [[File:badge v1.png]]Delphi you can put the 'verbatim' characters inside single quotes (Cumulus 1); this is often used to (in English) include words like ' on ' and ' at ' in the formatted output.
*in [[File:Badge vMx.png]].NET or MONO you can still use single quotes, but alternatively you can escape each verbatim character with a backslash as prefix (Cumulus MX). You may need to use both single quotes and back slashes in some format specifiers, depending whether the characters you want to include can be interpreted as control characters (yes, backslash is also used to escape control characters, so for some characters such as those in "on" and "at" [\n will produce new line not the letter n, \t will produce a tab not the letter t] you must use the literal approach to include them in your format).
*in [[File:Badge vMx.png]].NET or MONO you can still use single quotes (as mentioned above extended to include adjacent spaces),
** but alternatively you can escape each verbatim character with a backslash as prefix (Cumulus MX).  
* You may need to use both single quotes and back slashes in some format specifiers, depending whether the characters you want to include can be interpreted as control characters (yes, backslash is also used to escape control characters, so backslash will NOT work for some characters such as those in "on" and "at" [\n will produce new line not the letter n, \t will produce a tab not the letter t]), consequently for some characters you must use the literal approach to include them in your format.


==== Using HTML tags within format parameters (available in MX only) ====
==== Using HTML tags within format parameters (available in MX only) ====
5,838

edits