<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://candypedia.wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3AChapterList</id>
	<title>Module:ChapterList - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://candypedia.wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3AChapterList"/>
	<link rel="alternate" type="text/html" href="https://candypedia.wiki/index.php?title=Module:ChapterList&amp;action=history"/>
	<updated>2026-05-04T19:52:04Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.42.0</generator>
	<entry>
		<id>https://candypedia.wiki/index.php?title=Module:ChapterList&amp;diff=2915&amp;oldid=prev</id>
		<title>SuitCase: Major improvements</title>
		<link rel="alternate" type="text/html" href="https://candypedia.wiki/index.php?title=Module:ChapterList&amp;diff=2915&amp;oldid=prev"/>
		<updated>2025-04-24T00:21:39Z</updated>

		<summary type="html">&lt;p&gt;Major improvements&lt;/p&gt;
&lt;a href=&quot;https://candypedia.wiki/index.php?title=Module:ChapterList&amp;amp;diff=2915&amp;amp;oldid=2914&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>SuitCase</name></author>
	</entry>
	<entry>
		<id>https://candypedia.wiki/index.php?title=Module:ChapterList&amp;diff=2914&amp;oldid=prev</id>
		<title>SuitCase: Table headers and other stuff loaded out of the other module</title>
		<link rel="alternate" type="text/html" href="https://candypedia.wiki/index.php?title=Module:ChapterList&amp;diff=2914&amp;oldid=prev"/>
		<updated>2025-04-24T00:21:00Z</updated>

		<summary type="html">&lt;p&gt;Table headers and other stuff loaded out of the other module&lt;/p&gt;
&lt;a href=&quot;https://candypedia.wiki/index.php?title=Module:ChapterList&amp;amp;diff=2914&amp;amp;oldid=2913&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>SuitCase</name></author>
	</entry>
	<entry>
		<id>https://candypedia.wiki/index.php?title=Module:ChapterList&amp;diff=2913&amp;oldid=prev</id>
		<title>SuitCase: Table headers and other stuff loaded out of the other module</title>
		<link rel="alternate" type="text/html" href="https://candypedia.wiki/index.php?title=Module:ChapterList&amp;diff=2913&amp;oldid=prev"/>
		<updated>2025-04-24T00:20:48Z</updated>

		<summary type="html">&lt;p&gt;Table headers and other stuff loaded out of the other module&lt;/p&gt;
&lt;a href=&quot;https://candypedia.wiki/index.php?title=Module:ChapterList&amp;amp;diff=2913&amp;amp;oldid=2903&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>SuitCase</name></author>
	</entry>
	<entry>
		<id>https://candypedia.wiki/index.php?title=Module:ChapterList&amp;diff=2903&amp;oldid=prev</id>
		<title>SuitCase: Parsing Template:ChapterList and making a nice table for users to use</title>
		<link rel="alternate" type="text/html" href="https://candypedia.wiki/index.php?title=Module:ChapterList&amp;diff=2903&amp;oldid=prev"/>
		<updated>2025-04-23T23:50:04Z</updated>

		<summary type="html">&lt;p&gt;Parsing Template:ChapterList and making a nice table for users to use&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- Module:ChapterList&lt;br /&gt;
-- Reads Template:ChapterList, parses {{Chapter|...}}, and renders a sortable table.&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
-- Helper: format ISO date YYYY-MM-DD → M/D/YY&lt;br /&gt;
local function formatDate(iso)&lt;br /&gt;
    local y, m, d = iso:match(&amp;quot;^(%d%d%d%d)%-(%d%d)%-(%d%d)$&amp;quot;)&lt;br /&gt;
    if not y then return iso end&lt;br /&gt;
    m = tonumber(m)&lt;br /&gt;
    d = tonumber(d)&lt;br /&gt;
    local yy = y:sub(3,4)&lt;br /&gt;
    return m .. &amp;quot;/&amp;quot; .. d .. &amp;quot;/&amp;quot; .. yy&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.renderTable(frame)&lt;br /&gt;
    -- Load raw wikitext of Template:ChapterList&lt;br /&gt;
    local tpl = mw.title.new(&amp;#039;Template:ChapterList&amp;#039;)&lt;br /&gt;
    local raw = tpl and tpl:getContent() or &amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
    -- Parse each {{Chapter|...}} line&lt;br /&gt;
    local chapters = {}&lt;br /&gt;
    for line in raw:gmatch(&amp;#039;[^\r\n]+&amp;#039;) do&lt;br /&gt;
        local trimmed = mw.text.trim(line)&lt;br /&gt;
        if trimmed:find(&amp;#039;^{{Chapter&amp;#039;) then&lt;br /&gt;
            -- strip leading &amp;#039;{{Chapter&amp;#039; and trailing &amp;#039;}}&amp;#039;&lt;br /&gt;
            local inner = trimmed:match(&amp;#039;^{{Chapter%s*(.+)}}$&amp;#039;) or &amp;#039;&amp;#039;&lt;br /&gt;
            -- remove possible leading &amp;#039;|&amp;#039;&lt;br /&gt;
            if inner:sub(1,1) == &amp;#039;|&amp;#039; then inner = inner:sub(2) end&lt;br /&gt;
            -- split into key=value params&lt;br /&gt;
            local params = {}&lt;br /&gt;
            for part in inner:gmatch(&amp;#039;[^|]+&amp;#039;) do&lt;br /&gt;
                local k, v = part:match(&amp;#039;^(%w+)%s*=%s*(.+)$&amp;#039;)&lt;br /&gt;
                if k and v then params[k] = v end&lt;br /&gt;
            end&lt;br /&gt;
            if params.number and params.title and params.date then&lt;br /&gt;
                table.insert(chapters, {&lt;br /&gt;
                    number = params.number,&lt;br /&gt;
                    title  = params.title,&lt;br /&gt;
                    date   = params.date&lt;br /&gt;
                })&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    -- Build wikitable&lt;br /&gt;
    local out = {}&lt;br /&gt;
    table.insert(out, &amp;#039;{| class=&amp;quot;wikitable sortable&amp;quot;&amp;#039;)&lt;br /&gt;
    table.insert(out, &amp;#039;! #&amp;#039;)&lt;br /&gt;
    table.insert(out, &amp;#039;! Title&amp;#039;)&lt;br /&gt;
    table.insert(out, &amp;#039;! Published&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
    for _, ch in ipairs(chapters) do&lt;br /&gt;
        local isInter = ch.number:find(&amp;#039;%.&amp;#039;)&lt;br /&gt;
        local dispNum = isInter and &amp;#039;&amp;#039; or ch.number&lt;br /&gt;
        local dispTitle = isInter&lt;br /&gt;
            and (&amp;#039;Intermission: [[&amp;#039; .. ch.title .. &amp;#039;]]&amp;#039;)&lt;br /&gt;
            or (&amp;#039;[[&amp;#039; .. ch.title .. &amp;#039;]]&amp;#039;)&lt;br /&gt;
        local dispDate = formatDate(ch.date)&lt;br /&gt;
        table.insert(out, &amp;#039;|-&amp;#039;)&lt;br /&gt;
        table.insert(out, &amp;#039;| &amp;#039; .. dispNum .. &amp;#039; || &amp;#039; .. dispTitle .. &amp;#039; || &amp;#039; .. dispDate)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    table.insert(out, &amp;#039;|}&amp;#039;)&lt;br /&gt;
    return table.concat(out, &amp;#039;\n&amp;#039;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>SuitCase</name></author>
	</entry>
</feed>