לדלג לתוכן

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

מתוך צפונות ויקי
מאין תקציר עריכה
מאין תקציר עריכה
שורה 9: שורה 9:
local refName = args['שם']
local refName = args['שם']
local refGroup = args['קבוצה']
local refGroup = args['קבוצה']
local isLtr = args['שמאל']
if args[2] then
if args[2] then
warnings = '<span class="error"><sup> פרמטר שני בהערה: </sup></span>[[קטגוריה:דפים עם שגיאות בהערה]]'
warnings = '<span class="error"><sup> פרמטר שני בהערה: </sup></span>[[קטגוריה:דפים עם שגיאות בהערה]]'
end
end
if args['שמאל'] then
text = '<div style="direction: ltr;text-align:left;">' .. args[1] .. '</div>'
text = args[1]
else
text = args[1]
end
if text then
if text then
text = frame:preprocess(args[1])
text = frame:preprocess(args[1])
שורה 22: שורה 21:
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 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

גרסה מ־11:07, 1 ביוני 2018

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

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['שמאל']
	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
	
	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