Différences entre versions de « Module:Lieu »
		
		
		
		
		
		Sauter à la navigation
		Sauter à la recherche
		
				
		
		
	
| m (1 version importée) | |||
| (4 versions intermédiaires par le même utilisateur non affichées) | |||
| Ligne 1 : | Ligne 1 : | ||
| + | --[[ | ||
| + | -- Debug console | ||
| + | frame = mw.getCurrentFrame() -- Get a frame object | ||
| + | newFrame = frame:newChild{ -- Get one with args | ||
| + | 	title = 'oeuvre_test' , | ||
| + |  args = {  | ||
| + | iri = 'http://157.136.249.54/wiki/oeuvre_test' , | ||
| + | --["Wikidata ID"] = 'Q335987', | ||
| + | ["Titre"] = 'Rome' , | ||
| + | ["Nom original"] = 'Roma', | ||
| + | ["Pays"] = 'Italie', | ||
| + | ["Maire"] = 'Francesco Paolo Tronca', | ||
| + | ["Code postal"] = '00100', | ||
| + | ["Gentile"] = 'Romains' | ||
| + |     } | ||
| + | } | ||
| + | mw.log(p.infobox( newFrame ) ) | ||
| + | ]] | ||
| + | |||
| + | |||
| local p = {} | local p = {} | ||
| Ligne 4 : | Ligne 24 : | ||
|      local capiunto = require 'capiunto' |      local capiunto = require 'capiunto' | ||
|      local linkedwiki = require 'linkedwiki' |      local linkedwiki = require 'linkedwiki' | ||
| − | + |     linkedwiki.setCurrentFrame(mw.getCurrentFrame()) -- added by hand | |
| + | |||
| 	local endpointUpsud = 'http://opendata1.opendata.u-psud.fr/sparql' | 	local endpointUpsud = 'http://opendata1.opendata.u-psud.fr/sparql' | ||
|     local rdfs = 'http://www.w3.org/2000/01/rdf-schema#' |     local rdfs = 'http://www.w3.org/2000/01/rdf-schema#' | ||
| − |     local  | + |     local rp = 'http://gregorius.dsi.universite-paris-saclay.fr/wiki/Property:' | 
|     local geo = 'http://www.w3.org/2003/01/geo/wgs84_pos#' |     local geo = 'http://www.w3.org/2003/01/geo/wgs84_pos#' | ||
|     local vcard = 'http://www.w3.org/2006/vcard/ns#' |     local vcard = 'http://www.w3.org/2006/vcard/ns#' | ||
| Ligne 14 : | Ligne 35 : | ||
|    local subject = linkedwiki.getCurrentIRI(); -- read the iri of the current page |    local subject = linkedwiki.getCurrentIRI(); -- read the iri of the current page | ||
|    local object =  linkedwiki.new(subject) |    local object =  linkedwiki.new(subject) | ||
| − | + | ||
| − | + |   if not linkedwiki.isEmpty(f.args['Nom original']) then | |
| + | 	mw.log(object:addProperty(rp..'Nomoriginal',f.args['Nom original'])) | ||
| + |   end  | ||
| + | |||
| + |   --object:setDebug(true) --uncomment for debugging | ||
| + | |||
| + | 	local infobox = capiunto.create( { | ||
| 	    bodyStyle = 'max-width : 20px', | 	    bodyStyle = 'max-width : 20px', | ||
| 	    bodyClass = 'gregoriusLieu', | 	    bodyClass = 'gregoriusLieu', | ||
| Ligne 23 : | Ligne 50 : | ||
| 		bottom = object:checkExternLink('Website',rdfs..'seeAlso',f.args.Website) | 		bottom = object:checkExternLink('Website',rdfs..'seeAlso',f.args.Website) | ||
| 	} ) | 	} ) | ||
| − | 	:addImage(object:checkImage(daapProp..' | + | |
| − | 	:addRow('Nom original', object:checkString(daapProp..'nom original',f.args.NomOriginal)) | + | 	infobox:addRow('Nom original',f.args['Nom original']) | 
| − | 	:addRow('Pays', object:checkString(daapProp..'pays',f.args.Pays)) | + | 	infobox:addRow('Pays',f.args['Pays']) | 
| − | 	:addRow('Maire', object:checkString(daapProp..'maire',f.args.Maire)) | + | 	infobox:addRow('Maire',f.args['Maire']) | 
| − | 	:addRow('Code postal', object:checkString(daapProp..'code postal',f.args.CodePostal)) | + | 	infobox:addRow('Code postal',f.args['Code postal']) | 
| − | 	:addRow(' | + | 	infobox:addRow('Gentile', f.args['Gentile']) | 
| − | 	:addWikitext( object:getMaintenanceCategory() ..  "[[Category:Interdisciplinary Unit]]" | + | |
| − | + | 	--infobox:addImage(object:checkImage(daapProp..'Image',f.args.Picture),"", "bodyStyle" ) | |
| + | 	--infobox:addRow('Nom original', object:checkString(daapProp..'nom original',f.args.NomOriginal)) | ||
| + | 	--infobox:addRow('Pays', object:checkString(daapProp..'pays',f.args.Pays)) | ||
| + | 	--infobox:addRow('Maire', object:checkString(daapProp..'maire',f.args.Maire)) | ||
| + | 	--infobox:addRow('Code postal', object:checkString(daapProp..'code postal',f.args.CodePostal)) | ||
| + | 	--infobox:addRow('Gentile', object:checkString(daapProp..'gentile',f.args.Gentile))	 | ||
| + | 	--infobox:addWikitext( object:getMaintenanceCategory() ..  "[[Category:Interdisciplinary Unit]]" | ||
| + | 	--			.."[[Category:Lieu]]" ) | ||
| + | |||
| + | 	return infobox | ||
| + | |||
| end | end | ||
| return p | return p | ||
Version actuelle datée du 29 octobre 2021 à 09:47
La documentation pour ce module peut être créée à Module:Lieu/doc
--[[
-- Debug console
frame = mw.getCurrentFrame() -- Get a frame object
newFrame = frame:newChild{ -- Get one with args
	title = 'oeuvre_test' ,
 args = { 
iri = 'http://157.136.249.54/wiki/oeuvre_test' ,
--["Wikidata ID"] = 'Q335987',
["Titre"] = 'Rome' ,
["Nom original"] = 'Roma',
["Pays"] = 'Italie',
["Maire"] = 'Francesco Paolo Tronca',
["Code postal"] = '00100',
["Gentile"] = 'Romains'
    }
}
mw.log(p.infobox( newFrame ) )
]]
local p = {}
 
function p.infobox(f)
    local capiunto = require 'capiunto'
    local linkedwiki = require 'linkedwiki'
    linkedwiki.setCurrentFrame(mw.getCurrentFrame()) -- added by hand
	local endpointUpsud = 'http://opendata1.opendata.u-psud.fr/sparql'
 
   local rdfs = 'http://www.w3.org/2000/01/rdf-schema#'
   local rp = '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)
  
  if not linkedwiki.isEmpty(f.args['Nom original']) then
	mw.log(object:addProperty(rp..'Nomoriginal',f.args['Nom original']))
  end 
  
  --object:setDebug(true) --uncomment for debugging
	local infobox = 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)
	} )
	infobox:addRow('Nom original',f.args['Nom original'])
	infobox:addRow('Pays',f.args['Pays'])
	infobox:addRow('Maire',f.args['Maire'])
	infobox:addRow('Code postal',f.args['Code postal'])
	infobox:addRow('Gentile', f.args['Gentile'])
	--infobox:addImage(object:checkImage(daapProp..'Image',f.args.Picture),"", "bodyStyle" )
	--infobox:addRow('Nom original', object:checkString(daapProp..'nom original',f.args.NomOriginal))
	--infobox:addRow('Pays', object:checkString(daapProp..'pays',f.args.Pays))
	--infobox:addRow('Maire', object:checkString(daapProp..'maire',f.args.Maire))
	--infobox:addRow('Code postal', object:checkString(daapProp..'code postal',f.args.CodePostal))
	--infobox:addRow('Gentile', object:checkString(daapProp..'gentile',f.args.Gentile))	
	--infobox:addWikitext( object:getMaintenanceCategory() ..  "[[Category:Interdisciplinary Unit]]"
	--			.."[[Category:Lieu]]" )
	
	return infobox
end
 
return p