Zum Inhalt springen

Modul:FilmRef

aus Wikipedia, der freien Enzyklopädie
Dies ist eine alte Version dieser Seite, zuletzt bearbeitet am 10. November 2022 um 02:30 Uhr durch Vollbracht (Diskussion | Beiträge) (AZ: Die Seite wurde neu angelegt: --[=[ FilmRef 2022-11-10 reference for films by Wikidata Autor: Vollbracht ]=] local p = {} local _, SDA = pcall(require, "Modul:SimpleDataAccess") local _, t = pcall(require, "Modul:Title") local Title = t.service PREF_LANG = 'Deutsch' p.ref = function(frame) local wdo = frame.args.wdObject if not wdo then wdo = frame.args[1] end if not wdo:match('Q%d*') then return '' end if not wdo t…). Sie kann sich erheblich von der aktuellen Version unterscheiden.
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Vorlagenprogrammierung Diskussionen Lua Test Unterseiten
Modul Deutsch English

Modul: Dokumentation

Diese Seite enthält Code in der Programmiersprache Lua. Einbindungszahl Cirrus


--[=[ FilmRef 2022-11-10
	reference for films by Wikidata

	Autor: Vollbracht
	
]=]

local p = {}

local _, SDA = pcall(require, "Modul:SimpleDataAccess")
local _, t = pcall(require, "Modul:Title")
local Title = t.service

PREF_LANG = 'Deutsch'

p.ref = function(frame)
	local wdo = frame.args.wdObject
	if not wdo then wdo = frame.args[1] end
	if not wdo:match('Q%d*') then return '' end
	if not wdo then wdo = mw.wikibase.getEntityIdForCurrentPage() end
	if not wdo then return '' end
	local imdbID = SDA.MainSnackValue(wdo, 'P345')
	local ldifID = SDA.MainSnackValue(wdo, 'P3107')
	local foundID = false
	local IDs = {}
	if imdbID and imdbID ~= '' then
		table.insert(IDs,	'[[Internet Movie Database|IMDb]]: [https://www.imd'
						..	'b.com/title/' .. imdbID .. ' ' .. imdbID .. ']')
		foundID = true
	end
	if ldifID and ldifID ~= '' then
		table.insert(IDs,	'[[Lexikon des internationalen Films|LdiF]]: [https'
						..	'://www.filmdienst.de/film/details/' .. ldifID ' '
						..	ldifID .. ']')
		foundID = true
	end
	if not foundID then return '' end
	if imdbID == '' then return '' end
	local tSource = Title:new(wdo)
	if not tSource then return '' end
	local title = tSource.title.text
	local regie = SDA.MainSnackValue(wdo, 'P57')
	local country = SDA.MainSnackValue(wdo, 'P495')
	local year = SDA.MainSnackValue(wdo, 'P577')
	local result = '<ref'
	local group = frame.args.group
	if group and group ~= '' then
		result = result .. ' group="' .. group .. '"'
	end
	local name = frame.args.name
	if name and name ~= '' then
		result = result .. ' name="' .. name .. '"'
	end
	result = result .. '>'
	if regie and regie ~= '' then
		result = result .. 'Film von ' .. regie .. ': '
	else result = result .. 'Film: ' end
	result = result .. tSource:titleLink() .. '. '
	if country or year then
		result = result .. table.concat({country, year}, ' ') .. ', '
	end
	result =	result .. ' ' .. table.concat(IDs, ', ')
	local b = tSource:infoBrace(nil, nil, 1)
	if b and b ~= '' then result = result .. ' ' .. b end
	return frame:preprocess(result .. '.</ref>')
end

return p