local getArgs = require('Module:Arguments').getArgs
local wd = require('Module:Wd')
local p = {}
local qid={}
local o_name
local label_text
local o_location
local location_text
local entry_notes
local completed_text
local architect_text
local heritage_text
local heritage_date_text
local heritage_type
local gbmapping_text
local coord_text
local image_text
local list_number_text
local commons_cat_name
local commons_cat_text
local return_text={}
function p.main(frame)
local args = getArgs(frame)
qid= args[1] or ''
o_name= args[2] or '' --local name
o_location= args[3] or '' --local ___location
if o_name=='' then
label_text=wd._label ( {'edit@end',qid} ) --use wd label
else
label_text=o_name --overwrite name with local value
end
if o_location=='' then
location_text=wd._property ( {qid,'P276'} )-- use wd ___location
else
location_text=o_location --overwrite with local value
end
entry_notes= args[4] or ''
completed_text=wd._property ( {qid,'P580'} ) --year completed
architect_text=wd._property ( {qid,'P84'} ) --architect
heritage_text=wd._property ( {qid,'P1435'} ) --heritage designation
heritage_date_text=wd._qualifier ( {qid,'P1435','P580'} ) --and date of listing
heritage_type=wd._property ( {'raw',qid,'P1435'} ) --decides cell shading based on listing grade
if heritage_type=='Q15700818' then
cell_shading='style=\"background: #FFC0CB;\"|'
elseif heritage_type=='Q15700831' then
cell_shading='style=\"background: #87CEEB;\"| '
elseif heritage_text=='Q15700834' then
cell_shading='style=\"background: #ACE1AF;\"| '
else cell_shading=''
end
gbmapping_text=frame:expandTemplate{title='gbmappingsmall',args={wd._property ( {qid,'P613'} ) }} --gb map
coord_text=wd._property ( {'linked',qid,'coord'} ) --and co-ords
image_text=wd._property ( {'raw',qid,'image'} ) --image
list_number_text=frame:expandTemplate{title='National Heritage List for England',
args={num=wd._property ( {qid,'P1216'} ),short='yes'}} --NHLE number
commons_cat_name=wd._property ( {qid,'P373'} )
if commons_cat_name=='' then
commons_cat_text=''
else
commons_cat_text='[[:commons:category:'..commons_cat_name..'|'..commons_cat_name..']]'
end --commons category
return_text='|-style=\"text-align: center;\"\n!scope=\"row\" | '..label_text..'\n|' --includes code to create new line and make first cell row header
..location_text..'||'
..completed_text..'||'
..architect_text..'||'
..cell_shading..heritage_text..'<br>('..heritage_date_text..')||'
..entry_notes..'||'
..gbmapping_text..'<br>'..coord_text
..'||[[File:'..image_text..'|150px|center]]||'
..list_number_text..'||'
..commons_cat_text
return return_text
end
return p