Diferencia entre revisiones de «Módulo:Excerpt/zona de pruebas»

Contenido eliminado Contenido añadido
Sin resumen de edición
Actualizo a la última versión
Línea 50:
-- Set variables
local fragment = getArg('fragment')
local section = fragment or getArg(2, getArg('section', mw.ustring.match(getArg(1), '[^#]+#([^#]+)') ) )
local hat = yesno( getArg('hat', true) )
local edit = yesno( getArg('edit', true) )
local this = getArg('this')
local only = getArg('only')
local files = getArg('files', getArg('file', ( only == 'file' and 1 ) ) )
local lists = getArg('lists', getArg('list', ( only == 'list' and 1 ) ) )
local tables = getArg('tables', getArg('table', ( only == 'table' and 1 ) ) )
local templates = getArg('templates', getArg('template', ( only == 'template' and 1 ) ) )
local paragraphs = getArg('paragraphs', getArg('paragraph', ( only == 'paragraph' and 1 ) ) )
local references = getArg('references', getArg('reference', ( only == 'reference' and 1 ) ) )
local sections = not yesno( getArg('sections') )
local templates = table.concat((config.templates or {}), ',')
local paragraphs = getArg('paragraphs')
local references = getArg('references')
local noBold = not yesno( getArg('bold') )
local inline = yesno( getArg('inline') )
Línea 66 ⟶ 67:
local more = yesno( getArg('more') )
local class = getArg('class')
local templatesblacklist = table.concat((config.templates or {}), ',')
 
-- Build the hatnote
Línea 80 ⟶ 82:
hat = hat .. ' ' .. getMessage('excerpt') .. ' '
if section and not fragment then
hat = hat .. '[[:' .. page .. '#' .. mw.uri.anchorEncode(section) .. '|' .. page
.. ' § ' .. mw.ustring.gsub(section, '%[%[([^]|]+)|?[^]]*%]%]', '%1') .. ']]' -- remove nested links
else
hat = hat .. '[[:' .. page .. '|' .. page .. ']]'
end
if okedit then
hat = hat .. "''" .. '<span class="mw-editsection-like plainlinks"><span class="mw-editsection-bracket">[</span>['
hat = hat .. title:fullUrl("'action=edit')" .. '<span 'class="mw-editsection-like ..plainlinks"><span class="mw.message.new('-editsection-bracket">[</span>['):plain()
hat = hat .. title:fullUrl('action=edit') .. ' ' .. mw.message.new('editsection'):plain()
hat = hat .. ']<span class="mw-editsection-bracket">]</span></span>' .. "''"
hat = hat .. "''" .. ']<span class="mw-editsection-like plainlinksbracket">]</span class="mw-editsection-bracket">[</span>[' .. "''"
local ok, Hatnote = pcall(require, 'Module:Hatnote')
end
if ok then
if config.hat then
hat = Hatnote._hatnote( hat, { extraclasses = 'dablink excerpt-hat', selfref = true } )
hat = config.hat .. hat .. '}}'
else
hat = frame:preprocess(hat)
hat = mw.html.create('div'):addClass('dablink excerpt-hat'):wikitext(hat)
end
hat = mw.html.create('div'):addClass('dablink excerpt-hat'):wikitext(hat)
else
hat = nil
Línea 112 ⟶ 115:
tables = tables,
paragraphs = paragraphs,
templates = templates ~= '' andor '-' .. templatesblacklist,
sections = sections,
categories = 0,
Línea 119 ⟶ 122:
noBold = noBold,
noSelfLinks = true,
noNonFreeFiles = true,
noBehaviorSwitches = true,
fixReferences = true,
Línea 137 ⟶ 141:
-- If no file was found, try to excerpt one from the removed infoboxes
local fileNamespaces = Transcluder.getNamespaces('File')
if not only and (files ~= '0' or not files) and not Transcluder.matchAny(excerpt, '%[%[', fileNamespaces, ':') and config.captions then
local templates = Transcluder.get(title, { only = 'templates', templates = templatesblacklist, fixReferences = true } )
local parameters = Transcluder.getParameters(templates)
local file, captions, caption
Línea 151 ⟶ 155:
end
excerpt = '[[File:' .. file .. '|thumb|' .. (caption or '') .. ']]' .. excerpt
excerpt = Transcluder.removeNonFreeFiles(excerpt)
break
end
Línea 164 ⟶ 169:
local contentCategory = config.categories.content
if contentCategory and mw.title.getCurrentTitle().isContentPage then
message:node(excerpt = excerpt .. '[[Category:' .. contentCategory .. ']]')
end
local namespaceCategory = config.categories[ mw.title.getCurrentTitle().namespace ]
Línea 191 ⟶ 196:
return block:node(styles):node(hat):node(excerpt):node(more)
end
 
-- Entry points for backwards compatibility
function p.lead(frame) return p.main(frame) end
function p.excerpt(frame) return p.main(frame) end
 
return p