Modify

Opened 4 months ago

Last modified 3 months ago

#15726 new enhancement

Not returning the value when using tag()

Reported by: naoliv Owned by: team
Priority: normal Milestone:
Component: Core validator Version:
Keywords: mapcss Cc:

Description

Have this small validation rule:

*[foo = bar] {
        throwWarning: tr("something {0}={1}", "{0.key}", tag("{0.key}"));
}

and validate an object with foo=bar
We can see a message saying something foo=null

Of course the common usage is {0.value} instead tag("{0.key}"), but since tag(key_name) description says "get the value of the key key_name from the object in question", shouldn't we see the same result regardless which one we choose here?

JOSM:

Relative:URL: ^/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2018-01-02 00:31:23 +0100 (Tue, 02 Jan 2018)
Revision:13271
Build-Date:2018-01-02 02:33:50
URL:http://josm.openstreetmap.de/svn/trunk

Identification: JOSM/1.5 (13271 pt_BR) Linux Debian GNU/Linux unstable (sid)
Memory Usage: 576 MB / 5120 MB (173 MB allocated, but free)
Java version: 9.0.1+11-Debian-1, Oracle Corporation, OpenJDK 64-Bit Server VM
Screen: :0.0 1920x1080
Maximum Screen Size: 1920x1080
Java package: openjdk-9-jre:amd64-9.0.1+11-1
Java ATK Wrapper package: libatk-wrapper-java:all-0.33.3-13
VM arguments: [--illegal-access=warn, --add-modules=java.se.ee, -Dawt.useSystemAAFontSettings=on]
Dataset consistency test: No problems found

Attachments (0)

Change History (3)

comment:1 Changed 4 months ago by naoliv

As a real example (and for context), I was trying to test some rules for #15719:

*[distance =~ /^[0-9]+,[0-9]+$/],
*[ele =~ /^[0-9]+,[0-9]+$/],
*[height =~ /^[0-9]+,[0-9]+$/],
*[width =~ /^[0-9]+,[0-9]+$/] {
        throwWarning: tr("some message for the comma");
        fixAdd: concat("{0.key}=", replace(tag("{0.key}"), ",", "."));
}

But it deletes the key (since the value is null)

Last edited 4 months ago by naoliv (previous) (diff)

comment:2 Changed 4 months ago by Klumbumbus

cc

comment:3 Changed 3 months ago by Klumbumbus

Type: defectenhancement

more like an enhancement than a defect, see ticket:15719#comment:4

for now it works with examples similar to ticket:15719#comment:2 or r12215 or r13345

Last edited 3 months ago by Klumbumbus (previous) (diff)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain team.
as The resolution will be set.
to The owner will be changed from team to the specified user.
The owner will change to naoliv
as duplicate The resolution will be set to duplicate.The specified ticket will be cross-referenced with this ticket
The owner will be changed from team to anonymous.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.