Jump to content

Module:Extract short description

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Trappist the monk (talk | contribs) at 17:56, 27 September 2018. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

local function tag (frame)
	local content = mw.title.new (frame.args[1]):getContent()
	local ibox_start = string.find (content, '{{%s*' .. 'Infobox television episode/sandbox')				-- find the start of {{Infobox ...; ibox_name is a pattern that accepts various legit spacing and capitalization ...
	if not ibox_start then
		return 'Infobox television episode/sandbox not found'
	end

	local ibox_text = string.match (content, '%b{}', ibox_start)				-- ibox_start points to first { of the infobox template
	if not ibox_text then
		return 'failed to extract Infobox television episode/sandbox'
	end
	return ibox_text
--	return frame:callParserFunction ('#tag:syntaxhighlight', tostring(ibox_text))
--	return frame:expandTemplate ({title='code', args = {ibox_text}});
end

return {tag = tag}