# HG changeset patch # User Matti Hamalainen # Date 1595347281 -10800 # Node ID 1ef78f020573b5d5486a5144d5c4a0d972975157 # Parent 601ef87a1c426a2c5a7bd4a9c529c3421d9858a7 weather: All tokens in the weather format string item must have a value for the item to be added to the output string. diff -r 601ef87a1c42 -r 1ef78f020573 weather.tcl --- a/weather.tcl Tue Jul 21 18:26:28 2020 +0300 +++ b/weather.tcl Tue Jul 21 19:01:21 2020 +0300 @@ -258,12 +258,21 @@ set astr "" foreach aitem $umsg { set atmp $aitem + set aok 1 + + # Map tokens to values if they are set foreach {akey aval} [array get uvals] { - if {$aval != ""} { - set atmp [string map [list "@${akey}@" $aval] $atmp] + if {[string match "*@${akey}@*" $atmp]} { + if {$aval != ""} { + set atmp [string map [list "@${akey}@" $aval] $atmp] + } else { + set aok 0 + } } } - if {$atmp != $aitem || [string first "@" $aitem] < 0} { + + # Add item to string if all tokens in string were found + if {$aok} { append astr $atmp } }