Opened 11 years ago
Closed 11 years ago
#9566 closed defect (fixed)
Small glitches/improvements in MapCSS validator
Reported by: | naoliv | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | 14.01 |
Component: | Core validator | Version: | |
Keywords: | Cc: |
Description
First issue:
Using a test with quotes like this:
*[name = *"addr:housename"] { throwWarning: tr("{0} and {1} are the same", "{0.key}", "{0.value}"); }
and validating something that fits on this rule we can see a duplicated warning message:
name and addr:housename are the same - name and addr:housename are the same (1)
This also happens when using (?i) for case insensitive matching, like this:
*[highway $= _link][name =~ /^(?i)acesso.*/] { throwWarning: tr("Don't use acesso in link highways"); }
we we also get a duplicated message:
Dont use acesso in link highways - Dont use acesso in link highways (1)
Second issue:
Instead doing this:
*[highway=motorway_link], *[highway=trunk_link], *[highway=primary_link], *[highway=secondary_link], *[highway=tertiary_link] (…)
I can use this:
*[highway $= _link] (…)
But I can't get the real value of this key:
"{0}.value" gives me only "_link" and "{0}.tag" gives me the full rule "highway=_link" (but still without the real value of the highway key)
Isn't it possible to get the real value?
It's similar with this other case:
*[name][source] { throwWarning: tr("name: {0} source: {1}", "{0.value}", "{1.value}"); }
It's not possible to use the real values of name or source.
Third issue:
It seems that the validator doesn't display single quotes like this:
*[highway] { throwWarning: tr("foo 'something' foo"); }
Using this:
*[highway] { throwWarning: tr("foo \'something\' foo"); }
It gives this as the output:
tr("foo \'something\'foo") - tr("foo \'something\'foo") (1)
Using double quotes also gives a wrong output:
*[highway] { throwWarning: tr("foo "something" foo"); }
Attachments (0)
Change History (6)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
- fixed in r6675
- This has to be done differently: use the
tag(key_name)
MapCSS function, see Help/Styles/MapCSSImplementation#Evalexpressions – making"{0.value}"
work as you expect, is quite some work - Single quotes have to be written as
''
, see Translations#Softwaretranslation
Feel free to improve Help/Validator/MapCSSTagChecker :-)
comment:3 by , 11 years ago
(sorry to ask things like this here, but I really don't know if there is a better place (and if there is I would like to know))
About 2, I did try this:
*[highway] { throwWarning: tr("foo: {0}", tag(highway))); }
with and without quotes on highway inside tr but I only see "foo: null" at the warning message.
I also tried
throwWarning: tr(concat("foo: ", tag(highway)));
with and without quotes.
I don't see any error on console.
comment:4 by , 11 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Sorry for the incorrect hint. Currently, the throwWarning
string is computed while initializing the checker. Thus, any access to a tag yields null
. I'll think about whether/how to change this.
comment:5 by , 11 years ago
Milestone: | → 14.01 |
---|
In 6675/josm: