Welcome to the Cumulus Support forum.

Latest Cumulus MX V4 release 4.4.2 (build 4085) - 12 March 2025

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Legacy Cumulus 1 release 1.9.4 (build 1099) - 28 November 2014
(a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

If you are posting a new Topic about an error or if you need help PLEASE read this first viewtopic.php?p=164080#p164080

Help with web tag date/time format

Discussion and questions about Cumulus weather station software version 1. This section is the main place to get help with Cumulus 1 software developed by Steve Loft that ceased development in November 2014.
Post Reply
User avatar
mcrossley
Posts: 14388
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Help with web tag date/time format

Post by mcrossley »

I may be missing something here, but how can you incorporate a quotation mark - single or double - in a web tag date/time format string?

I have tried...
<#tag format="dd mmm yyyy' <"quoted_string"> 'hh:nn">
but the parser stops at the second double quote even though it is inside single quotes: "12 Jan 2014 <"

I tried double single quotes...
<#tag format="dd mmm yyyy' <''quoted_string''> 'hh:nn">
But the ignores the singles completely (obvious really, they simple close and re-open the 'string'): "12 Jan 2014 <quoted_string> 12:34"

I tried a backslash escape...
<#tag format="dd mmm yyyy' <\"quoted_string\"> 'hh:nn">
That drives the parser mad, I get all sorts of garbage out.

I know I can do this by using the tag twice, but is there a way of doing it one hit?
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: Help with web tag date/time format

Post by beteljuice »

Why do you need < and > ?

<#tag format="dd mmm yyyy 'unquoted_string' hh:nn">
Image
......................Imagine, what you will KNOW tomorrow !
User avatar
steve
Cumulus Author
Posts: 26672
Joined: Mon 02 Jun 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: Help with web tag date/time format

Post by steve »

The normal way to put quotes in a string in Delphi is to repeat the quote symbol to escape it, but because web tags are a mix of HTML and Delphi string processing, I don't think this will work. Can you not just use " and &apos; as you would usually in HTML in situations like this?
Steve
User avatar
mcrossley
Posts: 14388
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Help with web tag date/time format

Post by mcrossley »

Hmm, Steve the " method won't work. Betelejuice, I was trying to simply the format string... What I was trying to do was embed some HTML into the format string, ending up with a string like this...

'01 Jan 1900<span class="class_name"> at 01:23</span>'

You can probably see how that could be used.
User avatar
steve
Cumulus Author
Posts: 26672
Joined: Mon 02 Jun 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: Help with web tag date/time format

Post by steve »

mcrossley wrote:Hmm, Steve the " method won't work.
Yes, I see the problem if what you're trying to create is HTML. I think that there are too many language/protocol/conversion levels in the way for 'raw' quote characters to get handled properly inside the format parameter of a web tag.

The new version of Cumulus has to have web tag 'escaping' done differently, which is going to require people to change their format parameters, unfortunately, but it does mean that what you're trying to do here will work.
Steve
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: Help with web tag date/time format

Post by beteljuice »

If 'escaped' coding won't work, you'll have to format the <#webtag> twice ...

<#tag format="dd mmm yyyy"> <span class="class_name"><#tag format="hh:nn"></span>
Image
......................Imagine, what you will KNOW tomorrow !
User avatar
mcrossley
Posts: 14388
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Help with web tag date/time format

Post by mcrossley »

Opps, forgot to press Submit on this, so yes beteljuice this is what I have done...

Ah well, I guess I'll have to use a construct like...

'<#ByMonthTempHT mon=1 format="dd'&nbsp;'mmm'&nbsp;'yyyy"><span class="class_name"><#ByMonthTempHT mon=1 format=" 'at' hh:nn"></span>'

Only 216 times for the monthly records!
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: Help with web tag date/time format

Post by beteljuice »

You shouldn't need '&nbsp;' - a small saving ....
Image
......................Imagine, what you will KNOW tomorrow !
User avatar
mcrossley
Posts: 14388
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Help with web tag date/time format

Post by mcrossley »

You're right, I needed it before to stop the line splitting mid way through the date, now it is shorter on mobile devices it should not break anyway.

Got the monthly and all time records pages displaying better on my phone now, no line wrapping, but you lose the time and full spellings of Maximum/Minimum -> Max Min. Works for me
sfws
Posts: 1183
Joined: Fri 27 Jul 2012 11:29 am
Weather Station: Chas O, Maplin N96FY, N25FR
Operating System: rPi 3B+ with Buster (full)

Re: Help with web tag date/time format

Post by sfws »

Mark
You've done your 216 times typing now, but I did not pick this up when you posted the question.
It occurs to me that you did not need to type in

Code: Select all

 class="not-mobile"
multiple times, as you could simply have used in CSS the selector

Code: Select all

td span{     }
with any required definition as per that class. Or you could define a class at table level and prefix the selector with the class. The point is that Cumulus permits a HTML tag within the format and that can be used as the basis of changing the look for that part of the format.

I use the following

Code: Select all

<td><#apptempH> <#tempunit> <#TapptempH format="'at 'h:nn'&nbsp;'am/pm '<small>on' d/m/yyyy'</small>'"></td>
construct on one of my (not online) web pages, so the date is shorter as my chosen format for the time is longer. (My reason for using that time format is that some cells like those for total rain have the rollover time web tag in them and as that outputs '9am' for me I wanted all times to be consistent). If I was putting my web page online, I could redefine that small within td to hide it for mobiles.
User avatar
mcrossley
Posts: 14388
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Help with web tag date/time format

Post by mcrossley »

Thanks, yes that would be a better way of doing it, I may revisit this when I have time, but for now the power of regex and Sublime edit has got me going.
Post Reply