Page 1 of 2

monthlyrecord 'table'

Posted: Tue 26 Jan 2016 11:17 am
by laulau
Hi,
I have a monthlyrecord page with a table option (i think it was written by the beteljuice) that is no working with CMX.
I think it's perhaps a formating problem.
The page processed by cumulus C1 :http://meteo.laurentmey.fr/php/monthlyrecord1.php
The one processed by CMX :http://meteo.laurentmey.fr/php/monthlyrecord.php
The table don't appear anymore.
In the source code at line ~222 i can see
var hightempT = ["Impossible de trouver un guillemet correspondant pour le caractère '''.'dd'</b>, en <b>'yyyy'</b> à <b>'hh:mm'</b>'">","Impossible de trouver un guillemet correspondant pour le caractère .....
It seem that it is a webtag format error!
var hightempT = ["<#ByMonthTempHT mon=1 format=" 'Le <b>'dd'</b>, en <b>'yyyy'</b> à <b>'hh:mm'</b>'">","<#ByMonthTempHT mon=2 format="'Le <b>'dd'</b>, en <b>'yyyy ....
<b>'dd'</b> in text formating isn't accepted by CMX ?
Source code attached
Thanks

Re: monthlyrecord 'table'

Posted: Tue 26 Jan 2016 11:43 am
by mcrossley
dd should be OK, I certainly use it in lots of my tags.

I suggest you start building up the format string a bit at a time and see exactly which part is causing the problem.

Re: monthlyrecord 'table'

Posted: Tue 26 Jan 2016 11:50 am
by mcrossley
I'd start by removing that leading space on the first array variable, I don't think it will matter, but it is inconsistent with the rest...

format=" 'Le <b>
to
format="'Le <b>

Re: monthlyrecord 'table'

Posted: Tue 26 Jan 2016 11:52 am
by steve
The closing ">" in "<b>" is being taken as the end of the web tag by the token parser. I'm not sure there's anything I can do about that.

Re: monthlyrecord 'table'

Posted: Tue 26 Jan 2016 11:57 am
by mcrossley
Ah, even though it is in a string, :bash:

You will have to do what I have done then in these variables (it's PHP but the same principle), where I put the HTML outside the tag code (I probably hit the same problem and forgot about it!)...

Code: Select all

$ByMonthTempHTmon1='<#ByMonthTempHT mon=1 format="dd MMM yyyy"><span class="not-mobile"><#ByMonthTempHT mon=1 format="' at 'HH:mm"></span>';

Re: monthlyrecord 'table'

Posted: Tue 26 Jan 2016 12:01 pm
by steve
mcrossley wrote:Ah, even though it is in a string
Yes - I had to write the parser myself, and it's fairly dumb. The Delphi parser must take account of the start and end of quoted characters.

I am always happy to accept code submissions (in C#) for inclusion in MX ;)

Re: monthlyrecord 'table'

Posted: Tue 26 Jan 2016 12:12 pm
by mcrossley
I'll let you off then :lol: , I thought it would be part of the standard library. So do you strip out the predefined tags and pass them on to .ToString() for processing?

Re: monthlyrecord 'table'

Posted: Tue 26 Jan 2016 12:19 pm
by steve
It just scans the contents of the file for "<#", copying input to output, and then when it finds that, it scans for the next ">", and then extracts the text between those two and passes it on to the tag processing code. The returned processed tag is appended to the output instead of the tag.

Re: monthlyrecord 'table'

Posted: Wed 27 Jan 2016 12:49 pm
by laulau
The tooltips are now working as they should !

Re: monthlyrecord 'table'

Posted: Wed 27 Jan 2016 1:17 pm
by beteljuice
Good workaround Laurent, but sneaky 8-)
:clap:

Re: monthlyrecord 'table'

Posted: Wed 27 Jan 2016 1:29 pm
by laulau
Yes it is a DIY solution, I'm no expert in coding. there is certainly a more professional solution.

Re: monthlyrecord 'table'

Posted: Wed 27 Jan 2016 1:45 pm
by mcrossley
laulau wrote:there is certainly a more professional solution.
Yeah, write Steve a decent parser routine :lol:

For brevity, you can concatenate the replace functions (and as you use a global variable get rid of the 'evil')...

var tvt = window[tip_var_time[y]][x].replace(/bld/g,"</b>").replace(/BLD/g,"<b>");

Good solution though.

Re: monthlyrecord 'table'

Posted: Fri 29 Jan 2016 11:05 am
by beteljuice
Something isn't right Laurent ....

You've commented out the eval but it still seems to work ???
... but your wet / dry dates are a nonsense !

I'll think about it when my brain is in gear.

Probably a sequence thing ?

Re: monthlyrecord 'table'

Posted: Fri 29 Jan 2016 1:31 pm
by laulau
beteljuice wrote:... but your wet / dry dates are a nonsense !
:oops:

Code: Select all

format="yyyy,m,dd
shoud be

Code: Select all

format="yyyy,%M,dd
with CMX

Re: monthlyrecord 'table'

Posted: Fri 29 Jan 2016 4:49 pm
by beteljuice
Ahh :groan: that could cause problems in other scripts as well :shock:

Do I do seperate versions or put a user var for mx decisions ... I think I'll go and lie down for a bit.

Edit: That's rubbish ! - has to be seperate version because mx parser is before anything else !
.... unless ...