<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div><blockquote type="cite" class=""><div class=""><div style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">J’essaie de mettre les parenthèses et les guillemets au bon endroit pour corriger ça…</div></div></blockquote><br class=""></div><div>J’ai essayé ça (inspiré de <a href="https://josm.openstreetmap.de/wiki/Help/Styles/MapCSSImplementation" class="">https://josm.openstreetmap.de/wiki/Help/Styles/MapCSSImplementation</a>):</div><div><ul class=""><li class=""><div class="wiki-code" style="margin: 1em 1.75em;"><div class="code" style="background-color: rgb(247, 247, 247); border: 1px solid rgb(215, 215, 215); border-top-left-radius: 0.3em; border-top-right-radius: 0.3em; border-bottom-right-radius: 0.3em; border-bottom-left-radius: 0.3em; padding: 0.25em; overflow: auto;"><pre style="margin-top: 0px; margin-bottom: 0px; overflow: auto; background-color: rgb(255, 255, 255);" class=""><span style="white-space: normal;" class="">*[mapillary][mapillary!~/^[a-zA-Z0-9_-]{22}$/][mapillary=~/pKey=[a-zA-Z0-9_-]{22}/] </span>
<span class="p">{</span></pre><pre style="margin-top: 0px; margin-bottom: 0px; overflow: auto; background-color: rgb(255, 255, 255);" class=""><span style="white-space: normal;" class=""> throwError: tr("mapillary tag should only contain image ID instead of full URL");</span>
_match<span class="o" style="font-weight: bold;">:</span> regexp_match<span class="p">(</span><span style="color: rgb(187, 136, 68);" class="">"</span><span class="s2" style="color: rgb(187, 136, 68);">pKey=([a-zA-Z0-9_-]{22})"</span><span class="o" style="font-weight: bold;">,</span> tag<span class="p">(</span><span style="color: rgb(187, 136, 68);" class="">"</span><span class="s2" style="color: rgb(187, 136, 68);">mapillary"</span><span class="p">));</span></pre><pre style="margin-top: 0px; margin-bottom: 0px; overflow: auto; background-color: rgb(255, 255, 255);" class=""> fixAdd<span class="o" style="font-weight: bold;">:</span> concat<span class="p">(</span><span style="color: rgb(187, 136, 68);" class="">"</span><span class="s2" style="color: rgb(187, 136, 68);">mapillary"</span><span class="o" style="font-weight: bold;">,</span> <span style="color: rgb(187, 136, 68);" class="">"</span><span class="s2" style="color: rgb(187, 136, 68);">="</span><span class="o" style="font-weight: bold;">,</span> get<span class="p">(</span>prop<span class="p">(</span><span class="s2" style="color: rgb(187, 136, 68);">"_match</span><span style="color: rgb(187, 136, 68);" class="">"</span><span class="p">)</span><span class="o" style="font-weight: bold;">,<font color="#009999" class="">1</font></span><span class="p">));</span></pre><pre style="margin-top: 0px; margin-bottom: 0px; overflow: auto; background-color: rgb(255, 255, 255);" class=""><span class="p">}</span>
</pre><div class=""><br class=""></div></div></div></li></ul></div><div><div class=""><br class=""></div><div class="">_match: doit provoquer une exception et du coup la règle n’est plus validée.</div></div><br class=""><div class="">Pour décomposer le test, ceci fonctionne :</div><div class=""><ul class=""><li class=""><div class="wiki-code" style="margin: 1em 1.75em;"><div class="code" style="background-color: rgb(247, 247, 247); border: 1px solid rgb(215, 215, 215); border-top-left-radius: 0.3em; border-top-right-radius: 0.3em; border-bottom-right-radius: 0.3em; border-bottom-left-radius: 0.3em; padding: 0.25em; overflow: auto;"><pre style="margin-top: 0px; margin-bottom: 0px; overflow: auto; background-color: rgb(255, 255, 255);" class=""><span style="white-space: normal;" class="">*[mapillary][mapillary!~/^[a-zA-Z0-9_-]{22}$/][mapillary=~/pKey=[a-zA-Z0-9_-]{22}/] </span>
<span class="p">{</span></pre><pre style="margin-top: 0px; margin-bottom: 0px; overflow: auto; background-color: rgb(255, 255, 255);" class=""><span style="white-space: normal;" class=""> throwError: tr("mapillary tag should only contain image ID instead of full URL");</span>
fixAdd<span class="o" style="font-weight: bold;">:</span> concat<span class="p">(</span><span style="color: rgb(187, 136, 68);" class="">"</span><span class="s2" style="color: rgb(187, 136, 68);">toto"</span><span class="o" style="font-weight: bold;">,</span> <span style="color: rgb(187, 136, 68);" class="">"</span><span class="s2" style="color: rgb(187, 136, 68);">="</span><span class="o" style="font-weight: bold;">,</span> <span style="color: rgb(187, 136, 68);" class="">"</span><span class="s2" style="color: rgb(187, 136, 68);">titi</span><span style="color: rgb(187, 136, 68);" class="">"</span><span class="p">)</span><span class="p">;</span></pre><pre style="margin-top: 0px; margin-bottom: 0px; overflow: auto; background-color: rgb(255, 255, 255);" class=""><span class="p">}</span></pre></div></div></li></ul><div class="">Comment afficher la « console » lors de l’exécution des règles ?</div></div><div class="">Ces instructions sont écrites en Java ou en Javascript ?</div><div class=""><br class=""></div><div class="">Pour obtenir la clé mapillary, peut-on utiliser directement ça <span class="p" style="background-color: rgb(255, 255, 255);">?</span><div class=""><font face="Courier New" class=""><span style="background-color: rgb(255, 255, 255);" class="">regexp_match</span><span class="p" style="background-color: rgb(255, 255, 255);">(</span><span class="s2" style="background-color: rgb(255, 255, 255);"><span style="caret-color: rgb(187, 136, 68); color: rgb(187, 136, 68);" class="">"</span><font color="#bb8844" class="">regex</font></span><span class="o" style="background-color: rgb(255, 255, 255);"><span style="caret-color: rgb(187, 136, 68); color: rgb(187, 136, 68);" class="">"</span><b class="">,</b></span><span style="background-color: rgb(255, 255, 255);" class=""> string</span></font><span class="p" style="background-color: rgb(255, 255, 255);"><font face="Courier New" class="">)[1];</font></span></div></div><div class=""><span class="p" style="background-color: rgb(255, 255, 255);"><font face="Courier New" class=""><br class=""></font></span></div><div class="">—</div><div class="">Yves</div><div class=""><br class=""></div><div class="">PS: comment « rafraîchir » le code d’une régle sans refaire les ~10 clics de souris pour recharger le fichier local contenant son code ?</div><div class=""><br class=""></div></body></html>