Mudanças entre as edições de "Módulo:Teste"

De Wiki Gla
Ir para navegação Ir para pesquisar
m
Etiqueta: Revertido
m
 
(76 revisões intermediárias por 3 usuários não estão sendo mostradas)
Linha 1: Linha 1:
--[[
  Módulo: opcional para inserir o widget via {{#invoke}}.
  Na wiki: criar página Módulo:GlaReportEmbed com este código.
  Uso num modelo ou página:
    {{#invoke:GlaReportEmbed|embed|api_base=https://teu-deploy.com}}
  Parâmetros nomeados (opcionais):
    |heading=Título da caixa
    |wid=2
  Requer a extensão Scribunto e o widget {{#widget:ReportModal|...}} registrado.
]]
local p = {}
local p = {}


-- retorna os dados do mapa Teste
function p.embed(frame)
local mapas = {
local pargs = (frame:getParent() and frame:getParent().args) or {}
  Teste = {
local args = frame.args or {}
    skulls = {
local base = (
      {
args.api_base
        x = 410, y = 220,
or pargs.api_base
        title = "White Skull",
or args[1]
        desc = "Boss: White Skull<br>Área sombria, cuidado com os ataques surpresa!"
or pargs[1]
      }
or ""
    },
):gsub("^%s+", ""):gsub("%s+$", "")
    hearts = {
if base == "" then
      {
return '<span class="error">GlaReportEmbed: falta <code>api_base</code>.</span>'
        x = 280, y = 210,
end
        desc = "Cura escondida!"
 
      }
local heading = args.heading or pargs.heading or ""
    },
local wid = args.wid or pargs.wid or ""
    puzzle = {
 
      x = 244,
local wikitext = "{{#widget:ReportModal|api_base=" .. base
      y = 217,
if heading ~= "" then
      videoUrl = "https://www.youtube.com/embed/10rhyP32vdw"
wikitext = wikitext .. "|heading=" .. heading
    }
end
  }
if wid ~= "" then
}
wikitext = wikitext .. "|wid=" .. wid
end
wikitext = wikitext .. "}}"


function p.data(frame)
return frame:preprocess(wikitext)
  local mwText = mw.text
  local nome = frame.args.mapa or "Teste"
  local dados = mapas[nome]
  if not dados then return "{}" end
  return mwText.nowiki(mwText.jsonEncode(dados))
end
end


return p
return p

Edição atual tal como às 16h07min de 28 de abril de 2026

A documentação para este módulo pode ser criada em Módulo:Teste/doc

--[[
  Módulo: opcional para inserir o widget via {{#invoke}}.

  Na wiki: criar página Módulo:GlaReportEmbed com este código.

  Uso num modelo ou página:
    {{#invoke:GlaReportEmbed|embed|api_base=https://teu-deploy.com}}

  Parâmetros nomeados (opcionais):
    |heading=Título da caixa
    |wid=2

  Requer a extensão Scribunto e o widget {{#widget:ReportModal|...}} registrado.
]]

local p = {}

function p.embed(frame)
	local pargs = (frame:getParent() and frame:getParent().args) or {}
	local args = frame.args or {}
	local base = (
		args.api_base
		or pargs.api_base
		or args[1]
		or pargs[1]
		or ""
	):gsub("^%s+", ""):gsub("%s+$", "")
	if base == "" then
		return '<span class="error">GlaReportEmbed: falta <code>api_base</code>.</span>'
	end

	local heading = args.heading or pargs.heading or ""
	local wid = args.wid or pargs.wid or ""

	local wikitext = "{{#widget:ReportModal|api_base=" .. base
	if heading ~= "" then
		wikitext = wikitext .. "|heading=" .. heading
	end
	if wid ~= "" then
		wikitext = wikitext .. "|wid=" .. wid
	end
	wikitext = wikitext .. "}}"

	return frame:preprocess(wikitext)
end

return p