Module:HS listed building row

This module implements Template:HS listed building row. Instructions for its use can be found on the template page.

Module:HS listed building row

require('strict')
local genBuffer = require('Module:OutputBuffer')
local getArgs = require('Module:Arguments').getArgs
local delink = require('Module:Delink')._delink
local coord -- lazily loaded

local p = {}

function p.row(frame)
	local getBuffer, print, printf = genBuffer()
	local args = getArgs(frame, {wrappers = 'Template:HS listed building row'})
	local delinkedName = delink{args.name}
	printf('|- class="vcard %s;text-align:center"\n', args.image and 'with_image' or 'without_image')
	printf('| class="fn org" | %s\n', args.name or '')
	printf('| class="label" | %s\n', args.location or '')
	printf('| %s\n', args.date_listed or '')
	local coordText
	if args.lat then
		if not coord then
			coord = require('Module:Coordinates')._coord
		end
		coordText = coord{args.lat, args.lon, format = 'dms', display = 'inline', name = delinkedName}
	else
		coordText = ''
	end
	printf('| %s\n', coordText)
	printf('| class="note" | %s\n', args.notes or '')
	if args.category then
		printf('| style="text-align:center" | %s\n', args.category or '')
	end
	printf('| class="uid" style="text-align:center" | [https://portal.historicenvironment.scot/designation/LB%s %s]\n', args.hb or args.hbnum or '', args.hb or args.hbnum or '')
	if args.image then
		printf(
			' |[[File:%s|150x150px|%s]]<p class="plainlinks" style="margin: 0 auto;"><small>[https://commons.wikimedia.org/w/index.php?title=Special:UploadWizard&campaign=wlm-gb-sct&id=%s&descriptionlang=en&description=%s&lat=%s&lon=%s&categories=%s Upload another image]</small><br><small>%s</small></p>\n',
			args.image or '',
			args.name or '',
			mw.uri.encode(args.hb or args.hbnum or ''),
			mw.uri.encode(delinkedName),
			args.lat or '',
			args.lon or '',
			mw.uri.encode(args.commonscat or ''),
			args.commonscat and ('[[:commons:Category:' .. args.commonscat .. '|See more images]]') or ''
		)
	else
		printf('| style="vertical-align:middle;text-align:center" | %s\n',
			frame:expandTemplate{title = 'Template:UploadCampaignLink', args = {campaign = 'wlm-gb-sct', id = args.hb, description = delinkedName, lat = args.lat, lon = args.lon}}
		)
	end
	return getBuffer()
end

return p

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.