Module:Excerpt: Difference between revisions

Content deleted Content added
Update to latest, see talk page
Update to latest version
Line 40:
 
-- Make sure the requested page exists
local page = getArg(1, getArg('article') )
if not page then return getError('no-page') end
local title = mw.title.new(page)
Line 49:
 
-- Set variables
local fragmentsection = getArg(2, mw.ustring.match( getArg(1), 'fragment[^#]+#(.+)') )
local section = fragment or getArg(2, getArg('section', mw.ustring.match( getArg(1, getArg('article') ), '[^#]+#([^#]+)') ) )
local hat = yesno( getArg('hat', true) )
local edit = yesno( getArg('edit', true) )
Line 60 ⟶ 59:
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 subsections = not yesno( getArg('subsections') )
local noBold = not yesno( getArg('bold') )
Line 109 ⟶ 108:
end
 
-- Build the templates option from the config blacklist
local blacklist = table.concat((config.blacklist orand table.concat(config.templates or {})blacklist, ',') or ''
if templates then
if string.sub(templates, 1, 1) == '-' then
Line 146 ⟶ 145:
end
 
-- Add a line break inbefore casean theafter excerptso that the startsparser withinterprets alists, tabletables, oretc. listcorrectly
excerpt = '\n' .. excerpt .. '\n'
 
-- If no file was found, try to excerpt one from the removed infoboxes