diff --git a/culture-media.yaml b/culture-media.yaml index c66e3c6..6550a7d 100644 --- a/culture-media.yaml +++ b/culture-media.yaml @@ -9,34 +9,32 @@ query: ) feature: pre: | - {% set color = 'red' %} - {% set str = 'No image, wikimedia_commons or wikidata' %} + {% set cat = 'no' %} + {% set str = null %} {% if tags.wikidata %} - {% set color = 'blue' %} - {% set str = 'has wikidata tag' %} + {% set cat = 'wikidata' %} {% set wikidata = tags.wikidata|wikidataEntity %} {% if wikidata and wikidata.claims.P18|length == 0 %} - {% set color = '#007fff' %} - {% set str = 'has wikidata tag, but wikidata object does not have an image' %} + {% set cat = 'wikidata_no_image' %} {% endif %} {% if wikidata.claims.P31[0].mainsnak.datavalue.value.id in ['Q5'] %} - {% set color = 'magenta' %} - {% set str = "wikidata points to a human, should most likely be 'subject:wikidata'" %} + {% set cat = 'wikidata_human' %} {% endif %} {% elseif tags.wikipedia %} - {% set color = '#af00ff' %} - {% set str = 'wikipedia tag found without corresponding wikidata tag' %} + {% set cat = 'wikipedia_no_wikidata' %} {% elseif tags.wikimedia_commons or tags.image %} - {% set color = 'cyan' %} + {% set cat = 'has_image' %} {% set str = tags.wikimedia_commons ? 'has wikimedia_commons tag' : 'has image tag' %} {% endif %} + {% set def = const.categories[cat] %} + exclude: | {% if filter.category == 'wikidata_no_image' %} {{ (not wikidata) or (wikidata.claims.P18|length != 0) }} @@ -47,11 +45,11 @@ feature: {% endif %} body: | - {{ str }} + {{ str|default(def.text) }} style: color: | - {{ color }} + {{ def.color }} description: | {% if tags.historic and tags.historic != 'yes' %} @@ -68,8 +66,8 @@ feature: {% elseif tags.heritage %} {{ keyTrans('heritage') }} {% endif %} - markerSymbol: "{{ markerPointer({ fillColor: color })|raw }}" - listMarkerSymbol: "{{ markerCircle({ fillColor: color })|raw }}" + markerSymbol: "{{ markerPointer({ fillColor: def.color })|raw }}" + listMarkerSymbol: "{{ markerCircle({ fillColor: def.color })|raw }}" markerSign: | {% set icon = '' %} @@ -110,42 +108,14 @@ filter: info: |
- {{ markerCircle({ fillColor: 'red' })|raw }} - | -No image, wikimedia_commons or wikidata | -|
- {{ markerCircle({ fillColor: 'magenta' })|raw }} - | -wikidata tag points to a human, should most likely be 'subject:wikidata' | -|
- {{ markerCircle({ fillColor: '#af00ff' })|raw }} - | -wikipedia tag found without corresponding wikidata tag | -|
- {{ markerCircle({ fillColor: 'cyan' })|raw }} - | -image or wikimedia_commons tag but no wikidata | -|
- {{ markerCircle({ fillColor: '#007fff' })|raw }} + {{ markerCircle({ fillColor: def.color })|raw }} | -has wikidata tag, but wikidata object does not have an image | -|
- {{ markerCircle({ fillColor: 'blue' })|raw }} - | -has wikidata tag | +{{ def.text }} |