Marvel Wiki
Marvel Wiki
5 135
páginas
Sem resumo de edição
Sem resumo de edição
(44 revisões intermediárias pelo mesmo usuário não estão sendo mostradas)
Linha 166: Linha 166:
 
if pagetype == 'Temporada'
 
if pagetype == 'Temporada'
 
then
 
then
s = string.gsub(titulo, ' %(TV [Ss]eries%)', '')
+
s = string.gsub(titulo, ' %(.+%)', '')
 
link_parte2 = design.span(s).italic..' T'..volume..link_parte2
s = string.gsub(s, ' %([Aa]nimated [Ss]eries%)', '')
 
link_parte2 = design.span(s).italic..' S'..volume..link_parte2
 
 
else
 
else
 
if volume == '1'
 
if volume == '1'
Linha 182: Linha 181:
 
return { ['titulo'] = titulo,
 
return { ['titulo'] = titulo,
 
['volume'] = volume,
 
['volume'] = volume,
['Edição'] = edicao,
+
['edicao'] = edicao,
 
['clean_edicao'] = clean_edicao or '',
 
['clean_edicao'] = clean_edicao or '',
 
['remainder_edicao'] = remainder_edicao or '',
 
['remainder_edicao'] = remainder_edicao or '',
Linha 192: Linha 191:
 
['all'] = titulo_para_arquivos..' '..pagetype..' '..volume..' '..edicao,
 
['all'] = titulo_para_arquivos..' '..pagetype..' '..volume..' '..edicao,
 
},
 
},
['classificacarnome'] = {
+
['classificarnome'] = {
 
['titulo'] = p.lua_remove_the(titulo),
 
['titulo'] = p.lua_remove_the(titulo),
 
['semedicao'] = p.lua_remove_the(titulo)..' '..pagetype..' '..padded_volume,
 
['semedicao'] = p.lua_remove_the(titulo)..' '..pagetype..' '..padded_volume,
Linha 198: Linha 197:
 
},
 
},
 
['link'] = {
 
['link'] = {
['part1'] = link_parte1,
+
['parte1'] = link_parte1,
['part2'] = link_parte2,
+
['parte2'] = link_parte2,
 
['all'] = h.Link(link_parte1, link_parte2),
 
['all'] = h.Link(link_parte1, link_parte2),
 
},
 
},
Linha 249: Linha 248:
 
--------------------------------------------------------------------------------------------------
 
--------------------------------------------------------------------------------------------------
 
-- automatic standardization of episodes names
 
-- automatic standardization of episodes names
function p.lua_standardized_episode_name(pagename)
+
function p.lua_nome_padronizado_do_episodio(pagename)
 
local info = {}
 
local info = {}
 
local output = pagename
 
local output = pagename
Linha 265: Linha 264:
   
   
function p.standardized_episode_name(frame)
+
function p.nome_padronizado_do_episodio(frame)
 
local args = getArgs(frame)
 
local args = getArgs(frame)
return p.lua_standardized_episode_name(args[1])
+
return p.lua_nome_padronizado_do_episodio(args[1])
 
end
 
end
   
Linha 273: Linha 272:
 
--------------------------------------------------------------------------------------------------
 
--------------------------------------------------------------------------------------------------
 
-- returns link after standardization of its name
 
-- returns link after standardization of its name
function p.lua_link_padronizado(pagename, pagetype, text)
+
function p.lua_link_padronizado(pagename, pagetype, texto)
 
local design = require("Módulo:Design")
 
local design = require("Módulo:Design")
 
local link = ''
 
local link = ''
Linha 299: Linha 298:
   
 
info = p.lua_get_titulo_volume_edicao(pagename, pagetype)
 
info = p.lua_get_titulo_volume_edicao(pagename, pagetype)
if not h.isempty(text)
+
if not h.isempty(texto)
then output = h.Link(info.link.part1, text)
+
then output = h.Link(info.link.parte1, texto)
 
else output = info.link.all
 
else output = info.link.all
 
end
 
end
elseif pagetype == 'Film' or pagetype == 'Video Game' or pagetype == 'Series' or pagetype == 'Novel'
+
elseif pagetype == 'Filme' or pagetype == 'Vídeo Game' or pagetype == 'Série' or pagetype == 'Novel'
 
then
 
then
 
link = pagename
 
link = pagename
text = string.gsub(pagename, ' %(.+%)', '')
+
texto = string.gsub(pagename, ' %(.+%)', '')
output = h.Link(link, design.span(text).italic)
+
output = h.Link(link, design.span(texto).italic)
 
else output = h.Link(pagename)
 
else output = h.Link(pagename)
 
end
 
end
Linha 440: Linha 439:
 
local design = require("Módulo:Design")
 
local design = require("Módulo:Design")
 
local data_de_lancamento = ''
 
local data_de_lancamento = ''
local mes = ''
+
local month = ''
 
local ano = ''
 
local ano = ''
 
local conteudo_da_pagina = ''
 
local conteudo_da_pagina = ''
Linha 453: Linha 452:
 
output = design.span(output).bold
 
output = design.span(output).bold
 
conteudo_da_pagina = h.get_content(p.lua_get_titulo_volume_edicao(pagename, 'Vol').all)
 
conteudo_da_pagina = h.get_content(p.lua_get_titulo_volume_edicao(pagename, 'Vol').all)
data_de_lancamento = h.get_field_value(conteudo_da_pagina, 'DataDeLançamento')
+
data_de_lancamento = h.get_field_value(page_content, 'DataDeLançamento')
 
if not h.isempty(data_de_lancamento)
 
if not h.isempty(data_de_lancamento)
 
then
 
then
 
info = m_data.lua_get_data_de_lancamento_info(data_de_lancamento)
 
info = m_data.lua_get_data_de_lancamento_info(data_de_lancamento)
link = h.Link(info.week.text, info.no_dia)
+
link = h.Link(info.semana.text, info.sem_dia)
 
else
 
else
mes = h.get_field_value(conteudo_da_pagina, 'mes')
+
mes = h.get_field_value(page_content, 'Mês')
ano = h.get_field_value(conteudo_da_pagina, 'ano')
+
ano = h.get_field_value(page_content, 'Ano')
 
info = m_data.lua_get_informacao_da_data_de_publicacao(ano, mes, false)
 
info = m_data.lua_get_informacao_da_data_de_publicacao(ano, mes, false)
link = string.gsub(info.link, '%]%], %[%[:Categoria:%d+|', ', ')
+
link = string.gsub(info.link, '%]%] de %[%[:Categoria:%d+|', ' de ')
 
end
 
end
   
Linha 534: Linha 533:
 
then
 
then
 
info = m_data.lua_get_data_de_lancamento_info(data_de_lancamento)
 
info = m_data.lua_get_data_de_lancamento_info(data_de_lancamento)
output = h.Link(info.week.text, info.sem_dia)
+
output = h.Link(info.semana.text, info.sem_dia)
 
else
 
else
 
mes = h.get_field_value(conteudo_da_pagina, 'Mês')
 
mes = h.get_field_value(conteudo_da_pagina, 'Mês')
 
ano = h.get_field_value(conteudo_da_pagina, 'Ano')
 
ano = h.get_field_value(conteudo_da_pagina, 'Ano')
 
info = m_data.lua_get_informacao_da_data_de_publicacao(ano, mes, false)
 
info = m_data.lua_get_informacao_da_data_de_publicacao(ano, mes, false)
output = string.gsub(info.link, '%]%], %[%[:Categoria:%d+|', ', ')
+
output = string.gsub(info.link, '%]%], %[%[:Categoria:%d+|', ' de ')
 
end
 
end
 
elseif pagetype == 'Episódio'
 
elseif pagetype == 'Episódio'
Linha 549: Linha 548:
 
then
 
then
 
mes = m_data.get_nome_do_mes({mes})
 
mes = m_data.get_nome_do_mes({mes})
output = h.LinkToCategory(ano..', '..mes, mes..' '..dia..', '..ano)
+
output = h.LinkToCategory(ano..', '..mes, dia..' de '..mes..' de '..ano)
 
end
 
end
 
elseif pagetype == 'Filme' or pagetype == 'Vídeo Game' or pagetype == 'Novel'
 
elseif pagetype == 'Filme' or pagetype == 'Vídeo Game' or pagetype == 'Novel'
Linha 562: Linha 561:
   
 
--------------------------------------------------------------------------------------------------
 
--------------------------------------------------------------------------------------------------
function p.lua_get_link_e_data_de_lancamento(pagename, pagetype, text, release_date)
+
function p.lua_get_link_e_data_de_lancamento(pagename, pagetype, text, data_de_lancamento)
 
local output = ''
 
local output = ''
 
 
Linha 571: Linha 570:
 
then pagetype = require("Módulo:TipoDePágina").get_tipo_de_pagina(pagename)
 
then pagetype = require("Módulo:TipoDePágina").get_tipo_de_pagina(pagename)
 
end
 
end
output = p.lua_link_padronizado(pagename, pagetype, text)
+
output = p.lua_link_padronizado(pagename, pagetype, texto)
 
if h.isempty(data_de_lancamento)
 
if h.isempty(data_de_lancamento)
 
then data_de_lancamento = p.lua_get_data_de_lancamento(pagename, pagetype)
 
then data_de_lancamento = p.lua_get_data_de_lancamento(pagename, pagetype)
Linha 584: Linha 583:
 
return output, data_de_lancamento
 
return output, data_de_lancamento
 
end
 
end
  +
   
 
--------------------------------------------------------------------------------------------------
 
--------------------------------------------------------------------------------------------------
Linha 590: Linha 590:
 
local args = getArgs(frame)
 
local args = getArgs(frame)
 
local pagename = args[1]
 
local pagename = args[1]
local text = args[2]
+
local texto = args[2]
 
local pagetype = args['tipo']
 
local pagetype = args['tipo']
 
local output = ''
 
local output = ''
Linha 600: Linha 600:
 
then pagetype = require("Módulo:TipoDePágina").get_tipo_de_pagina(pagename)
 
then pagetype = require("Módulo:TipoDePágina").get_tipo_de_pagina(pagename)
 
end
 
end
output = p.lua_link_padronizado(pagename, pagetype, text)
+
output = p.lua_link_padronizado(pagename, pagetype, texto)
 
end
 
end
 
 
Linha 612: Linha 612:
 
local args = getArgs(frame)
 
local args = getArgs(frame)
 
local pagename = args[1]
 
local pagename = args[1]
local text = args[2]
+
local texto = args[2]
 
local pagetype = args['tipo']
 
local pagetype = args['tipo']
 
local data_de_lancamento = args['data']
 
local data_de_lancamento = args['data']
Linha 635: Linha 635:
 
then
 
then
 
pagename = p.lua_substitua_o_sinal_numerico(pagename, pagetype)
 
pagename = p.lua_substitua_o_sinal_numerico(pagename, pagetype)
text = p.lue_get_titulo_do_episodio(pagename)
+
texto = p.lua_get_titulo_do_episodio(pagename)
if text == pagename
+
if texto == pagename
 
then output = p.lua_link_padronizado(pagename, pagetype)
 
then output = p.lua_link_padronizado(pagename, pagetype)
else output = p.lua_link_padronizado(pagename, pagetype, text)
+
else output = p.lua_link_padronizado(pagename, pagetype, texto)
 
end
 
end
 
end
 
end
Linha 647: Linha 647:
   
 
--------------------------------------------------------------------------------------------------
 
--------------------------------------------------------------------------------------------------
-- used in Template:Eltd
+
-- usado na Predefinição:Eltd
function p.get_link_e_data_de_lancamento_to_episode_com_titulo(frame)
+
function p.get_link_e_data_de_lancamento_para_episodio_com_titulo(frame)
 
local args = getArgs(frame)
 
local args = getArgs(frame)
 
local pagename = args[1]
 
local pagename = args[1]
local text
+
local texto
 
local data_de_lancamento = args['data']
 
local data_de_lancamento = args['data']
 
local pagetype = 'Episódio'
 
local pagetype = 'Episódio'
Linha 659: Linha 659:
 
then
 
then
 
pagename = p.lua_substitua_o_sinal_numerico(pagename, pagetype)
 
pagename = p.lua_substitua_o_sinal_numerico(pagename, pagetype)
text = p.lue_get_titulo_do_episodio(pagename)
+
texto = p.lua_get_titulo_do_episodio(pagename)
if text == pagename
+
if texto == pagename
 
then output = p.lua_link_padronizado(pagename, pagetype)
 
then output = p.lua_link_padronizado(pagename, pagetype)
else output = p.lua_link_padronizado(pagename, pagetype, text)
+
else output = p.lua_link_padronizado(pagename, pagetype, texto)
 
end
 
end
 
if h.isempty(data_de_lancamento)
 
if h.isempty(data_de_lancamento)
Linha 676: Linha 676:
   
 
--------------------------------------------------------------------------------------------------
 
--------------------------------------------------------------------------------------------------
function p.lue_get_titulo_do_episodio(pagename)
+
function p.lua_get_titulo_do_episodio(pagename)
local conteudo_da_pagina = ''
+
local page_content = ''
 
local output = ''
 
local output = ''
 
 
Linha 683: Linha 683:
 
then
 
then
 
pagename = p.lua_substitua_o_sinal_numerico(pagename, 'Episódio')
 
pagename = p.lua_substitua_o_sinal_numerico(pagename, 'Episódio')
conteudo_da_pagina = h.get_content(pagename)
+
page_content = h.get_content(pagename)
if conteudo_da_pagina ~= ''
+
if page_content ~= ''
then output = h.get_field_value(conteudo_da_pagina, 'TituloDoEpisodio')
+
then output = h.get_field_value(page_content, 'TítuloDoEpisódio')
 
end
 
end
 
 

Edição das 10h41min de 7 de agosto de 2021

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

local p = {}
local h = require("Módulo:HF")
local getArgs = require('Dev:Arguments').getArgs
---- //*** Funções para transformar nomes de páginas de quadrinhos/episódios no formato desejável ***// ----

--------------------------------------------------------------------------------------------------
-- retorna a edição transformada / número do episódio que pode ser usado para classificar em categorias como números, em vez de texto, incluindo edições "ponto de partida" e edições "-1" / "negativas"
function p.lua_padded_edicao(edicao)
	local menos = '5'
	local ponto_de_partida = '00'
	local i = ''
	local j = ''
	local output = ''
	local s1 = ''
	local s2 = ''
	
	if not h.isempty(edicao)
		then
			if edicao == '½'
				then edicao = '0.5'
			end
			
			if string.find(edicao, '%d+: ') ~= nil
				then edicao = string.match(edicao, '(%d+): ')
			end
			
			s1, s2 = string.match( string.lower(edicao), '(%d+)(%l)')--'(%d+)(%D+)')
			if not h.isempty( s2 ) --and s2 ~= '.'
				then edicao = s1..'.'..s2
			end
			
			if string.match(edicao, '^%-*%d', 1) ~= nil --verifique se a edição começa com um número (incluindo números negativos como -1)
				then
					-- -1 edicoes
					j = string.find(edicao,"-",1,true)
					if not h.isempty(j)
						then
							i = string.sub(edicao,2,#edicao)
							j = string.find(i,".",1,true)
							if not h.isempty(j) 
								then menos = 5 - #string.sub(i,1,j-1)
								else menos = 5 - #i
							end
						else
							i = edicao
					end
	
					-- edições de ponto de partida
					j = string.find(i,".",1,true) 
					if not h.isempty(j)
						then
							ponto_de_partida = string.sub(i,j+1,#i)
							if tonumber(ponto_de_partida) == nil
								then ponto_de_partida = '99' -- para edições com letras depois. em vez de apenas números (por exemplo, O Espetacular Homem-Aranha Vol 5 #16.HU)
							end
							ponto_de_partida = string.rep("0", 2-#ponto_de_partida)..ponto_de_partida
							i = string.sub(i,1,j-1)
					end
	
					output = menos..string.rep("0", 6-#i)..i..ponto_de_partida
				else -- edição não é um número
					output = edicao --'999999999'
			end
	end
	
	return output
end


--------------------------------------------------------------------------------------------------
-- returns transformed volume/season number that can be used for sorting in categories as numbers, instead of text
function p.lua_padded_volume(volume)
	local output = ''
	
	if not h.isempty(volume)
		then output = string.rep("0", 6-#volume)..volume
	end
	
	return output
end


--------------------------------------------------------------------------------------------------
-- returns transformed titulo, with replaced characters like ":" or "/" that can be used for names of files (for example, covers)
function p.lua_titulo_para_arquivos(titulo)
	local output = titulo
	
	output = string.gsub(output,'/',' ')
	output = string.gsub(output,':','')
	output = string.gsub(output,'&','&')
	output = string.gsub(output,''',"'") 

	return output
end


--------------------------------------------------------------------------------------------------
-- divida o nome da página dos quadrinhos/episódios em partes - título, volume/temporada, edição/episódio.
---- Também retorna o volume transformado / número da temporada e número da edição / episódio que pode ser usado para classificar as categorias como números, em vez de texto, incluindo edições de "ponto um" e edições "-1"/"negativas"
---- Também retorna o título transformado, com caracteres substituídos como ":" ou "/" que podem ser usados para nomes de arquivos (por exemplo, capas)
function p.lua_get_titulo_volume_edicao(pagename, pagetype)
	local titulo = ''
	local volume = ''
	local edicao = ''
	local padded_edicao = ''
	local padded_volume = ''
	local titulo_para_arquivos = ''
	local remainder_edicao = ''
	local clean_edicao = ''
	local link_parte1 = ''
	local link_parte2 = ''
	local design = require("Módulo:Design")
	local j
	local k
	local s
	
	if h.isempty(pagetype)
		then pagetype = 'Vol'
	end
	
	j,k = string.find(pagename, ' '..pagetype..' %d+ ')
	if not h.isempty(j)
		then
			titulo = string.sub(pagename, 1, j-1)
			edicao = string.gsub(string.sub(pagename, k+1, #pagename), '#', '')
			j,k,volume = string.find(pagename, ' '..pagetype..' (%d+) ')
		else
			j,k = string.find(pagename, ' #')
			if h.isempty(j)
				then
					j,k = string.find(pagename, ' '..pagetype..' %d+')
					if not h.isempty(j)
						then
							titulo = string.sub(pagename, 1, j-1)
							volume = string.sub(pagename, j+#pagetype+2, k)
						else return ''
					end
				else
					titulo = string.sub(pagename, 1, j-1)
					edicao = string.sub(pagename, k+1, #pagename)
					volume = '1'
			end
	end
	
	if not h.isempty(edicao) and tonumber(edicao) == nil
		then clean_edicao, remainder_edicao = string.match(edicao, '(%d+)(%D+)')
	end
	
	if not h.isempty(titulo)
		then
			if not h.isempty(edicao)
				then
					if pagetype == 'Temporada'
						then link_parte2 = 'E'..string.rep('0', 2-#edicao)..edicao
						else
							link_parte1, link_parte2 = string.match(edicao, '(%d+): (.+)')
							if h.isempty(link_parte2)
								then link_parte2 = ' #'..edicao
								else link_parte2 = design.span(': '..link_parte2).italic
							end
					end
					link_parte1 = titulo..' '..pagetype..' '..volume..' '..edicao
				else
					link_parte1 = titulo..' '..pagetype..' '..volume
			end
			if pagetype == 'Temporada'
				then
					s = string.gsub(titulo, ' %(.+%)', '')
					link_parte2 = design.span(s).italic..' T'..volume..link_parte2
				else
					if volume == '1'
						then link_parte2 = design.span(titulo).italic..link_parte2
						else link_parte2 = design.span(titulo).italic..' ('..pagetype..'. '..volume..')'..link_parte2
					end
			end
	end

	padded_volume = p.lua_padded_volume(volume)
	padded_edicao = p.lua_padded_edicao(edicao)
	titulo_para_arquivos = p.lua_titulo_para_arquivos(titulo)
	return {  ['titulo'] = titulo, 
			  ['volume'] = volume,
			  ['edicao'] = edicao,
			  ['clean_edicao'] = clean_edicao or '',
			  ['remainder_edicao'] = remainder_edicao or '',
			  ['padded_volume'] = padded_volume,
			  ['padded_edicao'] = padded_edicao,
			  ['filename'] = {
				  ['titulo'] = titulo_para_arquivos,
				  ['semedicao'] = titulo_para_arquivos..' '..pagetype..' '..volume,
				  ['all'] = titulo_para_arquivos..' '..pagetype..' '..volume..' '..edicao,
			  },
			  ['classificarnome'] = {
				  ['titulo'] = p.lua_remove_the(titulo),
				  ['semedicao'] = p.lua_remove_the(titulo)..' '..pagetype..' '..padded_volume,
				  ['all'] = p.lua_remove_the(titulo)..' '..pagetype..' '..padded_volume..' '.. padded_edicao,
			  },
			  ['link'] = {
				  ['parte1'] = link_parte1,
				  ['parte2'] = link_parte2,
				  ['all'] = h.Link(link_parte1, link_parte2),
			  },
			  ['semedicao'] = titulo..' '..pagetype..' '..volume,
			  ['all'] = titulo..' '..pagetype..' '..volume..' '..edicao,
			}
end

--------------------------------------------------------------------------------------------------
-- removes "The " from the start of pagename
function p.lua_remove_the(pagename)
	if not h.isempty(pagename) and string.lower( string.sub(pagename, 1, 4) ) == 'the '
		then pagename = string.sub(pagename, 5, #pagename)
	end
	return pagename
end


function p.remove_the(frame)
	local args = getArgs(frame)
	return p.lua_remove_the(args[1])
end


--------------------------------------------------------------------------------------------------
-- padronização automática de nomes de quadrinhos
function p.lua_nome_padronizado_de_quadrinhos(pagename)
	local info = {}
	local output = pagename

	if not h.isempty(pagename)
		then 
			info = p.lua_get_titulo_volume_edicao(pagename, 'Vol')
			if not h.isempty(info.titulo)
				then output = info.all
			end
	end
	
	return output
end


function p.nome_padronizado_de_quadrinhos(frame)
	local args = getArgs(frame)
	return p.lua_nome_padronizado_de_quadrinhos(args[1])
end


--------------------------------------------------------------------------------------------------
-- automatic standardization of episodes names
function p.lua_nome_padronizado_do_episodio(pagename)
	local info = {}
	local output = pagename

	if not h.isempty(pagename)
		then 
			info = p.lua_get_titulo_volume_edicao(pagename, 'Temporada')
			if not h.isempty(info.titulo)
				then output = info.all
			end
	end
	
	return output
end


function p.nome_padronizado_do_episodio(frame)
	local args = getArgs(frame)
	return p.lua_nome_padronizado_do_episodio(args[1])
end


--------------------------------------------------------------------------------------------------
-- returns link after standardization of its name
function p.lua_link_padronizado(pagename, pagetype, texto)
	local design = require("Módulo:Design")
	local link = ''
	local edicao = ''
	local info = {}
	local output = ''
	
	if not h.isempty(pagename)
		then
			if string.find(pagename, '%]%].+') ~= nil
				then return pagename
				else pagename = h.break_link(pagename, 1)
			end
			if h.isempty(pagetype)
				then pagetype = require("Módulo:TipoDePágina").get_tipo_de_pagina(pagename)
			end
			if not h.isempty(pagetype)
				then
					if pagetype == 'Quadrinho' or pagetype == 'Volume' or pagetype == 'Episódio' 
						then
							if pagetype == 'Quadrinho' or pagetype == 'Volume'
								then pagetype = 'Vol'
								else pagetype = 'Temporada'
							end

							info = p.lua_get_titulo_volume_edicao(pagename, pagetype)
							if not h.isempty(texto)
								then output = h.Link(info.link.parte1, texto)
								else output = info.link.all
							end
						elseif pagetype == 'Filme' or pagetype == 'Vídeo Game' or pagetype == 'Série' or pagetype == 'Novel'
							then
								link = pagename
								texto = string.gsub(pagename, ' %(.+%)', '')
								output = h.Link(link, design.span(texto).italic)
						else output = h.Link(pagename)
					end
				else output = h.Link(pagename)
			end
	end
	
	return output
end


--------------------------------------------------------------------------------------------------
function p.comics_link(frame)
	local args = getArgs(frame)
	local arg1 = args[1]
	local output
	
	if not h.isempty(arg1)
		then
			if h.in_list({'-', '--', '---', '—', '—'}, arg1)
				then output = '—'
				else output = p.lua_link_padronizado(arg1, 'Quadrinho', args[2])
			end
	end
	
	return output
end


--------------------------------------------------------------------------------------------------
-- returns name transformed into format for sorting 
---- removes "The" from the begining
---- for comics/episodes changes volume/season and edicao/episode into numbers, instead of text
function p.lua_nome_padronizado_para_classificacao(pagename, pagetype)
	local info = {}
	local output = pagename

	if not h.isempty(pagename) and not h.isempty(pagetype)
		then
			if pagetype == 'Quadrinho' or pagetype == 'Episódio'
				then
					if pagetype == 'Quadrinho'
						then pagetype = 'Vol'
						else pagetype = 'Temporada'
					end
					info = p.lua_get_titulo_volume_edicao(pagename,pagetype)
					if not h.isempty(info.titulo)
						then output = info.classificarnome.all
					end
				elseif pagetype == 'Filme' or pagetype == 'Vídeo Game' or pagetype == 'Novel'
					then output = p.lua_remove_the(pagename)
			end
	end
	
	return output
end


function p.nome_de_quadrinhos_para_classificacao(frame)
	local args = getArgs(frame)
	return p.lua_nome_padronizado_para_classificacao(args[1], 'Quadrinho')
end


--------------------------------------------------------------------------------------------------
-- função para classificar personagens, equipes, itens, etc. por número de realidade
function p.nome_por_classificacao(frame)
	local args = getArgs(frame)
	local modulo_realidade = require('Módulo:Realidade')
	local output = p.lua_remove_the(args[1])
	
	return modulo_realidade.classificar_pela_realidade({output})
end

--------------------------------------------------------------------------------------------------
function p.lua_get_parte(pagename,pagetype,parte)
	local output = ''
	local info = {}
	
	if not h.isempty(pagename) and not h.isempty(pagetype)
		then 
			if pagetype == 'Quadrinho' or pagetype == 'Episódio'
				then
					if pagetype == 'Quadrinho'
						then pagetype = 'Vol'
						else pagetype = 'Temporada'
					end
					
					info = p.lua_get_titulo_volume_edicao(pagename,pagetype)
					if not h.isempty(titulo)
						then 
							if parte == 'Título'
								then output = info.titulo
								elseif parte == 'Volume'
									then output = info.volume
									elseif parte == 'Edição'
										then output = info.edicao
							end
					end
			end
	end
	
	return output
end


function p.get_parte(frame)
	local args = getArgs(frame)
	return p.lua_get_parte(args[1], args[2], args[3])
end


function p.get_titulo_e_volume(frame)
	local args = getArgs(frame)
	local pagename = args[1]
	local info = {}
	local output = ''
	
	if not h.isempty(pagename)
		then 
			info = p.lua_get_titulo_volume_edicao(pagename, 'Vol')
			output = info.titulo .. ' Vol ' .. info.volume
	end
	
	return output
end


--------------------------------------------------------------------------------------------------
function p.lua_cid(pagename)
	local m_data = require("Módulo:Data")
	local design = require("Módulo:Design")
	local data_de_lancamento = ''
	local month = ''
	local ano = ''
	local conteudo_da_pagina = ''
	local info
	local link
	local div = mw.html.create( 'div' ):attr( 'align', 'center' ):done()
	local output = ''
	
	if not h.isempty(pagename)
		then
			output = p.lua_link_padronizado(pagename, 'Quadrinho')
			output = design.span(output).bold
			conteudo_da_pagina = h.get_content(p.lua_get_titulo_volume_edicao(pagename, 'Vol').all)
			data_de_lancamento = h.get_field_value(page_content, 'DataDeLançamento')
			if not h.isempty(data_de_lancamento)
				then
					info = m_data.lua_get_data_de_lancamento_info(data_de_lancamento)
					link = h.Link(info.semana.text, info.sem_dia)
				else
					mes = h.get_field_value(page_content, 'Mês')
					ano = h.get_field_value(page_content, 'Ano')
					info = m_data.lua_get_informacao_da_data_de_publicacao(ano, mes, false)
					link = string.gsub(info.link, '%]%] de %[%[:Categoria:%d+|', ' de ')
			end

			if not h.isempty(link)
				then output = output..'<br>('..link..')'
			end

			output = tostring( div:wikitext(output) )
	end

	return output
end


function p.cid(frame)
	local args = getArgs(frame)
	return p.lua_cid(args[1])
end

--------------------------------------------------------------------------------------------------
-- substitui "#" por "Vol" ou "Temporada"
function p.lua_substitua_o_sinal_numerico(pagename, pagetype)
	local output = ''
	
	if not h.isempty(pagename) 
		then
			if h.isempty(pagetype) 
				then pagetype = ''
			end
			
			if string.find(pagename, '#') ~= nil 
				then
					if string.find(pagename, ' Vol ') ~= nil or string.find(pagename, ' Temporada ') ~= nil
						then output = string.gsub(pagename, '#', '')
						elseif pagetype == 'Quadrinho' or h.exists( string.gsub(pagename, '#', 'Vol 1 ') )
							then output = string.gsub(pagename, '#', 'Vol 1 ')
						elseif pagetype == 'Episódio' or h.exists( string.gsub(pagename, '#', 'Temporada 1 ') )
							then output = string.gsub(pagename, '#', 'Temporada 1 ')
					end
				else
					output = pagename
			end
	end
	
	return output		
end

--------------------------------------------------------------------------------------------------
function p.lua_get_data_de_lancamento(pagename, pagetype)
	local m_data = require("Módulo:Data")
	local conteudo_da_pagina = ''
	local data_de_lancamento = ''
	local ano = ''
	local mes = ''
	local dia = ''
	local output = ''

	if not h.isempty(pagename)
		then
			pagename = p.lua_substitua_o_sinal_numerico(pagename, pagetype)
			if h.isempty(pagetype)
				then pagetype = require("Módulo:TipoDePágina").get_tipo_de_pagina(pagename)
			end
			conteudo_da_pagina = h.get_content(pagename)
			if conteudo_da_pagina ~= ''
				then
					if pagetype == 'Quadrinho'
						then
							data_de_lancamento = h.get_field_value(conteudo_da_pagina, 'DataDeLançamento')
							if not h.isempty(data_de_lancamento)
								then
									info = m_data.lua_get_data_de_lancamento_info(data_de_lancamento)
									output = h.Link(info.semana.text, info.sem_dia)
								else
									mes = h.get_field_value(conteudo_da_pagina, 'Mês')
									ano = h.get_field_value(conteudo_da_pagina, 'Ano')
									info = m_data.lua_get_informacao_da_data_de_publicacao(ano, mes, false)
									output = string.gsub(info.link, '%]%], %[%[:Categoria:%d+|', ' de ')
							end
						elseif pagetype == 'Episódio'
							then 
								ano = h.get_field_value(conteudo_da_pagina, 'Ano')
								mes = h.get_field_value(conteudo_da_pagina, 'Mês')
								dia = h.get_field_value(conteudo_da_pagina, 'Dia')
								if not h.isempty(ano) and not h.isempty(mes) and not h.isempty(dia)
									then 
										mes = m_data.get_nome_do_mes({mes})
										output = h.LinkToCategory(ano..', '..mes, dia..' de '..mes..' de '..ano)
								end
						elseif pagetype == 'Filme' or pagetype == 'Vídeo Game' or pagetype == 'Novel'
							then output = h.get_field_value(conteudo_da_pagina, 'Data de Lançamento')
					end
			end
	end
	
	return output
end


--------------------------------------------------------------------------------------------------
function p.lua_get_link_e_data_de_lancamento(pagename, pagetype, text, data_de_lancamento)
	local output = ''
	
	if not h.isempty(pagename)
		then
			pagename = p.lua_substitua_o_sinal_numerico(pagename, pagetype)
			if h.isempty(pagetype)
				then pagetype = require("Módulo:TipoDePágina").get_tipo_de_pagina(pagename)
			end
			output = p.lua_link_padronizado(pagename, pagetype, texto)
			if h.isempty(data_de_lancamento)
				then data_de_lancamento = p.lua_get_data_de_lancamento(pagename, pagetype)
			end
			if not h.isempty(data_de_lancamento)
				then output = output..'<br>('..data_de_lancamento..')'
			end
			
			output = output..'<br>'
	end
	
	return output, data_de_lancamento
end


--------------------------------------------------------------------------------------------------
-- used in Template:Sl
function p.get_link(frame)
	local args = getArgs(frame)
	local pagename = args[1]
	local texto = args[2]
	local pagetype = args['tipo']
	local output = ''
	
	if not h.isempty(pagename)
		then
			pagename = p.lua_substitua_o_sinal_numerico(pagename, pagetype)
			if h.isempty(pagetype)
				then pagetype = require("Módulo:TipoDePágina").get_tipo_de_pagina(pagename)
			end
			output = p.lua_link_padronizado(pagename, pagetype, texto)
	end
	
	return output
end


--------------------------------------------------------------------------------------------------
-- usado na Predefinição:Sld
function p.get_link_e_data_de_lancamento(frame)
	local args = getArgs(frame)
	local pagename = args[1]
	local texto = args[2]
	local pagetype = args['tipo']
	local data_de_lancamento = args['data']
	
	local output = p.lua_get_link_e_data_de_lancamento(pagename, pagetype, text, data_de_lancamento)

	return output
end


--------------------------------------------------------------------------------------------------
-- retorna o link para o episódio, mas substitui o texto pelo título do episódio
-- usado na Predefinição:Elt
function p.get_link_para_episodio_com_titulo(frame)
	local args = getArgs(frame)
	local pagename = args[1]
	local text
	local pagetype = 'Episódio'
	local output = ''
	
	if not h.isempty(pagename)
		then
			pagename = p.lua_substitua_o_sinal_numerico(pagename, pagetype)
			texto = p.lua_get_titulo_do_episodio(pagename)
			if texto == pagename
				then output = p.lua_link_padronizado(pagename, pagetype)
				else output = p.lua_link_padronizado(pagename, pagetype, texto)
			end
	end
	
	return output
end


--------------------------------------------------------------------------------------------------
-- usado na Predefinição:Eltd
function p.get_link_e_data_de_lancamento_para_episodio_com_titulo(frame)
	local args = getArgs(frame)
	local pagename = args[1]
	local texto
	local data_de_lancamento = args['data']
	local pagetype = 'Episódio'
	local output = ''

	if not h.isempty(pagename)
		then
			pagename = p.lua_substitua_o_sinal_numerico(pagename, pagetype)
			texto = p.lua_get_titulo_do_episodio(pagename)
			if texto == pagename
				then output = p.lua_link_padronizado(pagename, pagetype)
				else output = p.lua_link_padronizado(pagename, pagetype, texto)
			end
			if h.isempty(data_de_lancamento)
				then data_de_lancamento = p.lua_get_data_de_lancamento(pagename, pagetype)
			end
			if not h.isempty(data_de_lancamento)
				then output = output..'<br>('..data_de_lancamento..')'
			end
	end
	
	return output 
end

--------------------------------------------------------------------------------------------------
function p.lua_get_titulo_do_episodio(pagename)
	local page_content = ''
	local output = ''
	
	if not h.isempty(pagename)
		then
			pagename = p.lua_substitua_o_sinal_numerico(pagename, 'Episódio')
			page_content = h.get_content(pagename)
			if page_content ~= ''
				then output = h.get_field_value(page_content, 'TítuloDoEpisódio')
			end
			
			if output ~= ''
				then output = '"'..output..'"'
				else output = pagename
			end
	end
	
	return output
end

return p