Browse Source

cycle_routes, hiking_routes: improve code

pt
parent
commit
256dc89193
  1. 13
      cycle_routes.json
  2. 20
      hiking_routes.json

13
cycle_routes.json

@ -27,7 +27,7 @@
"{% set refs = [] %}", "{% set refs = [] %}",
"", "",
"{% for master in masters %}", "{% for master in masters %}",
" {% set _p = {icn:0,ncn:1,rcn:2,lcn:3}[master.tags.network] %}",
" {% set _p = {icn:0,ncn:1,rcn:2,lcn:3}[master.tags.network]|default(4) %}",
" {% if _p < priority %}", " {% if _p < priority %}",
" {% set priority = _p %}", " {% set priority = _p %}",
" {% set network = master.tags.network %}", " {% set network = master.tags.network %}",
@ -39,11 +39,10 @@
], ],
"title": "", "title": "",
"body": [ "body": [
"<h4>Routes</h4>",
"<ul>", "<ul>",
"{% for master in masters %}", "{% for master in masters %}",
" {% if master.tags.public_transport != 'stop_area' %}",
" <li data-object=\"{{ master.id }}\"><b>{{ master.tags.name|default(master.tags.ref) }}</b> <i>{{ tagTrans('network', master.tags.network) }}</i></li>",
" {% endif %}",
" <li data-object=\"{{ master.id }}\"><b>{{ master.tags.name|default(master.tags.ref) }}</b>{% if master.tags.network %} <i>{{ tagTrans('network', master.tags.network) }}</i>{% endif %}</li>",
"{% endfor %}", "{% endfor %}",
"</ul>" "</ul>"
], ],
@ -74,6 +73,10 @@
"lcn": { "lcn": {
"color": "#0000ff", "color": "#0000ff",
"zoom": 15 "zoom": 15
},
"": {
"color": "#007fff",
"zoom": 15
} }
}, },
"info": [ "info": [
@ -82,7 +85,7 @@
"{% if data.zoom <= map.zoom %}", "{% if data.zoom <= map.zoom %}",
" <tr>", " <tr>",
" <td>{{ markerLine({ 'width': 4, color: data.color })|raw }}</td>", " <td>{{ markerLine({ 'width': 4, color: data.color })|raw }}</td>",
" <td>{{ tagTrans('network', value) }}</td>",
" <td>{% if value %}{{ tagTrans('network', value) }}{% else %}{{ trans('unknown') }}{% endif %}</td>",
" </tr>", " </tr>",
"{% endif %}", "{% endif %}",
"{% endfor %}", "{% endfor %}",

20
hiking_routes.json

@ -15,9 +15,9 @@
}, },
"members": true, "members": true,
"feature": { "feature": {
"priority": "{{ {iwn:0,nwn:1,rwn:2,lwn:3}[tags.network] }}",
"description": "{{ tagTrans('network', tags.network) }}",
"listMarkerSymbol": "{{ markerLine({ 'width': 4, 'color': const[tags.network].color })|raw }}",
"priority": "{{ {iwn:0,nwn:1,rwn:2,lwn:3}[tags.network]|default(4) }}",
"description": "{% if tags.network %}{{ tagTrans('network', tags.network) }}{% endif %}",
"listMarkerSymbol": "{{ markerLine({ 'width': 4, 'color': const[tags.network|default('')].color })|raw }}",
"styles": "" "styles": ""
}, },
"memberFeature": { "memberFeature": {
@ -27,7 +27,7 @@
"{% set refs = [] %}", "{% set refs = [] %}",
"", "",
"{% for master in masters %}", "{% for master in masters %}",
" {% set _p = {iwn:0,nwn:1,rwn:2,lwn:3}[master.tags.network] %}",
" {% set _p = {iwn:0,nwn:1,rwn:2,lwn:3}[master.tags.network]|default(4) %}",
" {% if _p < priority %}", " {% if _p < priority %}",
" {% set priority = _p %}", " {% set priority = _p %}",
" {% set network = master.tags.network %}", " {% set network = master.tags.network %}",
@ -37,13 +37,11 @@
" {% endif %}", " {% endif %}",
"{% endfor %}" "{% endfor %}"
], ],
"title": "",
"body": [ "body": [
"<h4>Routes</h4>",
"<ul>", "<ul>",
"{% for master in masters %}", "{% for master in masters %}",
" {% if master.tags.public_transport != 'stop_area' %}",
" <li data-object=\"{{ master.id }}\"><b>{{ master.tags.name|default(master.tags.ref) }}</b> <i>{{ tagTrans('network', master.tags.network) }}</i></li>",
" {% endif %}",
" <li data-object=\"{{ master.id }}\"><b>{{ master.tags.name|default(master.tags.ref) }}</b>{% if master.tags.network %} <i>{{ tagTrans('network', master.tags.network) }}</i>{% endif %}</li>",
"{% endfor %}", "{% endfor %}",
"</ul>" "</ul>"
], ],
@ -74,6 +72,10 @@
"lwn": { "lwn": {
"color": "#0000ff", "color": "#0000ff",
"zoom": 14 "zoom": 14
},
"": {
"color": "#007fff",
"zoom": 14
} }
}, },
"info": [ "info": [
@ -82,7 +84,7 @@
"{% if data.zoom <= map.zoom %}", "{% if data.zoom <= map.zoom %}",
" <tr>", " <tr>",
" <td>{{ markerLine({ 'width': 4, color: data.color })|raw }}</td>", " <td>{{ markerLine({ 'width': 4, color: data.color })|raw }}</td>",
" <td>{{ tagTrans('network', value) }}</td>",
" <td>{% if value %}{{ tagTrans('network', value) }}{% else %}{{ trans('unknown') }}{% endif %}</td>",
" </tr>", " </tr>",
"{% endif %}", "{% endif %}",
"{% endfor %}", "{% endfor %}",

Loading…
Cancel
Save