<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.ostan-collections.net/wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3ALockbox</id>
	<title>Module:Lockbox - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.ostan-collections.net/wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3ALockbox"/>
	<link rel="alternate" type="text/html" href="https://www.ostan-collections.net/wiki/index.php?title=Module:Lockbox&amp;action=history"/>
	<updated>2026-04-10T19:19:16Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.15</generator>
	<entry>
		<id>https://www.ostan-collections.net/wiki/index.php?title=Module:Lockbox&amp;diff=5944&amp;oldid=prev</id>
		<title>Halian: Created page with &quot;local export = {}  -- XXX: OUTRAGEOUS ABUSE OF SCRIBUNTO API -- Generates a transclusion without incrementing the &quot;expensive function&quot; count local generate_transclusion do  	local mock_title = mw.title.new(mw.title.getCurrentTitle().id) 	local getContent = mock_title.getContent 	function generate_transclusion(title) 		local full_text = type(title) == &#039;table&#039; and title.fullText or title 		rawset(mock_title, &#039;fullText&#039;, full_text) 		getContent(mock_title) 	end end  local f...&quot;</title>
		<link rel="alternate" type="text/html" href="https://www.ostan-collections.net/wiki/index.php?title=Module:Lockbox&amp;diff=5944&amp;oldid=prev"/>
		<updated>2023-12-05T04:58:53Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;local export = {}  -- XXX: OUTRAGEOUS ABUSE OF SCRIBUNTO API -- Generates a transclusion without incrementing the &amp;quot;expensive function&amp;quot; count local generate_transclusion do  	local mock_title = mw.title.new(mw.title.getCurrentTitle().id) 	local getContent = mock_title.getContent 	function generate_transclusion(title) 		local full_text = type(title) == &amp;#039;table&amp;#039; and title.fullText or title 		rawset(mock_title, &amp;#039;fullText&amp;#039;, full_text) 		getContent(mock_title) 	end end  local f...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local export = {}&lt;br /&gt;
&lt;br /&gt;
-- XXX: OUTRAGEOUS ABUSE OF SCRIBUNTO API&lt;br /&gt;
-- Generates a transclusion without incrementing the &amp;quot;expensive function&amp;quot; count&lt;br /&gt;
local generate_transclusion&lt;br /&gt;
do &lt;br /&gt;
	local mock_title = mw.title.new(mw.title.getCurrentTitle().id)&lt;br /&gt;
	local getContent = mock_title.getContent&lt;br /&gt;
	function generate_transclusion(title)&lt;br /&gt;
		local full_text = type(title) == &amp;#039;table&amp;#039; and title.fullText or title&lt;br /&gt;
		rawset(mock_title, &amp;#039;fullText&amp;#039;, full_text)&lt;br /&gt;
		getContent(mock_title)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function make_wikitext_warning(msg)&lt;br /&gt;
	return string.format(&amp;#039;&amp;lt;strong class=&amp;quot;error&amp;quot;&amp;gt;Warning: %s.&amp;lt;/strong&amp;gt;&amp;#039;, msg)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function export.lock(frame)&lt;br /&gt;
	local warnings, transclusion_list = {}, {}&lt;br /&gt;
	&lt;br /&gt;
	-- Check if the transcluding page is cascade-protected.&lt;br /&gt;
	--&lt;br /&gt;
	-- Only pages transcluded from a cascade-protected page appear in&lt;br /&gt;
	-- CASCADINGSOURCES, so normally we would not be able to tell if the lockbox&lt;br /&gt;
	-- itself is cascade-protected. To work around this, we generate a&lt;br /&gt;
	-- transclusion from the lockbox to itself, so that it will have an entry&lt;br /&gt;
	-- for itself in CASCADINGSOURCES.&lt;br /&gt;
	--&lt;br /&gt;
	-- We cannot generate this transclusion using the title object for the&lt;br /&gt;
	-- parent title (the lockbox), as if the lockbox is transcluded on another&lt;br /&gt;
	-- page, we will generate a transclusion *from* the lockbox *to* that page&lt;br /&gt;
	-- as well, and the page will be cascade-protected. Instead we generate it&lt;br /&gt;
	-- with the title object for the current title.&lt;br /&gt;
	--&lt;br /&gt;
	-- When the current title is the parent title (i.e. we are rendering the&lt;br /&gt;
	-- lockbox page), this creates the required entry in the link table in the&lt;br /&gt;
	-- database. When the current title is the grandparent title or up (i.e. we&lt;br /&gt;
	-- are rendering a page transcluding the lockbox), transclusions are only&lt;br /&gt;
	-- created from the page itself, not from the lockbox, and it is not&lt;br /&gt;
	-- cascade-protected.&lt;br /&gt;
	-- &lt;br /&gt;
	-- This creates an extaneous self-transclusion for all pages using the&lt;br /&gt;
	-- module, but we treat that as a necessary evil.&lt;br /&gt;
	do&lt;br /&gt;
		mw.title.getCurrentTitle():getContent() -- Generate self-transclusion&lt;br /&gt;
		local parent_title = frame:getParent():getTitle()&lt;br /&gt;
		if not mw.title.new(parent_title).cascadingProtection.sources[1] then&lt;br /&gt;
			warnings[#warnings + 1] = make_wikitext_warning(string.format(&lt;br /&gt;
				&amp;#039;the page &amp;quot;%s&amp;quot; is not cascade-protected&amp;#039;,&lt;br /&gt;
				parent_title&lt;br /&gt;
			))&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Generate transclusions to the templates, and build the output list.&lt;br /&gt;
	for i, item in ipairs(frame.args) do&lt;br /&gt;
		item = mw.text.trim(item)&lt;br /&gt;
		local title = mw.title.new(item)&lt;br /&gt;
		if title then&lt;br /&gt;
			local ns = title.namespace&lt;br /&gt;
			local prefixed_text = title.prefixedText&lt;br /&gt;
			if ns == 0 then&lt;br /&gt;
				-- The item had no namespace text. If the item starts with a&lt;br /&gt;
				-- colon, assume it is a mainspace page. Otherwise, assume it is&lt;br /&gt;
				-- a template.&lt;br /&gt;
				if item:sub(1, 1) == &amp;#039;:&amp;#039; then&lt;br /&gt;
					generate_transclusion(title)&lt;br /&gt;
					table.insert(transclusion_list, &amp;#039;* [[&amp;#039; .. prefixed_text .. &amp;#039;]]&amp;#039;)&lt;br /&gt;
				else&lt;br /&gt;
					generate_transclusion(&amp;#039;Template:&amp;#039; .. prefixed_text)&lt;br /&gt;
					table.insert(transclusion_list, &amp;#039;* [[Template:&amp;#039; .. prefixed_text .. &amp;#039;]]&amp;#039;)&lt;br /&gt;
				end&lt;br /&gt;
			elseif ns == 6 or ns == 14 then -- File or Category namespace&lt;br /&gt;
				generate_transclusion(title)&lt;br /&gt;
				table.insert(transclusion_list, &amp;#039;* [[:&amp;#039; .. prefixed_text .. &amp;#039;]]&amp;#039;)&lt;br /&gt;
			else&lt;br /&gt;
				generate_transclusion(title)&lt;br /&gt;
				table.insert(transclusion_list, &amp;#039;* [[&amp;#039; .. prefixed_text .. &amp;#039;]]&amp;#039;)&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			warnings[#warnings + 1] = make_wikitext_warning(string.format(&lt;br /&gt;
				&amp;#039;invalid title &amp;quot;%s&amp;quot; in argument #%d&amp;#039;,&lt;br /&gt;
				item,&lt;br /&gt;
				i&lt;br /&gt;
			))&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if frame.args.silent then&lt;br /&gt;
		return &amp;#039;&amp;#039;&lt;br /&gt;
	else&lt;br /&gt;
		-- If there were any warnings, show them at the top. Then show the list&lt;br /&gt;
		-- of transcluded pages.&lt;br /&gt;
		local ret = &amp;#039;&amp;#039;&lt;br /&gt;
		if #warnings &amp;gt; 0 then&lt;br /&gt;
			if #warnings &amp;gt; 1 then&lt;br /&gt;
				for i, warning in ipairs(warnings) do&lt;br /&gt;
					warnings[i] = &amp;#039;* &amp;#039; .. warning&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			ret = ret .. table.concat(warnings, &amp;#039;\n&amp;#039;) .. &amp;#039;\n\n&amp;#039;&lt;br /&gt;
		end&lt;br /&gt;
		return ret .. table.concat(transclusion_list, &amp;#039;\n&amp;#039;)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return export&lt;/div&gt;</summary>
		<author><name>Halian</name></author>
	</entry>
</feed>