https://en.wikipedia.org/w/index.php?action=history&feed=atom&title=Module%3ARotten_Tomatoes_data%2Fsandbox
Module:Rotten Tomatoes data/sandbox - Revision history
2025-06-07T12:38:07Z
Revision history for this page on the wiki
MediaWiki 1.45.0-wmf.4
https://en.wikipedia.org/w/index.php?title=Module:Rotten_Tomatoes_data/sandbox&diff=1172194256&oldid=prev
本日晴天: Use Module:EditAtWikidata directly
2023-08-25T15:21:26Z
<p>Use <a href="/wiki/Module:EditAtWikidata" title="Module:EditAtWikidata">Module:EditAtWikidata</a> directly</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 15:21, 25 August 2023</td>
</tr><tr>
<td colspan="2" class="diff-lineno">Line 376:</td>
<td colspan="2" class="diff-lineno">Line 376:</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"></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 function get_edit_icon(entityID)</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 function get_edit_icon(entityID)</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> return <del style="font-weight: bold; text-decoration: none;">mw.getCurrentFrame</del>(<del style="font-weight: bold; text-decoration: none;">)</del>:<del style="font-weight: bold; text-decoration: none;">expandTemplate{title='</del>EditAtWikidata'<del style="font-weight: bold; text-decoration: none;">, args=</del>{qid=entityID, pid='P444'<del style="font-weight: bold; text-decoration: none;">}</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> return <ins style="font-weight: bold; text-decoration: none;">require</ins>(<ins style="font-weight: bold; text-decoration: none;">'Module</ins>:EditAtWikidata'<ins style="font-weight: bold; text-decoration: none;">)._showMessage</ins>{qid=entityID, pid='P444'}</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;"><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>
本日晴天
https://en.wikipedia.org/w/index.php?title=Module:Rotten_Tomatoes_data/sandbox&diff=1149219746&oldid=prev
Lemondoge: Synced; fixed error and simplified logic slightly
2023-04-10T21:41:08Z
<p>Synced; fixed error and simplified logic slightly</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 21:41, 10 April 2023</td>
</tr><tr>
<td colspan="2" class="diff-lineno">Line 70:</td>
<td colspan="2" class="diff-lineno">Line 70:</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 i 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 i 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> -- year</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> -- year</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> parts[index] = tonumber(mw.ustring.gsub(dateStr:sub(ptr, i-1), "^<del style="font-weight: bold; text-decoration: none;">\</del>+(.+)$", "%1"), 10) -- remove '+' sign (explicitly give base 10 to prevent error)</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> parts[index] = tonumber(mw.ustring.gsub(dateStr:sub(ptr, i-1), "^<ins style="font-weight: bold; text-decoration: none;">%</ins>+(.+)$", "%1"), 10) -- remove '+' sign (explicitly give base 10 to prevent error)</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"></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 parts[index] == -0 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 parts[index] == -0 then</div></td>
</tr>
<tr>
<td colspan="2" class="diff-lineno">Line 272:</td>
<td colspan="2" class="diff-lineno">Line 272:</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 key == 1 or key == 'qid' or key == 'title' 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 key == 1 or key == 'qid' or key == 'title' 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;"><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> elseif type(key) <del style="font-weight: bold; text-decoration: none;">=</del>= 'number' 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> elseif type(key) <ins style="font-weight: bold; text-decoration: none;">~</ins>= 'number' then</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> </div></td>
<td colspan="2" class="diff-empty diff-side-added"></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> else</div></td>
<td colspan="2" class="diff-empty diff-side-added"></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> s[key] = val</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> s[key] = val</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 colspan="2" class="diff-lineno">Line 364:</td>
<td colspan="2" class="diff-lineno">Line 362:</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> s[1] = string.match(s[1], '%d+')</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> s[1] = string.match(s[1], '%d+')</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> s[2] = string.match(s[2], '%d%.%d%d?') or string.match(s[2], '%d')</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> s[2] = string.match(s[2], '%d%.%d%d?') or string.match(s[2], '%d')</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> s["access-date"] = get_access_date(entityID, args.df)</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 key, val 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 key, val 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> if key == 1 or key == 'qid' or key == 'title' 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 key == 1 or key == 'qid' or key == 'title' then</div></td>
</tr>
</table>
Lemondoge
https://en.wikipedia.org/w/index.php?title=Module:Rotten_Tomatoes_data/sandbox&diff=1087834761&oldid=prev
Aidan9382: not on the SB
2022-05-14T20:07:40Z
<p>not on the SB</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 20:07, 14 May 2022</td>
</tr><tr>
<td colspan="2" class="diff-lineno">Line 427:</td>
<td colspan="2" class="diff-lineno">Line 427:</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> elseif command == 'prose' 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> elseif command == 'prose' 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> retval = get_rtprose(entityID, args)</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> retval = get_rtprose(entityID, args)</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> retval = retval .. '[[Category:Articles using Template:RT data with prose]]' --Temporary. For solving RT Prose issues</div></td>
<td colspan="2" class="diff-empty diff-side-added"></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> elseif command == 'edit' 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> elseif command == 'edit' 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> retval = get_edit_icon(entityID)</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> retval = get_edit_icon(entityID)</div></td>
</tr>
</table>
Aidan9382
https://en.wikipedia.org/w/index.php?title=Module:Rotten_Tomatoes_data/sandbox&diff=1087833960&oldid=prev
Aidan9382: Fix the attempted category addition while attempting to fix prose issues
2022-05-14T20:03:09Z
<p>Fix the attempted category addition while attempting to fix prose issues</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 20:03, 14 May 2022</td>
</tr><tr>
<td colspan="2" class="diff-lineno">Line 427:</td>
<td colspan="2" class="diff-lineno">Line 427:</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> elseif command == 'prose' 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> elseif command == 'prose' 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> retval = get_rtprose(entityID, args)</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> retval = get_rtprose(entityID, args)</div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker"><a class="mw-diff-movedpara-right" title="Paragraph was moved. Click to jump to old location." href="#movedpara_3_0_lhs">⚫</a></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><a name="movedpara_1_0_rhs"></a> <ins style="font-weight: bold; text-decoration: none;">retval</ins> = <ins style="font-weight: bold; text-decoration: none;">retval</ins> .. '[[Category:Articles using Template:RT data with prose]]'<ins style="font-weight: bold; text-decoration: none;"> --Temporary. For solving RT Prose issues</ins></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> elseif command == 'prose' then</div></td>
<td colspan="2" class="diff-empty diff-side-added"></td>
</tr>
<tr>
<td class="diff-marker"><a class="mw-diff-movedpara-left" title="Paragraph was moved. Click to jump to new location." href="#movedpara_1_0_rhs">⚫</a></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><a name="movedpara_3_0_lhs"></a> <del style="font-weight: bold; text-decoration: none;">categories</del> = <del style="font-weight: bold; text-decoration: none;">categories</del> .. '[[Category:Articles using Template:RT data with prose]]'</div></td>
<td colspan="2" class="diff-empty diff-side-added"></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> elseif command == 'edit' 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> elseif command == 'edit' 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> retval = get_edit_icon(entityID)</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> retval = get_edit_icon(entityID)</div></td>
</tr>
</table>
Aidan9382
https://en.wikipedia.org/w/index.php?title=Module:Rotten_Tomatoes_data/sandbox&diff=1087831582&oldid=prev
Aidan9382: Create sandbox with current content for testing
2022-05-14T19:48:01Z
<p>Create sandbox with current content for testing</p>
<p><b>New page</b></p><div>local Error = require('Module:Error')<br />
local getArgs = require('Module:Arguments').getArgs<br />
<br />
local p = {}<br />
<br />
local months = {'January', 'February', 'March', 'April', 'May', 'June',<br />
'July', 'August', 'September', 'October', 'November', 'December'}<br />
<br />
local aliasesQ = {<br />
RottenTomatoes = "Q105584",<br />
RottenTomatoesScore = "Q108403393",<br />
RottenTomatoesAverage = "Q108403540",<br />
Fandango = "Q5433722",<br />
}<br />
<br />
local aliasesP = {<br />
RottenTomatoesId = "P1258",<br />
reviewScore = "P444",<br />
reviewScoreBy = "P447",<br />
numberOfReviews = "P7887",<br />
pointInTime = "P585",<br />
determinationMethod = "P459",<br />
author = "P50",<br />
publisher = "P123",<br />
statedIn = "P248",<br />
language = "P407",<br />
retrieved = "P813",<br />
referenceURL = "P854",<br />
archiveURL = "P1065",<br />
title = "P1476",<br />
formatterURL = "P1630",<br />
archiveDate = "P2960",<br />
}<br />
<br />
-- Helper functions ------------------------------------------------------------<br />
local function falsy(x)<br />
return x == false or x == nil or x == '' or x == 0 or type(x) == 'table' and next(x) == nil<br />
end<br />
<br />
-- copied from Module:wd<br />
local function parseDate(dateStr, precision)<br />
precision = precision or "d"<br />
<br />
local i, j, index, ptr<br />
local parts = {nil, nil, nil}<br />
<br />
if dateStr == nil then<br />
return parts[1], parts[2], parts[3] -- year, month, day<br />
end<br />
<br />
-- 'T' for snak values, '/' for outputs with '/Julian' attached<br />
i, j = dateStr:find("[T/]")<br />
<br />
if i then<br />
dateStr = dateStr:sub(1, i-1)<br />
end<br />
<br />
local from = 1<br />
<br />
if dateStr:sub(1,1) == "-" then<br />
-- this is a negative number, look further ahead<br />
from = 2<br />
end<br />
<br />
index = 1<br />
ptr = 1<br />
<br />
i, j = dateStr:find("-", from)<br />
<br />
if i then<br />
-- year<br />
parts[index] = tonumber(mw.ustring.gsub(dateStr:sub(ptr, i-1), "^\+(.+)$", "%1"), 10) -- remove '+' sign (explicitly give base 10 to prevent error)<br />
<br />
if parts[index] == -0 then<br />
parts[index] = tonumber("0") -- for some reason, 'parts[index] = 0' may actually store '-0', so parse from string instead<br />
end<br />
<br />
if precision == "y" then<br />
-- we're done<br />
return parts[1], parts[2], parts[3] -- year, month, day<br />
end<br />
<br />
index = index + 1<br />
ptr = i + 1<br />
<br />
i, j = dateStr:find("-", ptr)<br />
<br />
if i then<br />
-- month<br />
parts[index] = tonumber(dateStr:sub(ptr, i-1), 10)<br />
<br />
if precision == "m" then<br />
-- we're done<br />
return parts[1], parts[2], parts[3] -- year, month, day<br />
end<br />
<br />
index = index + 1<br />
ptr = i + 1<br />
end<br />
end<br />
<br />
if dateStr:sub(ptr) ~= "" then<br />
-- day if we have month, month if we have year, or year<br />
parts[index] = tonumber(dateStr:sub(ptr), 10)<br />
end<br />
<br />
return parts[1], parts[2], parts[3] -- year, month, day<br />
end<br />
<br />
-- nil dates precede all reasonable dates since year becomes 1<br />
local function datePrecedesDate(aY, aM, aD, bY, bM, bD)<br />
aY, aM, aD = aY or 1, aM or 1, aD or 1<br />
bY, bM, bD = bY or 1, bM or 1, bD or 1<br />
if aY < bY then return true end<br />
if aY > bY then return false end<br />
if aM < bM then return true end<br />
if aM > bM then return false end<br />
if aD < bD then return true end<br />
return false<br />
end<br />
<br />
-- format options: 'dmy', 'mdy', 'ymd', 'iso'<br />
local function format_date(Y, M, D, format)<br />
format = format or 'MDY'<br />
local s = (D or '') .. (months[M] or '') .. (Y or '')<br />
return mw.getCurrentFrame():expandTemplate{title='Date', args={s, format}}<br />
end<br />
<br />
--------------------------------------------------------------------------------<br />
-- Returns either QID, true, or ErrorString, false<br />
local function getentityID(args)<br />
local entityID = args.qid<br />
if falsy(entityID) then<br />
local title = args.title<br />
if falsy(title) then<br />
local currentID = mw.wikibase.getEntityIdForCurrentPage()<br />
if currentID then<br />
return currentID, true<br />
end<br />
return Error.error({'No Wikidata item connected to current page. Need qid or title argument.'}), false<br />
else<br />
-- if not mw.title.makeTitle(0, title).exists then<br />
-- return Error.error({'Article ' .. title .. ' does not exist.'}), false<br />
-- end<br />
entityID = mw.wikibase.getEntityIdForTitle(title)<br />
if not entityID then<br />
return Error.error({'Article "' .. title .. '" does not exist or has no Wikidata item.'}), false<br />
end<br />
return entityID, true<br />
end<br />
end<br />
--At this point we should have an entityID. Check if valid.<br />
if not mw.wikibase.isValidEntityId(entityID) then<br />
return Error.error({'Invalid Q-identifier.'}), false<br />
end<br />
if not mw.wikibase.entityExists(entityID) then<br />
return Error.error({'Wikidata item ' .. entityID .. ' does not exist.'}), false<br />
end<br />
return entityID, true<br />
end<br />
<br />
local function point_in_time(statement)<br />
if not statement.qualifiers then<br />
return nil, nil, nil<br />
end<br />
local pointintime = statement.qualifiers[aliasesP.pointInTime]<br />
if pointintime then<br />
return parseDate(pointintime[1].datavalue.value.time)<br />
end<br />
return nil, nil, nil<br />
end<br />
<br />
local function access_date(statement)<br />
if statement.references then<br />
local accessdate = statement.references[1].snaks[aliasesP.retrieved]<br />
if accessdate then<br />
return parseDate(accessdate[1].datavalue.value.time)<br />
end<br />
end<br />
return nil, nil, nil<br />
end<br />
<br />
local function date_from_statement(statement)<br />
local Y, M, D = point_in_time(statement)<br />
if Y then<br />
return Y, M, D<br />
end<br />
Y, M, D = access_date(statement)<br />
if Y then<br />
return Y, M, D<br />
end<br />
if statement.rank == 'preferred' then<br />
return 1, 1, 3<br />
elseif statement.rank == 'normal' then<br />
return 1, 1, 2<br />
end<br />
return 1, 1, 1<br />
end<br />
<br />
local function reviewedby_RT(statement)<br />
if not statement.qualifiers then return false end<br />
local x = statement.qualifiers[aliasesP.reviewScoreBy]<br />
return x and x[1].datavalue.value.id == aliasesQ.RottenTomatoes<br />
end<br />
<br />
local function score_type(statement)<br />
local x = nil<br />
if statement.qualifiers then<br />
x = statement.qualifiers[aliasesP.determinationMethod]<br />
end<br />
if x then<br />
x = x[1].datavalue.value.id<br />
end<br />
local y = ''<br />
if statement.mainsnak.snaktype == 'value' then<br />
y = statement.mainsnak.datavalue.value<br />
end<br />
if x == aliasesQ.RottenTomatoesScore then<br />
return 'percent'<br />
elseif x == aliasesQ.RottenTomatoesAverage then<br />
return 'average'<br />
elseif string.match(y, '^[0-9]%%$') or string.match(y, '^[1-9][0-9]%%$') or string.match(y, '^100%%$') then<br />
return 'percent'<br />
elseif string.match(y, '^[0-9] percent$') or string.match(y, '^[1-9][0-9] percent$') or string.match(y, '^100 percent$') then<br />
return 'percent'<br />
elseif string.match(y, '^%d/10$') or string.match(y, '^%d%.%d%d?/10$') then<br />
return 'average'<br />
elseif string.match(y, '^%d out of 10$') or string.match(y, '^%d%.%d%d? out of 10$') then<br />
return 'average'<br />
end<br />
return nil<br />
end<br />
<br />
local function most_recent_score_statement(entityID, scoretype)<br />
scoretype = scoretype or 'percent'<br />
local score_statements = mw.wikibase.getAllStatements(entityID, aliasesP.reviewScore)<br />
local newest, nY, nM, nD<br />
for i, v in ipairs(score_statements) do<br />
local Y, M, D = date_from_statement(v)<br />
if v.rank ~= 'deprecated' and v.mainsnak.snaktype == 'value'<br />
and reviewedby_RT(v) and score_type(v)==scoretype<br />
and not datePrecedesDate(Y, M, D, nY, nM, nD) then<br />
nY, nM, nD = Y, M, D<br />
newest = v<br />
end<br />
end<br />
return newest<br />
end<br />
<br />
local function get_score(entityID, scoretype)<br />
scoretype = scoretype or 'percent'<br />
local x = most_recent_score_statement(entityID, scoretype)<br />
if x == nil then<br />
return nil<br />
end<br />
return x.mainsnak.datavalue.value<br />
end<br />
<br />
local function get_count(entityID, args)<br />
local x = most_recent_score_statement(entityID)<br />
if x == nil then<br />
return nil<br />
end<br />
local y = x.qualifiers[aliasesP.numberOfReviews]<br />
if y == nil then<br />
return nil<br />
end<br />
local retval = string.match(y[1].datavalue.value.amount, '%d+') -- dont get sign<br />
if args ~= nil and args.spell then<br />
local s = {[1]=retval}<br />
for key, val in pairs(args) do<br />
if key == 1 or key == 'qid' or key == 'title' then<br />
<br />
elseif type(key) == 'number' then<br />
<br />
else<br />
s[key] = val<br />
end<br />
end<br />
return mw.getCurrentFrame():expandTemplate{title='Spellnum per MOS', args=s}<br />
end<br />
return retval<br />
end<br />
<br />
local function get_rtid(entityID, noprefix)<br />
local rtid_statements = mw.wikibase.getBestStatements(entityID, aliasesP.RottenTomatoesId)<br />
local newest, nY, nM, nD<br />
for i, v in ipairs(rtid_statements) do<br />
local Y, M, D = date_from_statement(v)<br />
if not datePrecedesDate(Y, M, D, nY, nM, nD) then<br />
nY, nM, nD = Y, M, D<br />
newest = v<br />
end<br />
end<br />
if newest == nil then<br />
return nil<br />
end<br />
newest = newest.mainsnak.datavalue.value<br />
if noprefix then<br />
newest = string.sub(newest, string.find(newest, '/') + 1)<br />
end<br />
return newest<br />
end<br />
<br />
local function get_url(entityID)<br />
local rtid = get_rtid(entityID)<br />
if rtid == nil then<br />
return nil<br />
end<br />
local x = mw.wikibase.getBestStatements(aliasesP.RottenTomatoesId, aliasesP.formatterURL)<br />
return (string.gsub(x[1].mainsnak.datavalue.value, '$1', rtid))<br />
end<br />
<br />
local function get_date(entityID, part, format)<br />
local z = most_recent_score_statement(entityID)<br />
if z == nil then<br />
return nil<br />
end<br />
local Y, M, D = date_from_statement(z)<br />
if part == 'year' then<br />
return Y or ''<br />
elseif part == 'month' then<br />
return months[M] or ''<br />
elseif part == 'day' then<br />
return D or ''<br />
end<br />
return format_date(Y, M, D, format)<br />
end<br />
<br />
local function get_access_date(entityID, format)<br />
local z = most_recent_score_statement(entityID)<br />
if z == nil then<br />
return nil<br />
end<br />
local Y, M, D = access_date(z)<br />
if not Y then<br />
Y, M, D = point_in_time(z)<br />
end<br />
return format_date(Y, M, D, format)<br />
end<br />
<br />
local function get_asof(entityID, args)<br />
local s = {}<br />
for key, val in pairs(args) do<br />
if key == 1 or key == 'qid' or key == 'title' then<br />
<br />
elseif key == 2 then<br />
s[1] = get_date(entityID, 'year')<br />
elseif key == 3 then<br />
s[2] = get_date(entityID, 'month')<br />
elseif key == 4 then<br />
s[3] = get_date(entityID, 'day')<br />
elseif type(key) == 'number' then<br />
s[key-1] = val<br />
else<br />
s[key] = val<br />
end<br />
end<br />
return mw.getCurrentFrame():expandTemplate{title='As of', args=s}<br />
end<br />
<br />
local function get_rtprose(entityID, args)<br />
local s = {get_score(entityID), get_score(entityID, 'average'), get_count(entityID)}<br />
s[1] = string.match(s[1], '%d+')<br />
s[2] = string.match(s[2], '%d%.%d%d?') or string.match(s[2], '%d')<br />
for key, val in pairs(args) do<br />
if key == 1 or key == 'qid' or key == 'title' then<br />
<br />
elseif type(key) == 'number' then<br />
s[key + 2] = val<br />
else<br />
s[key] = val<br />
end<br />
end<br />
return mw.getCurrentFrame():expandTemplate{title='Rotten Tomatoes prose', args=s}<br />
end<br />
<br />
local function get_edit_icon(entityID)<br />
return mw.getCurrentFrame():expandTemplate{title='EditAtWikidata', args={qid=entityID, pid='P444'}}<br />
end<br />
<br />
local function get_table(entityID)<br />
return get_score(entityID) .. ' (' .. get_count(entityID) .. ' reviews)'<br />
end<br />
<br />
function p.main(frame)<br />
local args = getArgs(frame, {<br />
wrappers = 'Template:Rotten Tomatoes data',<br />
removeBlanks = false,<br />
})<br />
return p._main(args)<br />
end<br />
<br />
function p._main(args)<br />
local entityID, is_good = getentityID(args)<br />
if not is_good then<br />
return entityID -- which is the error message in this case<br />
end<br />
local command = args[1]<br />
if falsy(command) then<br />
return Error.error({'Missing command.'})<br />
end<br />
command = string.lower(command)<br />
local retval<br />
if command == 'score' then<br />
retval = get_score(entityID, 'percent')<br />
elseif command == 'average' then<br />
retval = get_score(entityID, 'average')<br />
elseif command == 'count' then<br />
retval = get_count(entityID, args)<br />
elseif command == 'rtid' then<br />
retval = get_rtid(entityID, args.noprefix)<br />
elseif command == 'url' then<br />
retval = get_url(entityID)<br />
elseif command == 'date' then<br />
retval = get_date(entityID, 'date', args.df)<br />
elseif command == 'year' then<br />
retval = get_date(entityID, command)<br />
elseif command == 'month' then<br />
retval = get_date(entityID, command)<br />
elseif command == 'day' then<br />
retval = get_date(entityID, command)<br />
elseif command == 'access date' or command == 'accessdate' or command == 'access-date' then<br />
retval = get_access_date(entityID, args.df)<br />
elseif command == 'as of' or command == 'asof' then<br />
retval = get_asof(entityID, args)<br />
elseif command == 'prose' then<br />
retval = get_rtprose(entityID, args)<br />
elseif command == 'prose' then<br />
categories = categories .. '[[Category:Articles using Template:RT data with prose]]'<br />
elseif command == 'edit' then<br />
retval = get_edit_icon(entityID)<br />
elseif command == 'table' then<br />
retval = get_table(entityID)<br />
else<br />
return Error.error({'Invalid command.'})<br />
end<br />
if falsy(retval) then<br />
return Error.error({'RT data for "' .. command .. '" unavailable.'})<br />
end<br />
return retval<br />
end<br />
<br />
return p</div>
Aidan9382