Diferencia entre revisiones de «Módulo:Encabezado»

Contenido eliminado Contenido añadido
Sin resumen de edición
Sin resumen de edición
Línea 9:
local altparams= {['titulo']='título', ['title']='título', ['left']='anterior', ['right']='próximo', ['author']='autor', ['traducción']='traductor' }
 
 
local function enlaceMicroformato(param, valor)
local function link(s)
return mw.html.create('span')
if s:match("%[") then
:addClass('ws-' .. param)
return s
:wikitext(valor)
else
return '[['..s..']]'
end
end
local function delink(s)
Línea 22 ⟶ 25:
result = mw.uri.decode(result, "PATH") -- decode percent-encoded entities. Leave underscores and plus signs.
result = mw.text.decode(result, true) -- decode HTML entities.
-- Check for bad titles. To do this we need to find the
-- title area of the link, i.e. the part before any pipes.
local titlearea
if result:match("|") then -- Find if we're dealing with a piped link.
titlearea = result:match("^%[%[(.-%|.*)%]%]")
else
titlearea = result:match("^%[%[(.-)%]%]")
end
-- Check for bad characters.
if mw.ustring.match(titlearea, "[%[%]<>{}%%%c\n]") then
return s
end
-- Check for categories, interwikis, and files.
local colonprefix = result:match("%[%[(.-):.*%]%]") or "" -- Get the text before the first colon.
local ns = mw.site.namespaces[colonprefix] -- see if this is a known namespace
if mw.language.isKnownLanguageTag(colonprefix)
or ( ns and ( ns.canonicalName == "File" or ns.canonicalName == "Category" ) ) then
return ""
end
-- Remove the colon if the link is using the [[Help:Colon trick]].
if result:match("%[%[:") then
result = "[[" .. result:match("%[%[:(.*%]%])")
end
-- Deal with links using the [[Help:Pipe trick]].
-- if mw.ustring.match(result, "^%[%[[^|]*|%]%]") then
-- return delinkPipeTrick(result)
-- end
-- Find the display area of the wikilink
if result:match("|") then -- Find if we're dealing with a piped link.
result = result:match("^%[%[(.-%|(.+)%]%]")
-- Remove new lines from the display of multiline piped links,
-- where the pipe is before the first new line.
Línea 80 ⟶ 55:
return texto
end
local function enlaceMicroformato(param, valor)
 
return mw.html.create('span')
:addClass('ws-' .. param)
:wikitext(delink(valor))
end
function p.encabe( frame )
local argus = {}
Línea 137 ⟶ 116:
for _,v in ipairs(mw.text.split(argus['autor'], '[/,]')) do
i = i-1
medio:wikitext('[['..delinklink(v)..']]')
if i >0 then medio:wikitext(',&nbsp;') end
end
Línea 146 ⟶ 125:
medio:wikitext('traducción de [[Ayuda:Directrices para traducciones|Wikisource]]')
else
medio:wikitext('traduccion de [['..delinklink(argus['traductor'])..']]')
end
medio:tag('br')
Línea 152 ⟶ 131:
end
if argus['ilustrador'] then
medio:wikitext('ilustración de [['..delinklink(argus['ilustrador'])..']]')
medio:tag('br')
end
Línea 162 ⟶ 141:
medio:wikitext(argus['sección'])
if argus['sección autor'] then
medio:wikitext('&nbsp;de&nbsp;[['..delink(argus['sección autor'])..']]')
end
if argus['subsección'] then