<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://pool.calebcooper.ie/index.php?action=history&amp;feed=atom&amp;title=Module%3ASuppress_categories</id>
	<title>Module:Suppress categories - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://pool.calebcooper.ie/index.php?action=history&amp;feed=atom&amp;title=Module%3ASuppress_categories"/>
	<link rel="alternate" type="text/html" href="https://pool.calebcooper.ie/index.php?title=Module:Suppress_categories&amp;action=history"/>
	<updated>2026-04-10T11:47:35Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://pool.calebcooper.ie/index.php?title=Module:Suppress_categories&amp;diff=15770&amp;oldid=prev</id>
		<title>Caleb Cooper: Created page with &quot;-- This is a simple module to strip categories from wikitext. It does -- not support nested links or magic words like __TOC__, etc. Even so, -- it should still handle most cat...&quot;</title>
		<link rel="alternate" type="text/html" href="https://pool.calebcooper.ie/index.php?title=Module:Suppress_categories&amp;diff=15770&amp;oldid=prev"/>
		<updated>2020-11-09T13:21:30Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;-- This is a simple module to strip categories from wikitext. It does -- not support nested links or magic words like __TOC__, etc. Even so, -- it should still handle most cat...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- This is a simple module to strip categories from wikitext. It does&lt;br /&gt;
-- not support nested links or magic words like __TOC__, etc. Even so,&lt;br /&gt;
-- it should still handle most categories.&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
-- Detects if a category link is valid or not. If it is valid,&lt;br /&gt;
-- the function returns the blank string. If not, the input&lt;br /&gt;
-- is returned with no changes.&lt;br /&gt;
local function processCategory( all, submatch )&lt;br /&gt;
    local beforePipe = mw.ustring.match( submatch, &amp;#039;^(.-)[%s_]*|[%s_]*.-$&amp;#039; )&lt;br /&gt;
    beforePipe = beforePipe or submatch&lt;br /&gt;
    if mw.ustring.match( beforePipe, &amp;#039;[%[%]&amp;lt;&amp;gt;{}%c\n]&amp;#039; ) then&lt;br /&gt;
        return all&lt;br /&gt;
    else&lt;br /&gt;
        return &amp;#039;&amp;#039;&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Preprocess the content if we aren&amp;#039;t being called from #invoke,&lt;br /&gt;
-- and pass it to gsub to remove valid category links.&lt;br /&gt;
local function suppress( content, isPreprocessed )&lt;br /&gt;
    if not isPreprocessed then&lt;br /&gt;
        content = mw.getCurrentFrame():preprocess( content )&lt;br /&gt;
    end&lt;br /&gt;
    content = mw.ustring.gsub(&lt;br /&gt;
        content,&lt;br /&gt;
        &amp;#039;(%[%[[%s_]*[cC][aA][tT][eE][gG][oO][rR][yY][%s_]*:[%s_]*(.-)[%s_]*%]%])&amp;#039;,&lt;br /&gt;
        processCategory&lt;br /&gt;
    )&lt;br /&gt;
    return content&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Get the content to suppress categories from, and find&lt;br /&gt;
-- whether the content has already been preprocessed. (If the&lt;br /&gt;
-- module is called from #invoke, it has been preprocessed already.)&lt;br /&gt;
function p.main( frame )&lt;br /&gt;
    local content, isPreprocessed&lt;br /&gt;
    if frame == mw.getCurrentFrame() then&lt;br /&gt;
        content = frame:getParent().args[1]&lt;br /&gt;
        if frame.args[1] then&lt;br /&gt;
            content = frame.args[1]&lt;br /&gt;
        end&lt;br /&gt;
        isPreprocessed = true&lt;br /&gt;
    else&lt;br /&gt;
        content = frame&lt;br /&gt;
        isPreprocessed = false&lt;br /&gt;
    end&lt;br /&gt;
    return suppress( content, isPreprocessed )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Caleb Cooper</name></author>
	</entry>
</feed>