词条 | Module:Infobox school tracking/sandbox |
释义 | local p = {} function p.tracking(frame) local function isblank( val ) return (val == nil) or val:match('^[%s]*$') end local function trim(s) return s:match('^%s*(.-)%s*$') end return s and trim(s) ~= end local cats = '' local args = frame:getParent().args local unknown_parameters = {} local duplicate_parameters = {} local count = 0 if args['approx'] then table.insert(unknown_parameters, 'approx = add c. before any approximate dates') end if args['c_approx'] then table.insert(unknown_parameters, 'c_approx = add c. before any approximate dates') end if args['motto_pl'] then table.insert(unknown_parameters, 'motto_pl = use mottoes instead') end if args['founder_pl'] then table.insert(unknown_parameters, 'founder_pl = use founders instead') end if args['specialist_pl'] then table.insert(unknown_parameters, 'specialist_pl = use specialists instead') end if args['year'] then table.insert(unknown_parameters, 'year = use ACT_year or SAT_year or graduates_year instead') end if args['main feeder schools'] then table.insert(unknown_parameters, 'main feeder schools = use feeder_schools instead') end if isnotblank(args['fundingtype']) and isnotblank(args['type']) then table.insert(duplicate_parameters, 'fundingtype = type') end if isnotblank(args['religious_affiliation']) and isnotblank(args['religion']) then table.insert(duplicate_parameters, 'religious_affiliation = religion') end if isnotblank(args['head_name']) and isnotblank(args['head_label']) then table.insert(duplicate_parameters, 'head_name = head_label') end if isnotblank(args['employees']) and isnotblank(args['num_employ']) then table.insert(duplicate_parameters, 'employees = num_employ') end if isnotblank(args['address']) then count = count + 1 end if isnotblank(args['street']) then count = count + 1 end if isnotblank(args['streetaddress']) then count = count + 1 end if count > 1 then table.insert(duplicate_parameters, 'address = street = streetaddress') end count = 0 if isnotblank(args['city']) then count = count + 1 end if isnotblank(args['town']) then count = count + 1 end if isnotblank(args['city/town']) then count = count + 1 end if count > 1 then table.insert(duplicate_parameters, 'city = town = city/town') end count = 0 if isnotblank(args['postcode']) then count = count + 1 end if isnotblank(args['postalcode']) then count = count + 1 end if isnotblank(args['zipcode']) then count = count + 1 end if count > 1 then table.insert(duplicate_parameters, 'postcode = postalcode = zipcode') end count = 0 if isnotblank(args['educational_authority']) then count = count + 1 end if isnotblank(args['educational authority']) then count = count + 1 end if isnotblank(args['authority']) then count = count + 1 end if count > 1 then table.insert(duplicate_parameters, 'educational_authority = educational authority = authority') end count = 0 if isnotblank(args['school_number']) then count = count + 1 end if isnotblank(args['schoolnumber']) then count = count + 1 end if isnotblank(args['number']) then count = count + 1 end if count > 1 then table.insert(duplicate_parameters, 'school_number = schoolnumber = number') end count = 0 if isnotblank(args['staff']) then count = count + 1 end if isnotblank(args['number_of_staff']) then count = count + 1 end if isnotblank(args['number of staff']) then count = count + 1 end if count > 1 then table.insert(duplicate_parameters, 'staff = number_of_staff = number of staff') end count = 0 if isnotblank(args['lower_age']) then count = count + 1 end if isnotblank(args['age_range']) then count = count + 1 end if isnotblank(args['age range']) then count = count + 1 end if count > 1 then table.insert(duplicate_parameters, 'lower_age = age_range = age range') end count = 0 if isnotblank(args['pupils']) then count = count + 1 end if isnotblank(args['number_of_pupils']) then count = count + 1 end if isnotblank(args['number of pupils']) then count = count + 1 end if count > 1 then table.insert(duplicate_parameters, 'pupils = number_of_pupils = number of pupils') end count = 0 if isnotblank(args['average_class_size']) then count = count + 1 end if isnotblank(args['avg_class_size']) then count = count + 1 end if isnotblank(args['class']) then count = count + 1 end if count > 1 then table.insert(duplicate_parameters, 'average_class_size = avg_class_size = class') end count = 0 if isnotblank(args['colours']) then count = count + 1 end if isnotblank(args['colors']) then count = count + 1 end if count > 1 then table.insert(duplicate_parameters, 'colours = colors') end count = 0 if isnotblank(args['schoolcolours']) then count = count + 1 end if isnotblank(args['schoolcolors']) then count = count + 1 end if isnotblank(args['school_colours']) then count = count + 1 end if isnotblank(args['school_colors']) then count = count + 1 end if count > 1 then table.insert(duplicate_parameters, 'schoolcolours = schoolcolors = school_colours = school_colors') end count = 0 if isnotblank(args['feeders']) then count = count + 1 end if isnotblank(args['feeder_schools']) then count = count + 1 end if isnotblank(args['main feeder schools']) then count = count + 1 end if count > 1 then table.insert(duplicate_parameters, 'feeders = feeder_schools = main feeder schools') end count = 0 if isnotblank(args['enrolment']) then count = count + 1 end if isnotblank(args['enrollment']) then count = count + 1 end if isnotblank(args['students']) then count = count + 1 end if isnotblank(args['pupils']) then count = count + 1 end if count > 1 then table.insert(duplicate_parameters, 'enrolment = enrollment = students = pupils') end count = 0 if isnotblank(args['enrolment_as_of']) then count = count + 1 end if isnotblank(args['enrollment_as_of']) then count = count + 1 end if isnotblank(args['students_as_of']) then count = count + 1 end if isnotblank(args['pupils_as_of']) then count = count + 1 end if count > 1 then table.insert(duplicate_parameters, 'enrolment_as_of = enrollment_as_of = students_as_of = pupils_as_of') end if isnotblank(frame.args['nocat']) then cats = end warnmsg = {} if #unknown_parameters > 0 then for i, v in ipairs( unknown_parameters ) do local t = mw.text.split(v, '=') table.insert(warnmsg, 'Unknown parameter cats = cats .. end end if #duplicate_parameters > 0 then for i, v in ipairs( duplicate_parameters ) do local t = mw.text.split(v, '=') table.insert(warnmsg, 'Using more than one of the following parameters: table.concat(t, ', cats = cats .. end end if #warnmsg > 0 then if frame:preprocess( "{{REVISIONID}}" ) == "" then cats = ' Infobox school warning: ' .. table.concat(warnmsg, ' ' .. cats') .. ' end end end return p 2 : Pages using infobox school with deprecated parameters|Pages using infobox school with deprecated parameters |
随便看 |
|
开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。