Modul:Teamim

Modul:Teamim

Modul:Teamim
verwendete Moduln:
SimpleStruct
Zeichen
Zeichenfolge
Vorlagenprogrammierung Diskussionen Lua Unterseiten
Modul Deutsch English

Modul: Dokumentation

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


--[=[ Teamim 2022-07-03
Data Management Module for Access from Within Templates
providing infos for Teamim sequences using unicode for display
Author: Vollbracht

* disjunctList(elements)	Wikidata information for sign sequences (table form)
							(under construction)
* data()			switch for Zeichen.data()/Zeichenfolge.data()
					(planed)
* wordPos(sign/Num)	sign linked to legend
* legend(sign/Num)	legend line providing infos for wordPos
]=]

--Module globals
local p = {}

local _, SequencesMod = pcall(require, "Modul:Zeichenfolge")
local Sequences = SequencesMod.service
local _, CharMod = pcall(require, "Modul:Zeichenfolge")
local Char = SequencesMod.service

local WORDPOS = {
	{"wp1", "↑", "steht über dem Konsonanten der betonten Silbe"},
	{"wp2", "↓", "steht unter dem Konsonanten der betonten Silbe"},
	{"wp3", "[↑]", [[
		steht über dem Konsonanten der betonten Silbe, wenn das Wort nicht
		beim endständigen Zeichen betont ist]]},
	{"wp4", "↱", [[
		steht vor der Tonsilbe im gleichen oder vorangehenden Wort, kann auch
		fehlen]]},
	{"wp5", "↗",
		"steht oben am Wortanfang, also ''vor'' dem ersten Buchstaben"},
	{"wp6", "↘",
		"steht unten am Wortanfang, also ''vor'' dem ersten Buchstaben"},
	{"wp7", "↖",
		"steht oben am Wortende, also ''nach'' dem letzten Buchstaben"},
	{"wp8", "←", "steht als getrenntes Schriftzeichen nach dem Wort"}
}
WORDPOS["↑"]=WORDPOS[1]
WORDPOS["↓"]=WORDPOS[2]
WORDPOS["[↑]"]=WORDPOS[3]
WORDPOS["↱"]=WORDPOS[4]
WORDPOS["↗"]=WORDPOS[5]
WORDPOS["↘"]=WORDPOS[6]
WORDPOS["↖"]=WORDPOS[7]
WORDPOS["←"]=WORDPOS[8]

--[[
	p.wordPos(sign/Num)
		{{invoke:Teamim|wordPos|↑}}
		{{invoke:Teamim|wordPos|3}}
	provides a link with tooltip help for the given sign pointing to legend
	Such a legend is necessary for this to work and can be provided with
		{{invoke:Teamim|legend}}
	params: [sign|number]
		sign	if given, provides a link with given sign
		number	number of sign as of WORDPOS list; if given, provides a link
				with given sign
		if not given, returns an error message with quality management category
		entry
]]
local wpError = function(frame)
	local result = [[Fehler: Bitte nur mit Wortposition gemäß folgender Legende
					 verwenden:<br />]]
	result = result .. p.legend() .. '<br />[[Kategorie:Wikipedia:'
	result = result .. 'Qualitätssicherung Vorlageneinbindung fehlerhaft]]'
	return frame:preprocess(result)
end

p.wordPos = function(frame)
	local id = frame.args[1]
	if id == nil then return wpError(frame) end
	mw.log('ID = ' .. id)
	local set = WORDPOS[id]
	mw.logObject(set)
	if set == nil then set = WORDPOS[tonumber(id)] end
	if set == nil then return wpError(frame) end
	return frame:preprocess('[[#' .. set[1] .. '|' .. set[2] .. ']]')
end

--[[
	p.legend(sign/Num)
		{{invoke:Teamim|legend}}
		{{invoke:Teamim|legend|↑}}
		{{invoke:Teamim|legend|3}}
	provides a legend for wordPos entries; necessary for tooltip help at
	wordPos entry
	params: [none|sign|number]
		none	the function will provide a legend for the complete WORDPOS list
		sign	if given, provides a legend for the given sign only
		number	number of sign as of WORDPOS list; if given, provides a legend
				for the given sign only
]]
p.legend = function(frame)
	local id = nil
    if frame then
		id = frame.args[1]
    end
	if id and id ~= "" then
	    mw.logObject(id, "id")
		local set = WORDPOS[id]
		if set == nil then set = WORDPOS[tonumber(id)] end
		if set == nil then return wpError(frame) end
		local result = '<span id="' .. set[1] .. '">' .. set[2]
		result = result .. ' <span class="reference-text">' .. set[3]
		return result .. '</span></span>'
	else
		local result = '<table style="margin-left:1.6em;">'
		for _, set in ipairs(WORDPOS) do
			result = result .. '<tr id="' .. set[1] .. '"><td>' .. set[2]
			result = result .. '</td><td class="reference-text">' .. set[3]
			result = result .. '</td></tr>'
		end
		return result .. '</table>'
	end
end

--[[
	{{#invoke:byQ|QualifierList}}
	analogon for Zeichen.byQ
]]
p.byQ = function(frame)
	local list = frame.args.QualifierList
	if list == nil then return "" end
	if list == "" then return "" end
	local source = Char.byQ(list)
	if source == {} then return "" end
end

--[[
	p.disjunctList(frame)
	parameters:
		elements	simple struct with each element in syntax:
					{
						qualifier{Q1234} rank{König} wordPos{↓ ←}
						grammar{Mitte eines ...-Segments, wenn ...}
					}
]]
p.disjunctList = function(frame)
	
end

return p

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.