Page MenuHomePhabricator

Generate WLE listeria lists on sv.wp
Closed, ResolvedPublic

Description

Generate the lists on subpages to w:sv:Wikipedia:Projekt naturgeografi or w:sv:Wikipedia:Projekt naturgeografi/WLE

One list for nature reserves per county + one for national parks.

Code for generating the ones for nature reserves these can be found below

1counties = {
2 u"Blekinge län": "Q102377",
3 u"Västra Götalands län": "Q103093",
4 u"Skåne län": "Q103659",
5 u"Jönköpings län": "Q103672",
6 u"Jämtlands län": "Q103679",
7 u"Norrbottens län": "Q103686",
8 u"Hallands län": "Q103691",
9 u"Gävleborgs län": "Q103699",
10 u"Kalmar län": "Q103707",
11 u"Dalarnas län": "Q103732",
12 u"Gotlands län": "Q103738",
13 u"Stockholms län": "Q104231",
14 u"Örebro län": "Q104257",
15 u"Kronobergs län": "Q104746",
16 u"Västerbottens län": "Q104877",
17 u"Västernorrlands län": "Q104891",
18 u"Uppsala län": "Q104926",
19 u"Östergötlands län": "Q104940",
20 u"Västmanlands län": "Q105075",
21 u"Värmlands län": "Q106789",
22 u"Södermanlands län": "Q106915"
23}
24
25template = u"""{{Wikipedia:Projekt naturgeografi/WLE/intro|%s}}
26{{Wikidatalista
27|sparql=SELECT ?item WHERE { ?item wdt:P3613 ?id . ?item wdt:P31 wd:Q179049 . ?item wdt:P131 ?muni . ?muni wdt:P131 wd:%s}
28|sort=label
29|section=131
30|min_section=2
31|columns=label:Namn,P131:Kommun,P276:Plats,P625:Koordinat,P3613:NVRID,P18:Bild,P373:Commonscat,item:wikidata
32|row_template=WLE-rad
33|header_template=WLE-huvud
34}}
35{{Wikidatalistavslut}}
36"""
37
38for name, wikidata in counties.iteritems():
39 print u'Naturreservat i %s' % name
40 print template % (name, wikidata)
41 print '------------------------'

Related Objects

Event Timeline

National park list can be found at Användare:André Costa (WMSE)/WLE-test/Nationalparker .

Both it and the code above would need a header explaining the images and where to go to add new images.

Id links added to commons and row templates

Created Wikipedia:Projekt naturgeografi/WLE/intro to stick at the top of the lists and updated the code snippet.

All pages created. They will just need a manual update when the import is done