Module:Param Parse: Difference between revisions

45 bytes removed ,  Yesterday at 20:35
Append hours to duration param
m (Fix strict mode errors)
(Append hours to duration param)
 
(7 intermediate revisions by 3 users not shown)
Line 3:
--]=]
-- <nowiki>
require('strict')
local Infobox = require('Module:Infobox')
local currency = require('Module:Currency').parse
Line 34 ⟶ 35:
return nil
end
local num = parse.number(out)
if num == nil then
return nil
Line 139 ⟶ 140:
 
-- Standardized description function
function parse.description_func(description, examine)
if not description and examine then
description = examine
end
return parse.has_content(description)
end
parse.description = {
name = 'description',
returnfunc = parse.has_content(description),
func = {name = parse.description_func, params = {Infobox.raw_param('description'), Infobox.raw_param('examine')}},
smw_property = 'Description',
category_incomplete = 'Needs description',
Line 318 ⟶ 313:
-- Value
function parse.value_func(val)
local status, val = pcall(currency, val)
return currency(val)
if status then
return currency(val)
end
end
parse.value = {
Line 402 ⟶ 400:
func = {name = parse.number_or_number_range_high, params = {Infobox.raw_param('profession_b_level')}},
smw_property = 'Profession Level B High',
 
parse.profession = {
name = 'profession',
func = parse.has_content,
category_incomplete = 'Needs profession',
smw_property = 'Profession' -- TODO - Need to create property page
}
 
Line 424 ⟶ 415:
smw_func = parse.yes_no_smw,
category_incomplete = 'Needs passiveness'
 
function parse.duration_func(hours)
hours = string.gsub(hours or '',',','')
return (tonumber(hours) .. " Hours")
end
 
parse.professionduration = {
name = 'professionduration',
func = parse.has_contentduration_func,
smw_property = 'Duration',
category_incomplete = 'Needs professionduration',
}
 
Line 528 ⟶ 531:
local level_valid = parse.number(level)
local profession_valid = parse.has_content(profession)
local profession_valid_link = profession_valid
if not profession_valid and not level_valid then
Line 544 ⟶ 548:
end
return '[[File:'..profession_valid..'_icon.png|link='..profession_validprofession_valid_link..'|width=18x18]] '..level_valid
end
 
592

edits