« Module:Index template » : différence entre les versions

Contenu supprimé Contenu ajouté
m essai en ajoutant \n
simplification de la requête SPARQL
Ligne 144 :
 
--add an indicator linking to the usages
local query = 'SELECT ?item ?itemLabel ?pages ?page WHERE {\n ?item wdt:P996 <http://commons.wikimedia.org/wiki/Special:FilePath/' .. mw.uri.encode(mw.title.getCurrentTitle().text, 'PATH') .. '> .\n OPTIONAL { ?page schema:about ?item ; schema:isPartOf <https://fr.wikisource.org/> . }\n OPTIONAL { ?item wdt:P304 ?pages . }\n SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".\n}} \n ORDER BY xsd:integer(SUBSTR(?pages, 0, STRLEN(REPLACE(?pages, "^([0-9]+).*$", "$1"))))'
html:wikitext('<indicator name="index-scan-wikidata">[[File:Wikidata Query Service Favicon.svg|20px|éléments Wikidata|link=https://query.wikidata.org/embed.html#' .. mw.uri.encode(query, 'PATH') .. ']]</indicator>')
else