Civilization Wiki
(Added code for achievements, blatantly copied from Module:Data/CivBE)
Tag: sourceedit
 
m (Wrap the module in nowiki tags so that wanted files are not parsed from this module. Nowiki tags are preceeded with -- to be treated like a comment in scribunto.)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
  +
-- <nowiki>
  +
 
local utils = require("Module:TemplateUtils")
 
local utils = require("Module:TemplateUtils")
   
Line 4: Line 6:
   
 
local steamachievementbox = [=[{| class="steam-achievement-container"
 
local steamachievementbox = [=[{| class="steam-achievement-container"
!class="steam-achievement-image-cell" |[[Image:Steam achievement %s (Civ6).jpg|64px|%s]]
+
|class="steam-achievement-image-cell" |[[File:Steam achievement %s (Civ6).jpg|64px|%s]]
!class="steam-achievement-text-cell"|<div class="steam-achievement-text-cell-inner-container"><span class="steam-achievement-name">%s</span><br/><div class="steam-achievement-description">%s
+
|class="steam-achievement-text-cell"|<div class="steam-achievement-text-cell-inner-container"><span class="steam-achievement-name">%s</span><br/><div class="steam-achievement-description">%s
 
:%s</div></div>
 
:%s</div></div>
 
|}[[Category:Steam achievements in Civ6]]]=]
 
|}[[Category:Steam achievements in Civ6]]]=]
Line 30: Line 32:
 
 
 
return p
 
return p
  +
  +
-- </nowiki>

Latest revision as of 07:39, 2 February 2021

Documentation for this module may be created at Module:Data/Civ6/doc

-- <nowiki>

local utils = require("Module:TemplateUtils")

local p = {}

local steamachievementbox = [=[{| class="steam-achievement-container"
|class="steam-achievement-image-cell" |[[File:Steam achievement %s (Civ6).jpg|64px|%s]]
|class="steam-achievement-text-cell"|<div class="steam-achievement-text-cell-inner-container"><span class="steam-achievement-name">%s</span><br/><div class="steam-achievement-description">%s
:%s</div></div>
|}[[Category:Steam achievements in Civ6]]]=]
 
local function isEmpty(param) 
	return param == nil or param == ''
end
 
function p.GetSteamAchievement(frame, articlename)
	local PAGENAME = articlename or frame.args[1]
	local name = string.gsub(PAGENAME, " %(.*","")
	local data = mw.loadData("Module:Data/Civ6/Achievements")[name]
	local missing = "<small>(Is this a reference to something in popular culture? Please [[Module:Data/Civ6/Achievements|add the information here]]!)</small>"
 
	if data == nil then
		return "''Achievement infobox data not found for \""..name.."\". Check the parameter or add the data to [[Module:Data/Civ6/Achievements]].''"
	end
 
	return utils.PreProcess(frame,string.format(steamachievementbox,
	name, name, name,
	data.condition,
	not isEmpty(data.reference) and data.reference or missing))
end
 
return p

-- </nowiki>