Chronos chronos left.png
Rusmed logo color.png
Chronos chronos right.png

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Différences entre les versions de « Module:Fo/data »

De Commission Historique
(Page créée avec « local fields = '_pageName,ZoteroKey,TitleItem,Author,Editor,Date,Date__precision,Place,ItemType,Publisher,PublicationTitle,Volume,PublicationYear,Pages,Url,FilingDate,Acce… »)
 
m
 
Ligne 11 : Ligne 11 :
if r['Date__precision'] == '3' then
if r['Date__precision'] == '3' then
bbib[r['ZoteroKey']]['Date'] = mw.text.truncate(r['Date'],4,'')
bbib[r['ZoteroKey']]['Date'] = mw.text.truncate(r['Date'],4,'')
end
if not r['ZoteroKey']['PublicationYear'] then
bbib[r['ZoteroKey']]['PublicationYear'] = bbib[r['ZoteroKey']]['Date']
end
end
end
end
return bbib
return bbib

Version actuelle datée du 24 février 2022 à 16:10

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

local fields = '_pageName,ZoteroKey,TitleItem,Author,Editor,Date,Date__precision,Place,ItemType,Publisher,PublicationTitle,Volume,PublicationYear,Pages,Url,FilingDate,AccessDate,Type,Number,IssuingAuthority,Archive,Medium,Interviewer,AccessDate'
local fieldds = mw.text.split(fields,',')
local args = {groupBy = 'ZoteroKey', orderBy = 'ZoteroKey', limit = 4000}
local bib = mw.ext.cargo.query('Zotero', fields, args)
local bbib={}
for _,r in ipairs(bib) do
	bbib[r['ZoteroKey']] = {}
	for _,f in ipairs(fieldds) do
		bbib[r['ZoteroKey']][f] = r[f] or ''
	end
	if r['Date__precision'] == '3' then
		bbib[r['ZoteroKey']]['Date'] = mw.text.truncate(r['Date'],4,'')
	end
	if not r['ZoteroKey']['PublicationYear'] then
		bbib[r['ZoteroKey']]['PublicationYear'] = bbib[r['ZoteroKey']]['Date']
	end
end
return bbib