文档图示 模块文档[创建]
local p = {}
local name = {
	district='区',
	city='城市',
	airport='机场',
	park='公园',
	diveguide='潜水点',
	region='地区',
	country='国家',
	continent='洲',
	itinerary='旅行路线',
	topic='话题',
	phrasebook='会话手册',
	usable='可用',
	outline='大纲',
	guide='指南',
	star='明星',
}
local usabletext = {
	district='有抵达信息以及一些完整的餐馆和旅馆列表项',
	city='有抵达信息以及一些完整的餐馆和旅馆列表项',
	airport='有关于[[Wikivoyage:机场条目模板#航班|航班]]和[[Wikivoyage:机场条目模板#地面交通|地面交通]]的信息以及一些完整的机场内餐饮选择列表项',
	park='有关于这个公园的抵达、少许景点和园内住宿信息',
	diveguide='有关于地点和设备的信息以及一些完整的景观列表项',
	region='提供了关于此地区在视觉、抵达等多方面的信息以及指向与之相关的主要目的地的链接',
	country='拥有一些关于抵达此国家和连接到其他目的地的链接',
	continent='拥有一些关于此大洲和到其他目的地的链接',
	itinerary='讲解说明了如何抵达那里并提及了路上需要注意的要点',
	topic='提及了关于此话题的大主题',
	phrasebook='讲解了旅游最基本交流用语的发音'
}
local guidetext = {
	district='包括旅馆、餐馆、景点、抵达和下一站信息在内的',
	city='包括旅馆、餐馆、景点、抵达和下一站信息在内的',
	airport='包括航班、地面交通、餐馆、抵达和下一站信息在内的',
	park='包括景点、活动、住宿、宿营地、餐馆和抵达/下一站信息在内的',
	diveguide='包括地点、条件与设备和关于海洋生物及其他景观的信息在内的',
	region='遍及整个地区及地区内所有目的地的',
	country='包括游览地点链接、景点、抵达和下一站信息在内的关于这个国家的',
	continent='包括住宿、饮食、观光、抵达和下一站信息在内的',
	itinerary='覆盖整条路线的',
	topic='覆盖整个话题的',
	phrasebook='覆盖了所有主要的旅途话题的'
}
local startext = {
	itinerary='拥有覆盖整个旅行路线的优质的信息和可视化的内容',
	topic='有覆盖整个话题的优质文字信息和可视化信息',
	phrasebook='几乎覆盖了所有可能遇到的旅行交流的话题,由优质的文本、可视化信息组成'
}
function p.main(frame)
	args = frame:getParent().args
	entity = mw.wikibase.getEntityObject()
	title = mw.title.getCurrentTitle()
	wdstatus='outline'
	type=args.type or 'country'
	if entity then
		if entity.sitelinks.zhwikivoyage.badges[1]=='Q17559452' then
			wdstatus='usable'
		elseif entity.sitelinks.zhwikivoyage.badges[1]=='Q17437798' then
			wdstatus='guide'
		elseif entity.sitelinks.zhwikivoyage.badges[1]=='Q17437796' then
			wdstatus='star'
		end
	end
	status=args.status or wdstatus
	text='<div class="noprint">'
	text=text..'<table id="'..status..'_'..type..'" class="articleState" '
	if status=='star' then
		text=text..'style="border-style:double;border-width:6px;"'
	elseif status=='usable' then
		text=text..'style="border-style:dashed;border-width:2px;"'
	elseif status=='outline' then
		text=text..'style="border-style:dotted;border-width:2px;"'
	end
	text=text..'>\n'
	if status=='star' then
		text=text..'<td>[[Image:Cscr-featured.svg|30px]]</td>'
	end
	text=text..'\n<td>本[['
	if type=='park' then
		text=text..'Wikivoyage:地理分层#其他类型'
	elseif type=='diveguide' then
		text=text..'Wikivoyage:什么是潜水指南'
	elseif type=='itinerary' then
		text=text..'Wikivoyage:旅行路线'
	elseif type=='topic' then
		text=text..'旅行话题'
	elseif type=='phrasebook' then
		text=text..'会话手册'
	else
		text=text..'Wikivoyage:地理分层#'..name[type]
	end
	text=text..'|'..name[type]..'条目]]是[[Wikivoyage:'..name[status]..'条目|'..name[status]..']]条目'
	if status=='outline' then
		text=text..',需要更多内容。它有[[Wikivoyage:条目模板|条目模板]],但是目前没有充足的[[Wikivoyage:信息可以放在哪里|信息]]。'
		if type=='country' then
			text=text.."如果该国家列出了[[Wikivoyage:城市条目状态|城市]]和'''其他目的地''',那么它们可能并未全都达到'''可用'''状态;或者该国家没有[[Wikivoyage:国家条目状态|有效的地区结构]]和叙述所有抵达这里的典型方式的“抵达”段落。"
		end
		text=text..'请[[Wikivoyage:勇往直前|勇往直前]],[[Wikivoyage:如何编辑页面|帮助它充实]]!'
	elseif status=='usable' then
		text=text..'。它'..usabletext[type]..'。爱冒险的人可以直接使用此条目,但还是请[[Wikivoyage:勇往直前|勇往直前]],[[Wikivoyage:如何编辑页面|帮助它充实]]!'
	elseif status=='guide' then
		text=text..'。它有'..guidetext[type].."完整优质的信息。[[Wikivoyage:勇往直前|勇往直前]],帮助我们把它打造为'''[[Wikivoyage:明星条目|明星]]'''!"
	elseif status=='star' then
		text=text..'。它'..(startext[type] or '是由地图、照片和充足的信息组成的高品质条目')..'。如果你知道有什么新变化,请[[Wikivoyage:勇往直前|勇往直前]],[[Wikivoyage:如何编辑页面|帮助它充实]]!'
	end
	text=text..'</td></table></div>'
	if title.namespace == 0 then
		text=text..'[[Category:'..name[status]..name[type]..']][[Category:'..name[status]..'条目]][[Category:'..name[type]
		if type=='phrasebook' or type=='itinerary' then
			text=text..']]'
		else
			text=text..'条目]]'
		end
		if type=='region' then
			subcats=mw.site.stats.pagesInCategory( title.text, 'subcats' )
			pages=mw.site.stats.pagesInCategory( title.text, 'pages' )
			if subcats+pages==0 then
				text=text..'[[Category:空地区]]'
			end
			if not mw.title.new( title.text, 14 ).exists then
				text=text..'[[Category:无分类地区]]'
			end
			if subcats==0 then
				text=text..'[[Category:底层地区]]'
			end
			if pages>25 then
				text=text..'[[Category:多于25个条目的地区]]'
			end
			if pages>40 then
				text=text..'[[Category:多于40个条目的地区]]'
			end
			if subcats>9 then
				text=text..'[[Category:多于9个下级地区的地区]]'
			end
		elseif type~='topic' and type~='continent' and type~='country' and mw.title.new( title.text, 14 ).exists then
			text=text..'[[Category:有分类的'..name[type]..']]'
		end
		if wdstatus~=status then
			text=text..'[[Category:需要更新维基数据徽章的页面|'
			if wdstatus=='outline' then
				text=text..string.upper(string.sub(status,1,1))
			elseif status=='outline' then
				text=text..'-'
			else
				text=text..string.sub(status,1,1)
			end
			text=text..']]'
		end
	end
	return text
end

return p