Ativa o menu
Alternar menu pessoal
Não autenticado(a)
Your IP address will be publicly visible if you make any edits.

Módulo:Referência web: mudanças entre as edições

Da ProleWiki, a enciclopédia proletária
(Criou a página com "local p = {} local function is_set (var) return not (var == nil or var == ''); end local function italics (var) return "''" .. var .. "''" end function p.cite( frame ) local pframe = frame:getParent() local Author = pframe.args.author if is_set (pframe.args.journalist) then Author = pframe.args.journalist end local Date = pframe.args['date'] local Title = pframe.args.title local URL = pframe.args.url local Newspaper = pframe.args.newspaper local Archiv...")
 
m (Tradução de uma parte do código)
 
Linha 69: Linha 69:
if is_set (Retrieved) then
if is_set (Retrieved) then
fifth_part = "Retrieved" .. " " .. Retrieved .. "."
fifth_part = "Acessado" .. " " .. Retrieved .. "."
else
else
fifth_part = ""
fifth_part = ""

Edição atual tal como às 15h30min de 14 de abril de 2022

local p = {}

local function is_set (var)
	return not (var == nil or var == '');
end

local function italics (var)
	return "''" .. var .. "''"
end

function p.cite( frame )
	local pframe = frame:getParent()

	local Author = pframe.args.author
	if is_set (pframe.args.journalist) then
		Author = pframe.args.journalist
	end
	local Date = pframe.args['date']
	local Title = pframe.args.title
	local URL = pframe.args.url
	local Newspaper = pframe.args.newspaper
	local ArchiveURL = pframe.args['archive-url']
	local ArchiveDate = pframe.args['archive-date']
	local Retrieved = pframe.args.retrieved
	local Quote = pframe.args.quote
	
	if is_set (Author) then
		if is_set (Date) then
			first_part = Author .. " (" .. Date .. ")."
			else
				first_part = Author .. "."
		end
		else
			first_part = ""
	end
	
	if is_set (Title) then
		if is_set (URL) then
			Title = "[" .. URL .. " " .. "\"" .. Title .. "\"" .. "]"
			end
		if not is_set (Author) then
			if is_set (Date) then
			Title = Title .. " (" .. Date .. ")."
			else
				Title = Title .. "."
			end
	end
		second_part = Title
		else
			second_part = ""
	end
	
	if is_set(Newspaper) then
			third_part = "''" .. Newspaper .. "''."
			else
				third_part = ""
		end
		

	if is_set(ArchiveURL) then
		if is_set(ArchiveDate) then
			fourth_part = "[" .. ArchiveURL .. " " .. "Archived" .. "]" .. " " .. " from the original on" .. " " .. ArchiveDate .. "."
			else
				fourth_part = "[" .. ArchiveURL .. " " .. "Archived" .. "]" .. " from the original."
		end
			else
				fourth_part = ""
	end
			
	if is_set (Retrieved) then
		fifth_part = "Acessado" .. " " .. Retrieved .. "."
		else
			fifth_part = ""
	end
		
	if is_set (Quote) then
		Quote = "“" .. Quote .. "”"
		local div = mw.html.create ('div')
		div
		:attr("style", "width:80%; margin-left:10%;")
		:wikitext(Quote)
		local br = mw.html.create ('br', selfClosing)
		first_part = italics(tostring(div)) .. tostring(br) .. first_part
	end


	if is_set (first_part) then
		first_part = first_part .. " "
	end
	
	if is_set (second_part) then
		second_part = second_part .. " "
	end
	
	if is_set (third_part) then
		third_part = third_part .. " "
	end
	
	if is_set (fourth_part) then
		fourth_part = fourth_part .. " "
	end
	
	Render = first_part .. second_part .. third_part .. fourth_part .. fifth_part
	
	return Render
end
return p