Différences entre versions de « Module:User »
Sauter à la navigation
Sauter à la recherche
(Page créée avec « local p = {} function p.infobox(f) local capiunto = require 'capiunto' local linkedwiki = require 'linkedwiki' local endpointUpsud = 'http://opendata1.opendata... ») |
|||
(4 versions intermédiaires par 2 utilisateurs 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 = 'https://gregorius.dsi.universite-paris-saclay.fr/wiki/Utilisateur:Francois_Jankowiak' , | ||
+ | ["Fullname"] = 'François Jankowiak', | ||
+ | ["Email"] = 'francois.jankowiak@u-psud.fr' | ||
+ | } | ||
+ | } | ||
+ | mw.log(p.infobox( newFrame ) ) | ||
+ | ]] | ||
+ | |||
local p = {} | local p = {} | ||
Ligne 4 : | Ligne 18 : | ||
local capiunto = require 'capiunto' | local capiunto = require 'capiunto' | ||
local linkedwiki = require 'linkedwiki' | local linkedwiki = require 'linkedwiki' | ||
+ | linkedwiki.setCurrentFrame(mw.getCurrentFrame()) | ||
− | + | --linkedwiki.setDebug(true) | |
− | |||
local rdfs = 'http://www.w3.org/2000/01/rdf-schema#' | local rdfs = 'http://www.w3.org/2000/01/rdf-schema#' | ||
− | |||
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#' | ||
− | linkedwiki. | + | local subject = f.args.iri or linkedwiki.getCurrentIRI(); |
− | linkedwiki. | + | local object = linkedwiki.new(subject) |
− | |||
return capiunto.create( { | return capiunto.create( { | ||
-- bodyStyle = 'border: 15px solid red', | -- bodyStyle = 'border: 15px solid red', | ||
− | title = | + | title = object:checkLabelOfInternLink(subject, rdfs..'label',f.args.Title) , |
top = 'User', | top = 'User', | ||
topStyle = 'background:#cfc;font-size:larger', | topStyle = 'background:#cfc;font-size:larger', | ||
− | bottom = | + | bottom = object:checkExternLink('Website',rdfs..'seeAlso',f.args.Website) |
} ) | } ) | ||
− | :addRow('Fullname', | + | :addRow('Fullname', object:checkValue(vcard..'fn',f.args.Fullname)) |
− | :addRow('Email', | + | :addRow('Email', object:checkValue(vcard..'email',f.args.Email)) |
− | :addWikitext( | + | --:addRow('Organization', object:checkValue(vcard..'hasOrganizationUnit',f.args.Organization_1)) |
+ | --:addRow('Organization', object:checkValue(vcard..'hasOrganizationUnit',f.args.Organization_2)) | ||
+ | --:addRow('Organization', object:checkValue(vcard..'hasOrganizationUnit',f.args.Organization_3)) | ||
+ | :addWikitext( object:getMaintenanceCategory() .. "[[Catégorie:Utilisateur]]" ) | ||
end | end | ||
return p | return p |
Version actuelle datée du 29 octobre 2021 à 10:09
La documentation pour ce module peut être créée à Module:User/doc
--[[
-- Debug console
frame = mw.getCurrentFrame() -- Get a frame object
newFrame = frame:newChild{ -- Get one with args
title = 'oeuvre_test' ,
args = {
iri = 'https://gregorius.dsi.universite-paris-saclay.fr/wiki/Utilisateur:Francois_Jankowiak' ,
["Fullname"] = 'François Jankowiak',
["Email"] = 'francois.jankowiak@u-psud.fr'
}
}
mw.log(p.infobox( newFrame ) )
]]
local p = {}
function p.infobox(f)
local capiunto = require 'capiunto'
local linkedwiki = require 'linkedwiki'
linkedwiki.setCurrentFrame(mw.getCurrentFrame())
--linkedwiki.setDebug(true)
local rdfs = 'http://www.w3.org/2000/01/rdf-schema#'
local geo = 'http://www.w3.org/2003/01/geo/wgs84_pos#'
local vcard = 'http://www.w3.org/2006/vcard/ns#'
local subject = f.args.iri or linkedwiki.getCurrentIRI();
local object = linkedwiki.new(subject)
return capiunto.create( {
-- bodyStyle = 'border: 15px solid red',
title = object:checkLabelOfInternLink(subject, rdfs..'label',f.args.Title) ,
top = 'User',
topStyle = 'background:#cfc;font-size:larger',
bottom = object:checkExternLink('Website',rdfs..'seeAlso',f.args.Website)
} )
:addRow('Fullname', object:checkValue(vcard..'fn',f.args.Fullname))
:addRow('Email', object:checkValue(vcard..'email',f.args.Email))
--:addRow('Organization', object:checkValue(vcard..'hasOrganizationUnit',f.args.Organization_1))
--:addRow('Organization', object:checkValue(vcard..'hasOrganizationUnit',f.args.Organization_2))
--:addRow('Organization', object:checkValue(vcard..'hasOrganizationUnit',f.args.Organization_3))
:addWikitext( object:getMaintenanceCategory() .. "[[Catégorie:Utilisateur]]" )
end
return p