Zum Inhalt springen

„Modul:WikibaseQ“ – Versionsunterschied

aus AufEinWort, der freien Forschung
Die Seite wurde neu angelegt: „local util = require('Module:WikibaseUtil') local p = {} local function buildSubtitle(args, entityId) -- Q: sichtbarer Untertitel = Beschreibung local s = args.subtitle if s and s ~= '' then s = tostring(s) local low = s:lower() if low == 'nein' or low == '0' then return nil end if low ~= 'ja' and low ~= 'auto' then return util.trim(s) end end return util.getDescription(entityId) end function p.link(frame) local args = util.getArgs(fr…“
 
KKeine Bearbeitungszusammenfassung
Zeile 1: Zeile 1:
local util = require('Module:WikibaseUtil')
local util = require('Module:Wikibase')
local p = {}
local p = {}



Version vom 16. Dezember 2025, 13:13 Uhr

Die Dokumentation für dieses Modul kann unter Modul:WikibaseQ/Doku erstellt werden

local util = require('Module:Wikibase')
local p = {}

local function buildSubtitle(args, entityId)
	-- Q: sichtbarer Untertitel = Beschreibung
	local s = args.subtitle
	if s and s ~= '' then
		s = tostring(s)
		local low = s:lower()
		if low == 'nein' or low == '0' then return nil end
		if low ~= 'ja' and low ~= 'auto' then
			return util.trim(s)
		end
	end
	return util.getDescription(entityId)
end

function p.link(frame)
	local args = util.getArgs(frame)
	local entityId = util.detectEntityId(args)
	if not entityId then return '' end
	local label = args.label or util.getEntityLabelOrLemma(entityId) or entityId
	local line1 = string.format('%s %s', entityId, label)
	return util.buildEntityLink(entityId, line1, args.target)
end

function p.render(frame)
	local args = util.getArgs(frame)
	local entityId = util.detectEntityId(args)
	if not entityId then return '' end

	local label = args.label or util.getEntityLabelOrLemma(entityId) or entityId
	local line1text = string.format('%s %s', entityId, label)
	local link = util.buildEntityLink(entityId, line1text, args.target)

	local sub = buildSubtitle(args, entityId)
	if sub and sub ~= '' then
		return link .. '<br />' .. util.trim(sub)
	end
	return link
end

function p.shortdesc(frame)
	-- Q: per Vorgabe normalerweise nicht nötig → leer lassen
	return ''
end

return p