มอดูล:Solar eclipse

local eclipse = {}
local args = {}
local data_module_prefix = "Module:Solar eclipse/db/"
local function ifnotempty(s,a,b)
	if (s and s ~= ) then
		return a
	else
		return b
	end
end
local function ifexist(page)
if not page then return false end
if mw.title.new(page).exists then return true end
return false
end
local function parsedate(y,m,d)
	local lang = mw.language.getContentLanguage()
	d = (tonumber(d) " .. 
		(args'map' or ) .. ifnotempty(args'map_caption', 
			"" ..
			(args'map_caption' or ) .. "", ) .. )
	return frame:expandTemplate{ title = 'infobox', args = {
		"bodyclass" = "vevent",
		"bodystyle" = "width:25em; text-align:left; font-size:90%;",
		"above" = abovestr,
		"aboveclass" = "summary",
		"abovestyle" = "padding-bottom:0.25em; background:" .. bgcolor .. "; line-height:1.2em; text-align:center; font-size:115%;",
------------------ Images and maps ------------------
		"image" = args'image' or ,
		"imagestyle" = "padding-bottom:0.5em;",
		"caption" = args'caption' or ,
		"captionstyle" = "padding-top:0.1em; line-height:1.2em; font-size:90%;",
		"headerstyle" = "background:#eee; font-size:105%;",
		"labelstyle" = "padding:0 0.5em 0 0; line-height:1.1em;",
		"datastyle" = "padding:0; line-height:1.2em; vertical-align:middle;",
		"data1" = mapstr,
------------- Type of eclipse and saros -------------
		"header2" = "ชนิดของอุปราคา" .. (args'type_ref' or ),
		"label3"  = "ประเภท",
		"data3"   = args'nature' or ,
		"label4"  = "แกมม่า",
		"data4"   = args'gamma' or ,
		"label5"  = "แมกนิจูด",
		"data5"   = args'magnitude' or ,
------------------ Maximum eclipse ------------------
		"header7" = "บดบังมากที่สุด" .. (args'max_eclipse_ref' or ),
		"label8" = "ระยะเวลา",
		"data8" = args'duration' or ,
		"label9" = "สถานที่",
		"data9" = args'location' or ,
		"class9" = "location",
		"label10" = "พิกัด",
		"data10" = args'coords' or ,
		"label11" = "ความกว้างของเงามืด",
		"data11" = args'max_width' or ,
----------------------- Times -----------------------
		"header12" = "เวลา (UTC)" .. (args'times_ref' or ),
		"label13" = "(P1) เริ่มอุปราคาบางส่วน",
		"data13" = args'start_partial' or ,
		"label14" = "(U1) เริ่มอุปราคาเต็มดวง",
		"data14" = args'start_total' or ,
		"label15" = "(U2) เริ่มสัมผัสเต็มดวง",
		"data15" = args'start_central' or ,
		"label16" = "บดบังมากที่สุด",
		"data16" = args'greatest_eclipse' or ,
		"label17" = "(U3) สิ้นสุดสัมผัสเต็มดวง",
		"data17" = args'end_central' or ,
		"label18" = "(U4) สิ้นสุดอุปราคาเต็มดวง",
		"data18" = args'end_total' or ,
		"label19" = "(P4) สิ้นสุดอุปราคาบางส่วน",
		"data19" = args'end_partial' or ,
------------------------ Event references -------------------------
		"header20" = "แหล่งอ้างอิง",
		"label21" = "ซารอส",
		"data21" = (args'saros' or ) 
			.. " (" .. (args'saros_sequence' or ) .. " ของ " .. (args'saros_total' or ) .. ")",
		"label22" = "บัญชี # (SE5000)",
		"data22" = args'cat' or ,
		} }
	
end
function eclipse.box(frame)
	args = require('Module:Arguments').getArgs(frame, {
			wrappers = 'แม่แบบ:กล่องข้อมูล สุริยุปราคา(สั้น)'
		})
	if( args'2' and args'2' ~= ) then
		loadsolardb(frame,args'2')
	elseif( args'1' and args'1' ~= ) then
		loadsolardb(frame,args'1')
	end
	
	return infobox(frame)
end
return eclipse