https://en.wikipedia.org/w/index.php?action=history&feed=atom&title=Module%3ATelevision_critical_response%2Fsandbox Module:Television critical response/sandbox - Revision history 2025-06-18T22:38:37Z Revision history for this page on the wiki MediaWiki 1.45.0-wmf.5 https://en.wikipedia.org/w/index.php?title=Module:Television_critical_response/sandbox&diff=1117367660&oldid=prev WOSlinker: use require('strict') instead of require('Module:No globals') 2022-10-21T10:03:17Z <p>use require(&#039;strict&#039;) instead of require(&#039;Module:No globals&#039;)</p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <col class="diff-marker" /> <col class="diff-content" /> <col class="diff-marker" /> <col class="diff-content" /> <tr class="diff-title" lang="en"> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 10:03, 21 October 2022</td> </tr><tr> <td colspan="2" class="diff-lineno">Line 1:</td> <td colspan="2" class="diff-lineno">Line 1:</td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>-- This module implements {{Television critical response}}.</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>-- This module implements {{Television critical response}}.</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>require('<del style="font-weight: bold; text-decoration: none;">Module:No globals</del>')</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>require('<ins style="font-weight: bold; text-decoration: none;">strict</ins>')</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>local yesno = require('Module:Yesno')</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>local yesno = require('Module:Yesno')</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> </table> WOSlinker https://en.wikipedia.org/w/index.php?title=Module:Television_critical_response/sandbox&diff=1087014780&oldid=prev Certes: Count seasons: # doesn't work with string keys, even "1", "2"... 2022-05-09T19:58:22Z <p>Count seasons: # doesn&#039;t work with string keys, even &quot;1&quot;, &quot;2&quot;...</p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <col class="diff-marker" /> <col class="diff-content" /> <col class="diff-marker" /> <col class="diff-content" /> <tr class="diff-title" lang="en"> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 19:58, 9 May 2022</td> </tr><tr> <td colspan="2" class="diff-lineno">Line 144:</td> <td colspan="2" class="diff-lineno">Line 144:</td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> -- Extract seasons info and place into a 3D array</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> -- Extract seasons info and place into a 3D array</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> local SeasonEntries = {}</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> local SeasonEntries = {}</div></td> </tr> <tr> <td colspan="2" class="diff-empty diff-side-deleted"></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> local SeasonCount = 0</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> for k,v in pairs(args) do</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> for k,v in pairs(args) do</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> local str, num, str2 = string.match(k, '([^%d]*)(%d*)(%a*)')</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> local str, num, str2 = string.match(k, '([^%d]*)(%d*)(%a*)')</div></td> </tr> <tr> <td colspan="2" class="diff-lineno">Line 157:</td> <td colspan="2" class="diff-lineno">Line 158:</td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> if not SeasonEntries[num] then</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> if not SeasonEntries[num] then</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> SeasonEntries[num] = {}</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> SeasonEntries[num] = {}</div></td> </tr> <tr> <td colspan="2" class="diff-empty diff-side-deleted"></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> SeasonCount = SeasonCount + 1</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> end</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> end</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> SeasonEntries[num][str .. str2] = v</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> SeasonEntries[num][str .. str2] = v</div></td> </tr> <tr> <td colspan="2" class="diff-lineno">Line 231:</td> <td colspan="2" class="diff-lineno">Line 233:</td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> else</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> else</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> -- One row entries, only categorized in the mainspace</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> -- One row entries, only categorized in the mainspace</div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> if <del style="font-weight: bold; text-decoration: none;">#SeasonEntries</del> == 1 then</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> if <ins style="font-weight: bold; text-decoration: none;">SeasonCount</ins> == 1 then</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> categories = categories .. '[[Category:Articles using Template:Television critical response with only one row]]'</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> categories = categories .. '[[Category:Articles using Template:Television critical response with only one row]]'</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> end</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> end</div></td> </tr> </table> Certes https://en.wikipedia.org/w/index.php?title=Module:Television_critical_response/sandbox&diff=1087013570&oldid=prev Certes: sync 2022-05-09T19:49:41Z <p>sync</p> <p><b>New page</b></p><div>-- This module implements {{Television critical response}}.<br /> <br /> require(&#039;Module:No globals&#039;)<br /> local yesno = require(&#039;Module:Yesno&#039;)<br /> <br /> --------------------------------------------------------------------------------<br /> -- CriticalResponse class<br /> -- The main class.<br /> --------------------------------------------------------------------------------<br /> <br /> local CriticalResponse = {}<br /> <br /> function CriticalResponse.cellspan(SeasonEntries, SeasonEntries_ordered, key, cell, multipart)<br /> local spanlength = 1<br /> <br /> for i = cell+1, #SeasonEntries_ordered do<br /> local entry = SeasonEntries[SeasonEntries_ordered[i]]<br /> -- Split season, then regular season<br /> if entry.startA then<br /> if not entry[key..&#039;A&#039;] then spanlength = spanlength + 1<br /> else break end<br /> if not entry[key..&#039;B&#039;] then spanlength = spanlength + 1<br /> else break end<br /> else<br /> if not entry[key] and (not entry.special and multipart) then<br /> spanlength = spanlength + 1<br /> else break end<br /> end<br /> end<br /> return spanlength<br /> end<br /> <br /> -- Sorting function<br /> function CriticalResponse.series_sort(op1, op2)<br /> local n1,s1 = string.match(op1,&quot;(%d+)(%a*)&quot;)<br /> local n2,s2 = string.match(op2,&quot;(%d+)(%a*)&quot;)<br /> local n1N,n2N = tonumber(n1),tonumber(n2)<br /> <br /> if n1N == n2N then<br /> return s1 &lt; s2<br /> else<br /> return n1N &lt; n2N<br /> end<br /> end<br /> <br /> -- Function to add either text or {{N/a}} to cell<br /> function CriticalResponse.season_cell(text, frame)<br /> local cell<br /> <br /> if string.find(text or &#039;&#039;, &#039;table-na&#039;, 0, true) ~= nil then<br /> local findpipe = string.find(text, &#039; | &#039;, 0, true)<br /> if findpipe ~= nil then<br /> cell = CriticalResponse.series_attributes( frame:expandTemplate{title=&#039;N/A&#039;,args={string.sub(text,findpipe+3)}} )<br /> else<br /> cell = CriticalResponse.series_attributes( frame:expandTemplate{title=&#039;N/A&#039;} )<br /> end<br /> else<br /> cell = mw.html.create(&#039;td&#039;):wikitext(text)<br /> end<br /> <br /> return cell<br /> end<br /> <br /> -- Allow usages of {{N/A}} cells<br /> function CriticalResponse.series_attributes(infoParam)<br /> local entries = {}<br /> local infoCell = mw.html.create(&#039;td&#039;)<br /> local attrMatch = &#039;([%a-]*)=&quot;([^&quot;]*)&quot;&#039;<br /> <br /> while true do<br /> local a,b = string.match(infoParam,attrMatch)<br /> if a == nil or b == nil then break end<br /> infoCell:attr(a,b)<br /> infoParam = string.gsub(infoParam,attrMatch,&#039;&#039;,1)<br /> end<br /> <br /> infoParam = string.gsub(infoParam,&#039;%s*|%s*&#039;,&#039;&#039;,1)<br /> infoCell:wikitext(infoParam)<br /> <br /> return infoCell<br /> end<br /> <br /> function CriticalResponse.new(frame, args)<br /> args = args or {}<br /> <br /> local initialArticle = args[&#039;1&#039;] or &#039;&#039;<br /> local categories = &#039;&#039;<br /> local title = mw.title.getCurrentTitle()<br /> local hide_rotten_tomatoes = yesno(args.hide_rotten_tomatoes)<br /> local hide_metacritic = yesno(args.hide_metacritic)<br /> local show_cinemascore = yesno(args.show_cinemascore)<br /> local hide_season = yesno(args.hide_season)<br /> local series_name = tostring(title):gsub(&quot;%s%((.-)%)&quot;,&quot;&quot;)<br /> <br /> -- Create critical response table<br /> local root = mw.html.create((args.multiseries or not args.series) and &#039;table&#039; or &#039;&#039;)<br /> local cellPadding = &#039;0 8px&#039;<br /> local basePadding = &#039;0.2em 0.4em&#039;<br /> <br /> root<br /> :addClass(&#039;wikitable&#039;)<br /> :addClass(&#039;plainrowheaders&#039;)<br /> :css(&#039;text-align&#039;, &#039;center&#039;)<br /> <br /> -- Remove float if multiple series<br /> if not args.multiseries then<br /> root:css(&#039;float&#039;, &#039;right&#039;)<br /> root:css(&#039;margin&#039;, &#039;10px&#039;)<br /> end<br /> <br /> -- Sortable<br /> if args.sortable or args.multiseries then<br /> root:addClass(&#039;sortable&#039;);<br /> end<br /> <br /> -- Width<br /> if args.width then<br /> root:css(&#039;width&#039;, args.width)<br /> end<br /> <br /> -- Caption<br /> if not args.series then<br /> local formatted_caption<br /> <br /> if args.caption then<br /> formatted_caption = args.caption<br /> elseif args.title and args.multiseries then<br /> formatted_caption = &#039;Critical response of &#039; .. args.title<br /> elseif args.title then<br /> formatted_caption = &#039;Critical response of &lt;i&gt;&#039; .. args.title .. &#039;&lt;/i&gt;&#039;<br /> else<br /> formatted_caption = &#039;Critical response of &lt;i&gt;&#039; .. series_name .. &#039;&lt;/i&gt;&#039;<br /> end<br /> <br /> if args.show_caption then<br /> -- Visible caption option<br /> root:tag(&#039;caption&#039;):wikitext(formatted_caption)<br /> elseif formatted_caption then<br /> -- If a visible caption isn&#039;t defined, then default to the screenreader-only caption<br /> root:tag(&#039;caption&#039;):wikitext(frame:expandTemplate{title=&#039;Screen reader-only&#039;,args={formatted_caption}})<br /> end<br /> end<br /> <br /> -- Extract seasons info and place into a 3D array<br /> local SeasonEntries = {}<br /> for k,v in pairs(args) do<br /> local str, num, str2 = string.match(k, &#039;([^%d]*)(%d*)(%a*)&#039;)<br /> if num ~= &#039;&#039; then<br /> -- Special<br /> local special = false<br /> if string.sub(str2,1,1) == &#039;S&#039; then<br /> special = true<br /> num = num .. str2<br /> str2 = &#039;&#039;<br /> end<br /> -- Add to entries, create if necessary<br /> if not SeasonEntries[num] then<br /> SeasonEntries[num] = {}<br /> end<br /> SeasonEntries[num][str .. str2] = v<br /> if special then<br /> SeasonEntries[num][&#039;special&#039;] = &#039;y&#039;<br /> end<br /> end<br /> end<br /> <br /> -- Order table by season number<br /> local SeasonEntries_ordered = {}<br /> for k in pairs(SeasonEntries) do<br /> table.insert(SeasonEntries_ordered, k)<br /> end<br /> table.sort(SeasonEntries_ordered,CriticalResponse.series_sort)<br /> <br /> local firstRow = args.multiseries and {} or SeasonEntries[SeasonEntries_ordered[1]]<br /> <br /> -- Headers<br /> do<br /> if args.multiseries or not args.series then<br /> local headerRow = root:tag(&#039;tr&#039;)<br /> headerRow<br /> :css(&#039;text-align&#039;, &#039;center&#039;)<br /> <br /> -- Multiple series header<br /> if args.multiseries then<br /> headerRow:tag(&#039;th&#039;)<br /> :attr(&#039;scope&#039;, &#039;col&#039;)<br /> :css(&#039;padding&#039;, cellPadding)<br /> :wikitext(&#039;Title&#039;)<br /> end<br /> <br /> -- Season header<br /> if not hide_season then<br /> headerRow:tag(&#039;th&#039;)<br /> :attr(&#039;scope&#039;, &#039;col&#039;)<br /> :css(&#039;min-width&#039;, &#039;50px&#039;)<br /> :css(&#039;padding&#039;, cellPadding)<br /> :addClass(&#039;unsortable&#039;)<br /> :wikitext(args.seriesT or args.seasonT or &#039;Season&#039;)<br /> end<br /> <br /> -- Rotten Tomatoes header<br /> if not hide_rotten_tomatoes then<br /> headerRow:tag(&#039;th&#039;)<br /> :attr(&#039;scope&#039;, &#039;col&#039;)<br /> :wikitext(&#039;[[Rotten Tomatoes]]&#039;)<br /> end<br /> <br /> -- Metacritic header<br /> if not hide_metacritic then<br /> headerRow:tag(&#039;th&#039;)<br /> :attr(&#039;scope&#039;, &#039;col&#039;)<br /> :wikitext(&#039;[[Metacritic]]&#039;)<br /> end<br /> <br /> -- CinemaScore header<br /> if show_cinemascore then<br /> headerRow:tag(&#039;th&#039;)<br /> :attr(&#039;scope&#039;, &#039;col&#039;)<br /> :wikitext(&#039;[[CinemaScore]]&#039;)<br /> end<br /> end<br /> end<br /> <br /> -- Season rows<br /> do<br /> if args.multiseries then<br /> -- Multi series individual entries<br /> if args.multiseries ~= &quot;y&quot; then<br /> root:node(args.multiseries)<br /> end<br /> else<br /> -- One row entries, only categorized in the mainspace<br /> if #SeasonEntries == 1 then<br /> categories = categories .. &#039;[[Category:Articles using Template:Television critical response with only one row]]&#039;<br /> end<br /> <br /> -- Determine number of rows in the whole table<br /> local SeasonEntriesRows = 0<br /> for X = 1, #SeasonEntries_ordered do<br /> local season, entry = SeasonEntries_ordered[X], SeasonEntries[SeasonEntries_ordered[X]]<br /> SeasonEntriesRows = SeasonEntriesRows + 1<br /> end<br /> <br /> for X = 1, #SeasonEntries_ordered do<br /> local season, entry = SeasonEntries_ordered[X], SeasonEntries[SeasonEntries_ordered[X]]<br /> <br /> -- Season rows for each season<br /> for k0 = string.byte(&#039;A&#039;)-1, string.byte(&#039;Z&#039;) do<br /> local k = string.char(k0)<br /> if k0 == string.byte(&#039;A&#039;)-1 then k = &#039;&#039; end<br /> <br /> -- New season row<br /> local seasonRow = (entry[&#039;rotten_tomatoes&#039; .. k] or entry[&#039;metacritic&#039; .. k] or entry[&#039;cinemascore&#039; .. k]) and root:tag(&#039;tr&#039;) or mw.html.create(&#039;tr&#039;)<br /> <br /> -- Series name for group overviews<br /> if X == 1 and (k == &#039;&#039; or k == &#039;A&#039;) and args.series then<br /> seasonRow:tag(&#039;th&#039;)<br /> :attr(&#039;scope&#039;, &#039;row&#039;)<br /> :attr(&#039;rowspan&#039;, SeasonEntriesRows)<br /> :wikitext(args.series)<br /> end<br /> <br /> -- Season number link, included only in the first row<br /> if not hide_season then<br /> if k == &#039;&#039; or k == &#039;A&#039; then<br /> seasonRow:tag(args.series and &#039;td&#039; or &#039;th&#039;)<br /> :attr(&#039;scope&#039;, &#039;row&#039;)<br /> :attr(&#039;colspan&#039;, entry.special or 1)<br /> :css(&#039;text-align&#039;, &#039;center&#039;)<br /> :wikitext((entry.link and &#039;[[&#039; .. entry.link .. &#039;|&#039; .. (entry.linkT or season) .. &#039;]]&#039; or (entry.linkT or season)) .. (entry.linkR or &#039;&#039;))<br /> end<br /> end<br /> <br /> -- Rotten Tomatoes<br /> if not hide_rotten_tomatoes and entry[&#039;rotten_tomatoes&#039; .. k] ~= &#039;metacritic&#039; then<br /> if entry[&#039;rotten_tomatoes&#039; .. k] then<br /> local thisCell = CriticalResponse.season_cell(entry[&#039;rotten_tomatoes&#039; .. k], frame)<br /> :css(&#039;padding&#039;,basePadding)<br /> seasonRow:node(thisCell)<br /> else<br /> local infoCell = CriticalResponse.series_attributes( frame:expandTemplate{title=&#039;N/A&#039;} )<br /> infoCell:css(&#039;padding&#039;,basePadding)<br /> seasonRow:node(infoCell)<br /> end<br /> end<br /> <br /> -- Metacritic<br /> if not hide_metacritic and entry[&#039;metacritic&#039; .. k] ~= &#039;rotten_tomatoes&#039; then<br /> if entry[&#039;metacritic&#039; .. k] then<br /> local thisCell = CriticalResponse.season_cell(entry[&#039;metacritic&#039; .. k], frame)<br /> :css(&#039;padding&#039;,cellPadding)<br /> seasonRow:node(thisCell)<br /> else<br /> local infoCell = CriticalResponse.series_attributes( frame:expandTemplate{title=&#039;N/A&#039;} )<br /> infoCell:css(&#039;padding&#039;,cellPadding)<br /> seasonRow:node(infoCell)<br /> end<br /> end<br /> <br /> -- CinemaScore<br /> if show_cinemascore and entry[&#039;cinemascore&#039; .. k] ~= &#039;rotten_tomatoes&#039; then<br /> if entry[&#039;cinemascore&#039; .. k] then<br /> local thisCell = CriticalResponse.season_cell(entry[&#039;cinemascore&#039; .. k], frame)<br /> :css(&#039;padding&#039;,cellPadding)<br /> seasonRow:node(thisCell)<br /> else<br /> local infoCell = CriticalResponse.series_attributes( frame:expandTemplate{title=&#039;N/A&#039;} )<br /> infoCell:css(&#039;padding&#039;,cellPadding)<br /> seasonRow:node(infoCell)<br /> end<br /> end<br /> <br /> end -- End k0 string.byte<br /> end -- End &#039;for&#039; SeasonEntries_ordered<br /> end -- End &#039;if&#039; multiseries<br /> end -- End &#039;do&#039; season rows<br /> <br /> return (args.dontclose and mw.ustring.gsub(tostring(root), &quot;&lt;/table&gt;&quot;, &quot;&quot;) or tostring(root)) .. categories<br /> end<br /> <br /> --------------------------------------------------------------------------------<br /> -- Exports<br /> --------------------------------------------------------------------------------<br /> <br /> local p = {}<br /> <br /> function p.main(frame)<br /> local args = require(&#039;Module:Arguments&#039;).getArgs(frame, {<br /> wrappers = &#039;Template:Television critical response&#039;<br /> })<br /> return CriticalResponse.new(frame, args)<br /> end<br /> <br /> return p</div> Certes