Différences entre versions de « Module:Lieu »

De Gregorius 3.0
Sauter à la navigation Sauter à la recherche
Ligne 12 : Ligne 12 :
 
   local vcard = 'http://www.w3.org/2006/vcard/ns#'
 
   local vcard = 'http://www.w3.org/2006/vcard/ns#'
 
   
 
   
  linkedwiki.setEndpoint(endpointUpsud)
+
  local subject = linkedwiki.getCurrentIRI(); -- read the iri of the current page
  linkedwiki.setSubject(linkedwiki.getCurrentIRI())
+
  local object =  linkedwiki.new(subject)
 
   
 
   
 
return capiunto.create( {
 
return capiunto.create( {
    bodyStyle = 'width : 25%',
+
    bodyStyle = 'max-width : 20px',
 
    bodyClass = 'gregoriusLieu',
 
    bodyClass = 'gregoriusLieu',
title =  linkedwiki.checkLink(linkedwiki.getCurrentIRI(), rdfs..'label',f.args.Title)  ,
+
title =  object:checkLink(subject, rdfs..'label',f.args.Title)  ,
 
         top = 'Lieu',
 
         top = 'Lieu',
 
topStyle = 'background:#99FFCC;font-size:larger',
 
topStyle = 'background:#99FFCC;font-size:larger',
bottom = linkedwiki.checkExternLink('Website',rdfs..'seeAlso',f.args.Website)
+
bottom = object:checkExternLink('Website',rdfs..'seeAlso',f.args.Website)
 
} )
 
} )
:addImage(linkedwiki.checkImage(daapProp..'picture',f.args.Picture),"", "city_image" )
+
:addImage(object:checkImage(daapProp..'picture',f.args.Picture),"", "bodyStyle" )
:addRow('Nom original', linkedwiki.checkString(daapProp..'nom original',f.args.NomOriginal))
+
:addRow('Nom original', object:checkString(daapProp..'nom original',f.args.NomOriginal))
:addRow('Pays', linkedwiki.checkString(daapProp..'pays',f.args.Pays))
+
:addRow('Pays', object:checkString(daapProp..'pays',f.args.Pays))
:addRow('Maire', linkedwiki.checkString(daapProp..'maire',f.args.Maire))
+
:addRow('Maire', object:checkString(daapProp..'maire',f.args.Maire))
:addRow('Code postal', linkedwiki.checkString(daapProp..'code postal',f.args.CodePostal))
+
:addRow('Code postal', object:checkString(daapProp..'code postal',f.args.CodePostal))
:addRow('Gentilé', linkedwiki.checkString(daapProp..'gentile',f.args.Gentile))
+
:addRow('Gentilé', object:checkString(daapProp..'gentile',f.args.Gentile))
:addWikitext( linkedwiki.getMaintenanceCategory() ..  "[[Category:Interdisciplinary Unit]]"
+
:addWikitext( object:getMaintenanceCategory() ..  "[[Category:Interdisciplinary Unit]]"
 
.."[[Category:Lieu]]" )
 
.."[[Category:Lieu]]" )
 
end
 
end
 
   
 
   
 
return p
 
return p

Version du 22 juin 2021 à 13:55

La documentation pour ce module peut être créée à Module:Lieu/doc

local p = {}
 
function p.infobox(f)
    local capiunto = require 'capiunto'
    local linkedwiki = require 'linkedwiki'
 
	local endpointUpsud = 'http://opendata1.opendata.u-psud.fr/sparql'
 
   local rdfs = 'http://www.w3.org/2000/01/rdf-schema#'
   local daapProp = 'http://gregorius.dsi.universite-paris-saclay.fr/wiki/Property:'
   local geo = 'http://www.w3.org/2003/01/geo/wgs84_pos#'
   local vcard = 'http://www.w3.org/2006/vcard/ns#'
 
  local subject = linkedwiki.getCurrentIRI(); -- read the iri of the current page
  local object =  linkedwiki.new(subject)
 
	return capiunto.create( {
	    bodyStyle = 'max-width : 20px',
	    bodyClass = 'gregoriusLieu',
		title =  object:checkLink(subject, rdfs..'label',f.args.Title)  ,
        top = 'Lieu',
		topStyle = 'background:#99FFCC;font-size:larger',		
		bottom = object:checkExternLink('Website',rdfs..'seeAlso',f.args.Website)
	} )
	:addImage(object:checkImage(daapProp..'picture',f.args.Picture),"", "bodyStyle" )
	:addRow('Nom original', object:checkString(daapProp..'nom original',f.args.NomOriginal))
	:addRow('Pays', object:checkString(daapProp..'pays',f.args.Pays))
	:addRow('Maire', object:checkString(daapProp..'maire',f.args.Maire))
	:addRow('Code postal', object:checkString(daapProp..'code postal',f.args.CodePostal))
	:addRow('Gentilé', object:checkString(daapProp..'gentile',f.args.Gentile))	
	:addWikitext( object:getMaintenanceCategory() ..  "[[Category:Interdisciplinary Unit]]"
				.."[[Category:Lieu]]" )
end
 
return p