
<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://zoophilia.wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3AProtection_banner%2Fdocumentation</id>
	<title>Module:Protection banner/documentation - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://zoophilia.wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3AProtection_banner%2Fdocumentation"/>
	<link rel="alternate" type="text/html" href="https://zoophilia.wiki/index.php?title=Module:Protection_banner/documentation&amp;action=history"/>
	<updated>2026-05-10T18:52:53Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://zoophilia.wiki/index.php?title=Module:Protection_banner/documentation&amp;diff=134120&amp;oldid=prev</id>
		<title>SockyPaws: Create module documentation subroutines</title>
		<link rel="alternate" type="text/html" href="https://zoophilia.wiki/index.php?title=Module:Protection_banner/documentation&amp;diff=134120&amp;oldid=prev"/>
		<updated>2026-01-01T02:07:01Z</updated>

		<summary type="html">&lt;p&gt;Create module documentation subroutines&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- This module generates documentation for Module:Protection banner.&lt;br /&gt;
&lt;br /&gt;
--------------------------------------------------------------------------------&lt;br /&gt;
-- Documentation class&lt;br /&gt;
--------------------------------------------------------------------------------&lt;br /&gt;
local Documentation   = {}&lt;br /&gt;
Documentation.__index = Documentation&lt;br /&gt;
&lt;br /&gt;
function Documentation:new(mainCfg, docCfg)&lt;br /&gt;
  return setmetatable({&lt;br /&gt;
    _mainCfg = mainCfg,&lt;br /&gt;
    _docCfg  = docCfg&lt;br /&gt;
  }, self)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function Documentation:makeReasonTable()&lt;br /&gt;
  -- Get the data from the cfg.banners table.&lt;br /&gt;
  local rowData = {}&lt;br /&gt;
  for action, reasonTables in pairs(self._mainCfg.banners) do&lt;br /&gt;
    for reason, t in pairs(reasonTables) do&lt;br /&gt;
      rowData[#rowData + 1] = {&lt;br /&gt;
        reason      = reason,&lt;br /&gt;
        action      = action,&lt;br /&gt;
        description = t.description&lt;br /&gt;
      }&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  -- Sort the table into alphabetical order, first by action and then by&lt;br /&gt;
  -- reason.&lt;br /&gt;
  table.sort(rowData, function (t1, t2)&lt;br /&gt;
    if t1.action == t2.action then&lt;br /&gt;
      return t1.reason &amp;lt; t2.reason&lt;br /&gt;
    else&lt;br /&gt;
      return t1.action &amp;lt; t2.action&lt;br /&gt;
    end&lt;br /&gt;
  end)&lt;br /&gt;
&lt;br /&gt;
  -- Assemble a wikitable of the data.&lt;br /&gt;
  local ret     = {}&lt;br /&gt;
  ret[#ret + 1] = &amp;#039;{| class=&amp;quot;wikitable&amp;quot;&amp;#039;&lt;br /&gt;
  if #rowData &amp;lt; 1 then&lt;br /&gt;
    ret[#ret + 1] = &amp;#039;|-&amp;#039;&lt;br /&gt;
    ret[#ret + 1] = string.format(&lt;br /&gt;
      &amp;#039;| colspan=&amp;quot;3&amp;quot; | %s&amp;#039;,&lt;br /&gt;
      self._docCfg[&amp;quot;documentation-blurb-noreasons&amp;quot;]&lt;br /&gt;
    )&lt;br /&gt;
  else&lt;br /&gt;
    -- Header.&lt;br /&gt;
    ret[#ret + 1] = &amp;#039;|-&amp;#039;&lt;br /&gt;
    ret[#ret + 1] = string.format(&lt;br /&gt;
      &amp;#039;! %s\n! %s\n! %s&amp;#039;,&lt;br /&gt;
      self._docCfg[&amp;quot;documentation-heading-reason&amp;quot;],&lt;br /&gt;
      self._docCfg[&amp;quot;documentation-heading-action&amp;quot;],&lt;br /&gt;
      self._docCfg[&amp;quot;documentation-heading-description&amp;quot;]&lt;br /&gt;
    )&lt;br /&gt;
    -- Rows.&lt;br /&gt;
    for _, t in ipairs(rowData) do&lt;br /&gt;
      ret[#ret + 1] = &amp;#039;|-&amp;#039;&lt;br /&gt;
      ret[#ret + 1] = string.format(&lt;br /&gt;
        &amp;#039;| %s\n| %s\n| %s&amp;#039;,&lt;br /&gt;
        t.reason,&lt;br /&gt;
        t.action,&lt;br /&gt;
        t.description or &amp;quot;&amp;quot;&lt;br /&gt;
      )&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  ret[#ret + 1] = &amp;#039;|}&amp;#039;&lt;br /&gt;
&lt;br /&gt;
  return table.concat(ret, &amp;#039;\n&amp;#039;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--------------------------------------------------------------------------------&lt;br /&gt;
-- Exports&lt;br /&gt;
--------------------------------------------------------------------------------&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
function p.reasonTable()&lt;br /&gt;
  local mainCfg          = require(&amp;quot;Module:Protection banner/config&amp;quot;)&lt;br /&gt;
  local docCfg           = require(&amp;quot;Module:Protection banner/documentation/config&amp;quot;)&lt;br /&gt;
  local documentationObj = Documentation:new(mainCfg, docCfg)&lt;br /&gt;
  return documentationObj:makeReasonTable()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>SockyPaws</name></author>
	</entry>
</feed>