<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://timeline.oldera.org/wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3AExcerpt</id>
	<title>Module:Excerpt - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://timeline.oldera.org/wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3AExcerpt"/>
	<link rel="alternate" type="text/html" href="http://timeline.oldera.org/wiki/index.php?title=Module:Excerpt&amp;action=history"/>
	<updated>2026-04-26T08:00:12Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.37.1</generator>
	<entry>
		<id>http://timeline.oldera.org/wiki/index.php?title=Module:Excerpt&amp;diff=5566&amp;oldid=prev</id>
		<title>Karen: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="http://timeline.oldera.org/wiki/index.php?title=Module:Excerpt&amp;diff=5566&amp;oldid=prev"/>
		<updated>2023-11-09T16:38:32Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 16:38, 9 November 2023&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Karen</name></author>
	</entry>
	<entry>
		<id>http://timeline.oldera.org/wiki/index.php?title=Module:Excerpt&amp;diff=5565&amp;oldid=prev</id>
		<title>en&gt;Sophivorus: Update to latest: refine error handling for invalid titles, make some methods local, add Aidan9382 as author, remove old reference to fragment param</title>
		<link rel="alternate" type="text/html" href="http://timeline.oldera.org/wiki/index.php?title=Module:Excerpt&amp;diff=5565&amp;oldid=prev"/>
		<updated>2023-07-10T16:17:53Z</updated>

		<summary type="html">&lt;p&gt;Update to latest: refine error handling for invalid titles, make some methods local, add Aidan9382 as author, remove old reference to fragment param&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- Module:Excerpt implements the Excerpt template&lt;br /&gt;
-- Documentation and master version: https://en.wikipedia.org/wiki/Module:Excerpt&lt;br /&gt;
-- Authors: User:Sophivorus, User:Certes, User:Aidan9382 &amp;amp; others&lt;br /&gt;
-- License: CC-BY-SA-3.0&lt;br /&gt;
&lt;br /&gt;
local Transcluder = require( 'Module:Transcluder' )&lt;br /&gt;
&lt;br /&gt;
local yesno = require( 'Module:Yesno' )&lt;br /&gt;
&lt;br /&gt;
local ok, config = pcall( require, 'Module:Excerpt/config' )&lt;br /&gt;
if not ok then config = {} end&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
-- Helper function to get arguments&lt;br /&gt;
local args&lt;br /&gt;
local function getArg( key, default )&lt;br /&gt;
	local value = args[ key ]&lt;br /&gt;
	if value and mw.text.trim( value ) ~= '' then&lt;br /&gt;
		return value&lt;br /&gt;
	end&lt;br /&gt;
	return default&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Helper function to handle errors&lt;br /&gt;
local function getError( message, value )&lt;br /&gt;
	if type( message ) == 'string' then&lt;br /&gt;
		message = Transcluder.getError( message, value )&lt;br /&gt;
	end&lt;br /&gt;
	if config.categories and config.categories.errors and mw.title.getCurrentTitle().isContentPage then&lt;br /&gt;
		message:node( '[[Category:' .. config.categories.errors .. ']]' )&lt;br /&gt;
	end&lt;br /&gt;
	return message&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Helper function to get localized messages&lt;br /&gt;
local function getMessage( key )&lt;br /&gt;
	local ok, TNT = pcall( require, 'Module:TNT' )&lt;br /&gt;
	if not ok then return key end&lt;br /&gt;
	return TNT.format( 'I18n/Module:Excerpt.tab', key )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Main entry point for templates&lt;br /&gt;
function p.main( frame )&lt;br /&gt;
	args = Transcluder.parseArgs( frame )&lt;br /&gt;
&lt;br /&gt;
	-- Make sure the requested page exists&lt;br /&gt;
	local page = getArg( 1 )&lt;br /&gt;
	if not page or page == '{{{1}}}' then return getError( 'no-page' ) end&lt;br /&gt;
	local title = mw.title.new(page)&lt;br /&gt;
	if not title then return getError( 'invalid-title', page ) end&lt;br /&gt;
	if title.isRedirect then title = title.redirectTarget end&lt;br /&gt;
	if not title.exists then return getError( 'page-not-found', page ) end&lt;br /&gt;
	page = title.prefixedText&lt;br /&gt;
&lt;br /&gt;
	-- Set variables from the template parameters&lt;br /&gt;
	local section = getArg( 2, mw.ustring.match( getArg( 1 ), '[^#]+#(.+)' ) )&lt;br /&gt;
	local hat = yesno( getArg( 'hat', true ) )&lt;br /&gt;
	local edit = yesno( getArg( 'edit', true ) )&lt;br /&gt;
	local this = getArg( 'this' )&lt;br /&gt;
	local only = getArg( 'only' )&lt;br /&gt;
	local files = getArg( 'files', getArg( 'file', ( only == 'file' and 1 ) ) )&lt;br /&gt;
	local lists = getArg( 'lists', getArg( 'list', ( only == 'list' and 1 ) ) )&lt;br /&gt;
	local tables = getArg( 'tables', getArg( 'table', ( only == 'table' and 1 ) ) )&lt;br /&gt;
	local templates = getArg( 'templates', getArg( 'template', ( only == 'template' and 1 ) ) )&lt;br /&gt;
	local paragraphs = getArg( 'paragraphs', getArg( 'paragraph', ( only == 'paragraph' and 1 ) ) )&lt;br /&gt;
	local references = getArg( 'references' )&lt;br /&gt;
	local subsections = not yesno( getArg( 'subsections' ) )&lt;br /&gt;
	local noLinks = not yesno( getArg( 'links', true ) )&lt;br /&gt;
	local noBold = not yesno( getArg( 'bold' ) )&lt;br /&gt;
	local onlyFreeFiles = yesno( getArg( 'onlyfreefiles', true ) )&lt;br /&gt;
	local briefDates = yesno( getArg( 'briefdates', false ) )&lt;br /&gt;
	local inline = yesno( getArg( 'inline' ) )&lt;br /&gt;
	local quote = yesno( getArg( 'quote' ) )&lt;br /&gt;
	local more = yesno( getArg( 'more' ) )&lt;br /&gt;
	local class = getArg( 'class' )&lt;br /&gt;
	local displaytitle = getArg( 'displaytitle' ) or page&lt;br /&gt;
&lt;br /&gt;
	-- Build the hatnote&lt;br /&gt;
	if hat and not inline then&lt;br /&gt;
		if this then&lt;br /&gt;
			hat = this&lt;br /&gt;
		elseif quote then&lt;br /&gt;
			hat = getMessage( 'this' )&lt;br /&gt;
		elseif only then&lt;br /&gt;
			hat = getMessage( only )&lt;br /&gt;
		else&lt;br /&gt;
			hat = getMessage( 'section' )&lt;br /&gt;
		end&lt;br /&gt;
		hat = hat .. ' ' .. getMessage( 'excerpt' ) .. ' '&lt;br /&gt;
		if section then&lt;br /&gt;
			hat = hat .. '[[:' .. page .. '#' .. mw.uri.anchorEncode( section ) .. '|' .. displaytitle&lt;br /&gt;
				.. ' § ' .. mw.ustring.gsub( section, '%[%[([^]|]+)|?[^]]*%]%]', '%1' ) .. ']].' -- remove nested links&lt;br /&gt;
		else&lt;br /&gt;
			hat = hat .. '[[:' .. page .. '|' .. displaytitle .. ']].'&lt;br /&gt;
		end&lt;br /&gt;
		if edit then&lt;br /&gt;
			hat = hat .. '&amp;lt;span class=&amp;quot;mw-editsection-like plainlinks&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;mw-editsection-bracket&amp;quot;&amp;gt;[&amp;lt;/span&amp;gt;['&lt;br /&gt;
			hat = hat .. title:fullUrl( 'action=edit' ) .. ' ' .. mw.message.new( 'editsection' ):plain()&lt;br /&gt;
			hat = hat .. ']&amp;lt;span class=&amp;quot;mw-editsection-bracket&amp;quot;&amp;gt;]&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;'&lt;br /&gt;
		end&lt;br /&gt;
		if config.hat then&lt;br /&gt;
			hat = config.hat .. hat .. '}}'&lt;br /&gt;
			hat = frame:preprocess( hat )&lt;br /&gt;
		else&lt;br /&gt;
			hat = mw.html.create( 'div' ):addClass( 'dablink excerpt-hat' ):wikitext( hat )&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		hat = nil&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Build the &amp;quot;Read more&amp;quot; link&lt;br /&gt;
	if more and not inline then&lt;br /&gt;
		more = &amp;quot;'''[[&amp;quot; .. page .. '#' .. ( section or '' ) .. &amp;quot;|&amp;quot; .. getMessage( 'more' ) .. &amp;quot;]]'''&amp;quot;&lt;br /&gt;
		more = mw.html.create( 'div' ):addClass( 'noprint excerpt-more' ):wikitext( more )&lt;br /&gt;
	else&lt;br /&gt;
		more = nil&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Build the options for Module:Transcluder out of the template parameters and the desired defaults&lt;br /&gt;
	local options = {&lt;br /&gt;
		files = files,&lt;br /&gt;
		lists = lists,&lt;br /&gt;
		tables = tables,&lt;br /&gt;
		paragraphs = paragraphs,&lt;br /&gt;
		sections = subsections,&lt;br /&gt;
		categories = 0,&lt;br /&gt;
		references = references,&lt;br /&gt;
		only = only and mw.text.trim( only, 's' ) .. 's',&lt;br /&gt;
		noLinks = noLinks,&lt;br /&gt;
		noBold = noBold,&lt;br /&gt;
		noSelfLinks = true,&lt;br /&gt;
		noNonFreeFiles = onlyFreeFiles,&lt;br /&gt;
		noBehaviorSwitches = true,&lt;br /&gt;
		fixReferences = true,&lt;br /&gt;
		linkBold = true,&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	-- Get the excerpt itself&lt;br /&gt;
	local title = page .. '#' .. ( section or '' )&lt;br /&gt;
	local ok, excerpt = pcall( Transcluder.get, title, options )&lt;br /&gt;
	if not ok then return getError( excerpt ) end&lt;br /&gt;
	if mw.text.trim( excerpt ) == '' and not only then&lt;br /&gt;
		if section then return getError( 'section-empty', section ) else return getError( 'lead-empty' ) end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Fix birth and death dates, but only in the first paragraph&lt;br /&gt;
	if briefDates then&lt;br /&gt;
		local startpos = 1 -- skip initial templates&lt;br /&gt;
		local s&lt;br /&gt;
		local e = 0&lt;br /&gt;
		repeat&lt;br /&gt;
			startpos = e + 1&lt;br /&gt;
			s, e = mw.ustring.find( excerpt, &amp;quot;%s*%b{}%s*&amp;quot;, startpos )&lt;br /&gt;
		until not s or s &amp;gt; startpos&lt;br /&gt;
		s, e = mw.ustring.find( excerpt, &amp;quot;%b()&amp;quot;, startpos ) -- get (...), which may be (year–year)&lt;br /&gt;
		if s and s &amp;lt; startpos + 100 then -- look only near the start&lt;br /&gt;
			local year1, conjunction, year2 = mw.ustring.match( mw.ustring.sub( excerpt, s, e ), '(%d%d%d+)(.-)(%d%d%d+)' )&lt;br /&gt;
			if year1 and year2 and (mw.ustring.match( conjunction, '[%-–—]' ) or mw.ustring.match( conjunction, '{{%s*[sS]nd%s*}}' )) then&lt;br /&gt;
				local y1 = tonumber(year1)&lt;br /&gt;
				local y2 = tonumber(year2)&lt;br /&gt;
				if y2 &amp;gt; y1 and y2 &amp;lt; y1 + 125 and y1 &amp;lt;= tonumber( os.date( &amp;quot;%Y&amp;quot; )) then&lt;br /&gt;
					excerpt = mw.ustring.sub( excerpt, 1, s ) .. year1 .. &amp;quot;–&amp;quot; .. year2 .. mw.ustring.sub( excerpt, e )&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- If no file was found, try to get one from the infobox&lt;br /&gt;
	local fileNamespaces = Transcluder.getNamespaces( 'File' )&lt;br /&gt;
	if ( ( only == 'file' or only == 'files' ) or ( not only and ( files ~= '0' or not files ) ) ) and -- caller asked for files&lt;br /&gt;
		not Transcluder.matchAny( excerpt, '%[%[', fileNamespaces, ':' ) and -- and there are no files in Transcluder's output&lt;br /&gt;
		config.captions -- and we have the config option required to try finding files in templates&lt;br /&gt;
	then&lt;br /&gt;
		-- We cannot distinguish the infobox from the other templates so we search them all&lt;br /&gt;
		local infobox = Transcluder.getTemplates( excerpt );&lt;br /&gt;
		infobox = table.concat( infobox )&lt;br /&gt;
		local parameters = Transcluder.getParameters( infobox )&lt;br /&gt;
		local file, captions, caption&lt;br /&gt;
		for _, pair in pairs( config.captions ) do&lt;br /&gt;
			file = pair[1]&lt;br /&gt;
			file = parameters[file]&lt;br /&gt;
			if file and Transcluder.matchAny( file, '^.*%.', { '[Jj][Pp][Ee]?[Gg]', '[Pp][Nn][Gg]', '[Gg][Ii][Ff]', '[Ss][Vv][Gg]' }, '.*' ) then&lt;br /&gt;
				file = mw.ustring.match( file, '%[?%[?.-:([^{|]+)%]?%]?' ) or file -- [[File:Example.jpg{{!}}upright=1.5]] to Example.jpg&lt;br /&gt;
				captions = pair[2]&lt;br /&gt;
				for _, p in pairs( captions ) do&lt;br /&gt;
					if parameters[ p ] then caption = parameters[ p ] break end&lt;br /&gt;
				end&lt;br /&gt;
				excerpt = '[[File:' .. file .. '|thumb|' .. ( caption or '' ) .. ']]' .. excerpt&lt;br /&gt;
				if ( onlyFreeFiles ) then&lt;br /&gt;
					excerpt = Transcluder.removeNonFreeFiles( excerpt )&lt;br /&gt;
				end&lt;br /&gt;
				break&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Unlike other elements, templates are filtered here&lt;br /&gt;
	-- because we had to search the infoboxes for files&lt;br /&gt;
	local trash&lt;br /&gt;
	if only and ( only == 'template' or only == 'templates' ) then&lt;br /&gt;
		trash, excerpt = Transcluder.getTemplates( excerpt, templates );&lt;br /&gt;
	else -- Remove blacklisted templates&lt;br /&gt;
		local blacklist = config.blacklist and table.concat( config.blacklist, ',' ) or ''&lt;br /&gt;
		if templates then&lt;br /&gt;
			if string.sub( templates, 1, 1 ) == '-' then --Unwanted templates. Append to blacklist&lt;br /&gt;
				blacklist = templates .. ',' .. blacklist&lt;br /&gt;
			else --Wanted templates. Replaces blacklist and acts as whitelist&lt;br /&gt;
				blacklist = templates&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			blacklist = '-' .. blacklist&lt;br /&gt;
		end&lt;br /&gt;
		trash, excerpt = Transcluder.getTemplates( excerpt, blacklist );&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Remove extra line breaks but leave one before and after so the parser interprets lists, tables, etc. correctly&lt;br /&gt;
	excerpt = mw.text.trim( excerpt )&lt;br /&gt;
	excerpt = string.gsub( excerpt, '\n\n\n+', '\n\n' )&lt;br /&gt;
	excerpt = '\n' .. excerpt .. '\n'&lt;br /&gt;
&lt;br /&gt;
	-- Remove nested categories&lt;br /&gt;
	excerpt = frame:preprocess( excerpt )&lt;br /&gt;
	local categories, excerpt = Transcluder.getCategories( excerpt, options.categories )&lt;br /&gt;
&lt;br /&gt;
	-- Add tracking categories&lt;br /&gt;
	if config.categories then&lt;br /&gt;
		local contentCategory = config.categories.content&lt;br /&gt;
		if contentCategory and mw.title.getCurrentTitle().isContentPage then&lt;br /&gt;
			excerpt = excerpt .. '[[Category:' .. contentCategory .. ']]'&lt;br /&gt;
		end&lt;br /&gt;
		local namespaceCategory = config.categories[ mw.title.getCurrentTitle().namespace ]&lt;br /&gt;
		if namespaceCategory then&lt;br /&gt;
			excerpt = excerpt .. '[[Category:' .. namespaceCategory .. ']]'&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Load the styles&lt;br /&gt;
	local styles&lt;br /&gt;
	if config.styles then&lt;br /&gt;
		styles = frame:extensionTag( 'templatestyles', '', { src = config.styles } )&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Combine and return the elements&lt;br /&gt;
	if inline then&lt;br /&gt;
		return mw.text.trim( excerpt )&lt;br /&gt;
	end&lt;br /&gt;
	local tag = 'div'&lt;br /&gt;
	if quote then&lt;br /&gt;
		tag = 'blockquote'&lt;br /&gt;
	end&lt;br /&gt;
	excerpt = mw.html.create( 'div' ):addClass( 'excerpt' ):wikitext( excerpt )&lt;br /&gt;
	local block = mw.html.create( tag ):addClass( 'excerpt-block' ):addClass( class )&lt;br /&gt;
	return block:node( styles ):node( hat ):node( excerpt ):node( more )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Entry points for backwards compatibility&lt;br /&gt;
function p.lead( frame ) return p.main( frame ) end&lt;br /&gt;
function p.excerpt( frame ) return p.main( frame ) end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>en&gt;Sophivorus</name></author>
	</entry>
</feed>