Différences entre versions de « Module:Encyclique »

De Gregorius 3.0
Sauter à la navigation Sauter à la recherche
 
(10 versions intermédiaires par 4 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 = 'Acerba Animi' ,
 +
args = {
 +
iri = 'https://gregorius.dsi.universite-paris-saclay.fr/wiki/Acerba_Animi' ,
 +
["Titre"] = 'Acerba Animi' ,
 +
["Date"] = '1932-09-29' ,
 +
["Siecle"] = 'XXe siècle' ,
 +
["Auteur"] = 'Pie XI' ,
 +
["Website"] = 'http://www.dsr.u-psud.fr/'
 +
    }
 +
}
 +
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 gregoriusProp = 'http://gregorius.dsi.universite-paris-saclay.fr/wiki/Property:'
 +
  local rdf = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'
 
   local rdfs = 'http://www.w3.org/2000/01/rdf-schema#'
 
   local rdfs = 'http://www.w3.org/2000/01/rdf-schema#'
   local daapProp = 'http://gregorius.fr/wiki/Property:'
+
   local gregoriusType = 'http://gregorius.dsi.universite-paris-saclay.fr/wiki/'
 
   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#'
 +
  local xsd = 'http://www.w3.org/2001/XMLSchema#'
 +
  local wdt = 'http://www.wikidata.org/prop/direct/'
 +
  local wd = 'http://www.wikidata.org/entity/'
 
   
 
   
   linkedwiki.setEndpoint(endpointUpsud)
+
   local dateFormat = "d M Y"
  linkedwiki.setSubject(linkedwiki.getCurrentIRI())
 
 
   
 
   
 +
local subject = linkedwiki.getCurrentIRI(); -- read the iri of the current page
 +
local object =  linkedwiki.new(subject)
 +
 +
object:removeSubject() -- delete all triples of this subject
 +
 
 +
 
 +
  mw.log(object:addPropertyWithIri(rdf..'type',gregoriusType..'Encyclique'))
 +
  mw.log(object:addPropertyString(rdfs..'label',f.args.Titre))
 +
  mw.log(object:addPropertyString(gregoriusProp..'siecle',f.args.Siecle))
 +
  mw.log(object:addProperty(gregoriusProp..'date',f.args.Date,xsd..'date'))
 +
  mw.log(object:addPropertyString(gregoriusProp..'auteur',f.args.Auteur))
 +
 
 +
  mw.log(object:addPropertyWithIri(rdfs..'seeAlso',f.args.Website))
 +
 
 +
  local dateFormat = "d M Y"
 
return capiunto.create( {
 
return capiunto.create( {
 
    -- bodyStyle = 'border: 15px solid red',
 
    -- bodyStyle = 'border: 15px solid red',
 
    bodyClass = 'gregoriusEncyclique',
 
    bodyClass = 'gregoriusEncyclique',
 
title =  'Encyclique',
 
title =  'Encyclique',
         top = linkedwiki.checkString(daapProp..'titre',f.args.Titre) ,
+
         top = f.args.Titre ,
 
topStyle = 'background:#0066CC;height:50px;font-size: 20px;color:white;vertical-align:middle',
 
topStyle = 'background:#0066CC;height:50px;font-size: 20px;color:white;vertical-align:middle',
bottom = linkedwiki.checkExternLink('Website',rdfs..'seeAlso',f.args.Website)
+
bottom = '['..f.args.Website..' Website]'
 
} )
 
} )
:addRow('Titre', linkedwiki.checkString(daapProp..'titre',f.args.Titre))
+
:addRow('Titre', f.args.Titre)
:addRow('Date', linkedwiki.checkString(daapProp..'date',f.args.Date))
+
:addRow('Date', f.args.Date,dateFormat)
:addRow('Siècle', linkedwiki.checkString(daapProp..'siecle',f.args.Siecle))
+
:addRow('Siècle', f.args.Siecle)
:addRow('Auteur', linkedwiki.checkString(daapProp..'auteur',f.args.Auteur))
+
:addRow('Auteur', f.args.Auteur)
:addWikitext( linkedwiki.getMaintenanceCategory() ..  "[[Category:Interdisciplinary Unit]]"
+
:addWikitext( object:getMaintenanceCategory() ..  "[[Category:Interdisciplinary Unit]]"
 
.."[[Category:Encyclique]]" )
 
.."[[Category:Encyclique]]" )
 
end
 
end
 
   
 
   
 
return p
 
return p

Version actuelle datée du 29 octobre 2021 à 12:55

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

--[[
-- Debug console

frame = mw.getCurrentFrame() -- Get a frame object
newFrame = frame:newChild{ -- Get one with args
	title = 'Acerba Animi' ,
 args = { 
 iri = 'https://gregorius.dsi.universite-paris-saclay.fr/wiki/Acerba_Animi' ,
["Titre"] = 'Acerba Animi' ,
["Date"] = '1932-09-29' ,
["Siecle"] = 'XXe siècle' ,
["Auteur"] = 'Pie XI' ,
["Website"] = 'http://www.dsr.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()) -- added by hand
 
	local endpointUpsud = 'http://opendata1.opendata.u-psud.fr/sparql'
 
   local gregoriusProp = 'http://gregorius.dsi.universite-paris-saclay.fr/wiki/Property:'
   local rdf = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'
   local rdfs = 'http://www.w3.org/2000/01/rdf-schema#'
   local gregoriusType = 'http://gregorius.dsi.universite-paris-saclay.fr/wiki/'
   local geo = 'http://www.w3.org/2003/01/geo/wgs84_pos#'
   local vcard = 'http://www.w3.org/2006/vcard/ns#'
   local xsd = 'http://www.w3.org/2001/XMLSchema#'
   local wdt = 'http://www.wikidata.org/prop/direct/'
   local wd = 'http://www.wikidata.org/entity/' 
 
   local dateFormat = "d M Y"
 
local subject = linkedwiki.getCurrentIRI(); -- read the iri of the current page
local object =  linkedwiki.new(subject)

object:removeSubject() -- delete all triples of this subject
   
   
   mw.log(object:addPropertyWithIri(rdf..'type',gregoriusType..'Encyclique'))
   mw.log(object:addPropertyString(rdfs..'label',f.args.Titre))
   mw.log(object:addPropertyString(gregoriusProp..'siecle',f.args.Siecle))
   mw.log(object:addProperty(gregoriusProp..'date',f.args.Date,xsd..'date'))
   mw.log(object:addPropertyString(gregoriusProp..'auteur',f.args.Auteur))
   
   mw.log(object:addPropertyWithIri(rdfs..'seeAlso',f.args.Website))
   
   local dateFormat = "d M Y"
	return capiunto.create( {
	    -- bodyStyle = 'border: 15px solid red',
	    bodyClass = 'gregoriusEncyclique',
		title =  'Encyclique',
        top = f.args.Titre ,
		topStyle = 'background:#0066CC;height:50px;font-size: 20px;color:white;vertical-align:middle',		
		bottom = '['..f.args.Website..' Website]'
	} )
	:addRow('Titre', f.args.Titre)
	:addRow('Date', f.args.Date,dateFormat)
	:addRow('Siècle', f.args.Siecle)
	:addRow('Auteur', f.args.Auteur)
	:addWikitext( object:getMaintenanceCategory() ..  "[[Category:Interdisciplinary Unit]]"
				.."[[Category:Encyclique]]" )
end
 
return p