Module:Excerpt: Difference between revisions

Content deleted Content added
our license is 3.0
Update to 1.5 (non free files are now removed by default, and inline excerpts now use no tags rather than <span> tags)
Line 2:
-- Documentation https://www.mediawiki.org/wiki/Module:Excerpt
-- By User:Sophivorus, User:Certes & others
-- Version 1.2.35
-- License CC BY-SA-3.0
 
Line 67:
local references = getArg( 'references' )
local subsections = not yesno( getArg( 'subsections' ) )
local noLinks = not yesno( getArg( 'links', true ) )
local noBold = not yesno( getArg( 'bold' ) )
local freefilesonlyFreeFiles = yesno( getArg( 'freefilesonlyfreefiles', true ) )
local inline = yesno( getArg( 'inline' ) )
local quote = yesno( getArg( 'quote' ) )
Line 125 ⟶ 126:
references = references,
only = only and mw.text.trim( only, 's' ) .. 's',
noLinks = noLinks,
noBold = noBold,
noSelfLinks = true,
noNonFreeFiles = freefilesonlyFreeFiles,
noBehaviorSwitches = true,
fixReferences = true,
Line 162 ⟶ 164:
end
excerpt = '[[File:' .. file .. '|thumb|' .. ( caption or '' ) .. ']]' .. excerpt
if ( freefilesonlyFreeFiles ) then
excerpt = Transcluder.removeNonFreeFiles( excerpt )
end
Line 217 ⟶ 219:
 
-- Combine and return the elements
local tag1 = 'div'
local tag2 = 'div'
if quote then
tag2 = 'blockquote'
end
excerpt = mw.html.create( tag1 ):addClass( 'excerpt' ):wikitext( excerpt )
if inline then
excerptreturn =mw.text.trim( excerpt:css( 'display', 'inline' )
end
local tag1tag = 'div'
local block = mw.html.create( tag2 ):addClass( 'excerpt-block' ):addClass( class )
if inlinequote then
tag2tag = 'blockquote'
block = block:css( 'display', 'inline' )
end
excerpt = mw.html.create( tag1'div' ):addClass( 'excerpt' ):wikitext( excerpt )
local block = mw.html.create( tag2tag ):addClass( 'excerpt-block' ):addClass( class )
return block:node( styles ):node( hat ):node( excerpt ):node( more )
end