לדלג לתוכן

יחידה:הערה: הבדלים בין גרסאות בדף

מתוך צפונות ויקי
יצירת דף עם התוכן "local Ref = {} function parseRef(frame) local argModule = require('Module:Arguments') local warnings='' local text='' local refDic = {} local args = argMod..."
אין תקציר עריכה
שורה 9: שורה 9:
local refName = args['שם']
local refName = args['שם']
local refGroup = args['קבוצה']
local refGroup = args['קבוצה']
local isLtr = args['שמאל']
local isLtr = args['שמאל'] -- remove after bot
local isRtl = args['ימין']
local isRtl = args['ימין'] -- remove after bot
if isLtr and isRtl then
local direction = args['כיוון']
-- remove after bo
if isLtr and isRtl then  
warnings = '<span class="error">פרמטרים מגדירים כיווניות סותרים</span>[[קטגוריה:דפים עם שגיאות בהערה]]'
warnings = '<span class="error">פרמטרים מגדירים כיווניות סותרים</span>[[קטגוריה:דפים עם שגיאות בהערה]]'
end
if direction and direction ~= 'ימין' and direction ~= 'שמאל' then
warnings = '<span class="error">פרמטר כיוון שגוי</span>[[קטגוריה:דפים עם שגיאות בהערה]]'
end
end
if args[2] then
if args[2] then
שורה 25: שורה 32:
if refName and #refName then refDic['name'] = refName end
if refName and #refName then refDic['name'] = refName end
if refGroup and #refGroup then refDic['group'] = refGroup end
if refGroup and #refGroup then refDic['group'] = refGroup end
if isLtr and isLtr=='כן' then refDic['dir'] = 'ltr' end
if isLtr and isLtr=='כן' then refDic['dir'] = 'ltr' end -- remove after bot
if isRtl and isRtl=='כן' then refDic['dir'] = 'rtl' end
if isRtl and isRtl=='כן' then refDic['dir'] = 'rtl' end -- remove after bot
if direction and direction=='שמאל' then refDic['dir'] = 'ltr' end
if direction and direction=='ימין' then refDic['dir'] = 'rtl' end
 
if text and #text>0 then
if text and #text>0 then
return frame:extensionTag{ name = 'ref', content=text, args = refDic } .. warnings
return frame:extensionTag{ name = 'ref', content=text, args = refDic } .. warnings

גרסה מ־09:29, 23 באוקטובר 2020

ניתן ליצור תיעוד על היחידה הזאת בדף יחידה:הערה/תיעוד

local Ref = {}

function parseRef(frame)
	local argModule = require('Module:Arguments')
	local warnings=''
	local text=''
	local refDic = {}
	local args = argModule.getArgs(frame)
	local refName = args['שם']
	local refGroup = args['קבוצה']
	local isLtr = args['שמאל']  -- remove after bot
	local isRtl = args['ימין'] -- remove after bot
	local direction = args['כיוון']
	
	 -- remove after bo
	if isLtr and isRtl then 
		warnings = '<span class="error">פרמטרים מגדירים כיווניות סותרים</span>[[קטגוריה:דפים עם שגיאות בהערה]]'
	end
	
	if direction and direction ~= 'ימין' and direction ~= 'שמאל' then
		warnings = '<span class="error">פרמטר כיוון שגוי</span>[[קטגוריה:דפים עם שגיאות בהערה]]'
	end
	if args[2] then
		warnings = '<span class="error"><sup> פרמטר שני בהערה: </sup></span>[[קטגוריה:דפים עם שגיאות בהערה]]'
	end
	
	text = args[1]
	
	if text then
		text = frame:preprocess(args[1])
	end
	if refName and #refName then refDic['name'] = refName end
	if refGroup and #refGroup then refDic['group'] = refGroup end
	if isLtr and isLtr=='כן' then refDic['dir'] = 'ltr' end  -- remove after bot
	if isRtl and isRtl=='כן' then refDic['dir'] = 'rtl' end -- remove after bot
	if direction and direction=='שמאל' then refDic['dir'] = 'ltr' end
	if direction and direction=='ימין' then refDic['dir'] = 'rtl' end

	if text and #text>0 then
		return frame:extensionTag{ name = 'ref', content=text, args = refDic } .. warnings
	else
		return frame:extensionTag{ name = 'ref', args = refDic } .. warnings
	end
end

Ref['הערה'] = parseRef
Ref['parseRef'] = parseRef
return Ref