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">&#x26AB;</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">&#x26AB;</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(&#039;Module:Error&#039;)<br /> local getArgs = require(&#039;Module:Arguments&#039;).getArgs<br /> <br /> local p = {}<br /> <br /> local months = {&#039;January&#039;, &#039;February&#039;, &#039;March&#039;, &#039;April&#039;, &#039;May&#039;, &#039;June&#039;,<br /> &#039;July&#039;, &#039;August&#039;, &#039;September&#039;, &#039;October&#039;, &#039;November&#039;, &#039;December&#039;}<br /> <br /> local aliasesQ = {<br /> RottenTomatoes = &quot;Q105584&quot;,<br /> RottenTomatoesScore = &quot;Q108403393&quot;,<br /> RottenTomatoesAverage = &quot;Q108403540&quot;,<br /> Fandango = &quot;Q5433722&quot;,<br /> }<br /> <br /> local aliasesP = {<br /> RottenTomatoesId = &quot;P1258&quot;,<br /> reviewScore = &quot;P444&quot;,<br /> reviewScoreBy = &quot;P447&quot;,<br /> numberOfReviews = &quot;P7887&quot;,<br /> pointInTime = &quot;P585&quot;,<br /> determinationMethod = &quot;P459&quot;,<br /> author = &quot;P50&quot;,<br /> publisher = &quot;P123&quot;,<br /> statedIn = &quot;P248&quot;,<br /> language = &quot;P407&quot;,<br /> retrieved = &quot;P813&quot;,<br /> referenceURL = &quot;P854&quot;,<br /> archiveURL = &quot;P1065&quot;,<br /> title = &quot;P1476&quot;,<br /> formatterURL = &quot;P1630&quot;,<br /> archiveDate = &quot;P2960&quot;,<br /> }<br /> <br /> -- Helper functions ------------------------------------------------------------<br /> local function falsy(x)<br /> return x == false or x == nil or x == &#039;&#039; or x == 0 or type(x) == &#039;table&#039; and next(x) == nil<br /> end<br /> <br /> -- copied from Module:wd<br /> local function parseDate(dateStr, precision)<br /> precision = precision or &quot;d&quot;<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 /> -- &#039;T&#039; for snak values, &#039;/&#039; for outputs with &#039;/Julian&#039; attached<br /> i, j = dateStr:find(&quot;[T/]&quot;)<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) == &quot;-&quot; 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(&quot;-&quot;, from)<br /> <br /> if i then<br /> -- year<br /> parts[index] = tonumber(mw.ustring.gsub(dateStr:sub(ptr, i-1), &quot;^\+(.+)$&quot;, &quot;%1&quot;), 10) -- remove &#039;+&#039; sign (explicitly give base 10 to prevent error)<br /> <br /> if parts[index] == -0 then<br /> parts[index] = tonumber(&quot;0&quot;) -- for some reason, &#039;parts[index] = 0&#039; may actually store &#039;-0&#039;, so parse from string instead<br /> end<br /> <br /> if precision == &quot;y&quot; then<br /> -- we&#039;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(&quot;-&quot;, ptr)<br /> <br /> if i then<br /> -- month<br /> parts[index] = tonumber(dateStr:sub(ptr, i-1), 10)<br /> <br /> if precision == &quot;m&quot; then<br /> -- we&#039;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) ~= &quot;&quot; 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 &lt; bY then return true end<br /> if aY &gt; bY then return false end<br /> if aM &lt; bM then return true end<br /> if aM &gt; bM then return false end<br /> if aD &lt; bD then return true end<br /> return false<br /> end<br /> <br /> -- format options: &#039;dmy&#039;, &#039;mdy&#039;, &#039;ymd&#039;, &#039;iso&#039;<br /> local function format_date(Y, M, D, format)<br /> format = format or &#039;MDY&#039;<br /> local s = (D or &#039;&#039;) .. (months[M] or &#039;&#039;) .. (Y or &#039;&#039;)<br /> return mw.getCurrentFrame():expandTemplate{title=&#039;Date&#039;, 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({&#039;No Wikidata item connected to current page. Need qid or title argument.&#039;}), false<br /> else<br /> -- if not mw.title.makeTitle(0, title).exists then<br /> -- return Error.error({&#039;Article &#039; .. title .. &#039; does not exist.&#039;}), false<br /> -- end<br /> entityID = mw.wikibase.getEntityIdForTitle(title)<br /> if not entityID then<br /> return Error.error({&#039;Article &quot;&#039; .. title .. &#039;&quot; does not exist or has no Wikidata item.&#039;}), 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({&#039;Invalid Q-identifier.&#039;}), false<br /> end<br /> if not mw.wikibase.entityExists(entityID) then<br /> return Error.error({&#039;Wikidata item &#039; .. entityID .. &#039; does not exist.&#039;}), 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 == &#039;preferred&#039; then<br /> return 1, 1, 3<br /> elseif statement.rank == &#039;normal&#039; 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 = &#039;&#039;<br /> if statement.mainsnak.snaktype == &#039;value&#039; then<br /> y = statement.mainsnak.datavalue.value<br /> end<br /> if x == aliasesQ.RottenTomatoesScore then<br /> return &#039;percent&#039;<br /> elseif x == aliasesQ.RottenTomatoesAverage then<br /> return &#039;average&#039;<br /> elseif string.match(y, &#039;^[0-9]%%$&#039;) or string.match(y, &#039;^[1-9][0-9]%%$&#039;) or string.match(y, &#039;^100%%$&#039;) then<br /> return &#039;percent&#039;<br /> elseif string.match(y, &#039;^[0-9] percent$&#039;) or string.match(y, &#039;^[1-9][0-9] percent$&#039;) or string.match(y, &#039;^100 percent$&#039;) then<br /> return &#039;percent&#039;<br /> elseif string.match(y, &#039;^%d/10$&#039;) or string.match(y, &#039;^%d%.%d%d?/10$&#039;) then<br /> return &#039;average&#039;<br /> elseif string.match(y, &#039;^%d out of 10$&#039;) or string.match(y, &#039;^%d%.%d%d? out of 10$&#039;) then<br /> return &#039;average&#039;<br /> end<br /> return nil<br /> end<br /> <br /> local function most_recent_score_statement(entityID, scoretype)<br /> scoretype = scoretype or &#039;percent&#039;<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 ~= &#039;deprecated&#039; and v.mainsnak.snaktype == &#039;value&#039;<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 &#039;percent&#039;<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, &#039;%d+&#039;) -- 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 == &#039;qid&#039; or key == &#039;title&#039; then<br /> <br /> elseif type(key) == &#039;number&#039; then<br /> <br /> else<br /> s[key] = val<br /> end<br /> end<br /> return mw.getCurrentFrame():expandTemplate{title=&#039;Spellnum per MOS&#039;, 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, &#039;/&#039;) + 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, &#039;$1&#039;, 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 == &#039;year&#039; then<br /> return Y or &#039;&#039;<br /> elseif part == &#039;month&#039; then<br /> return months[M] or &#039;&#039;<br /> elseif part == &#039;day&#039; then<br /> return D or &#039;&#039;<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 == &#039;qid&#039; or key == &#039;title&#039; then<br /> <br /> elseif key == 2 then<br /> s[1] = get_date(entityID, &#039;year&#039;)<br /> elseif key == 3 then<br /> s[2] = get_date(entityID, &#039;month&#039;)<br /> elseif key == 4 then<br /> s[3] = get_date(entityID, &#039;day&#039;)<br /> elseif type(key) == &#039;number&#039; then<br /> s[key-1] = val<br /> else<br /> s[key] = val<br /> end<br /> end<br /> return mw.getCurrentFrame():expandTemplate{title=&#039;As of&#039;, args=s}<br /> end<br /> <br /> local function get_rtprose(entityID, args)<br /> local s = {get_score(entityID), get_score(entityID, &#039;average&#039;), get_count(entityID)}<br /> s[1] = string.match(s[1], &#039;%d+&#039;)<br /> s[2] = string.match(s[2], &#039;%d%.%d%d?&#039;) or string.match(s[2], &#039;%d&#039;)<br /> for key, val in pairs(args) do<br /> if key == 1 or key == &#039;qid&#039; or key == &#039;title&#039; then<br /> <br /> elseif type(key) == &#039;number&#039; then<br /> s[key + 2] = val<br /> else<br /> s[key] = val<br /> end<br /> end<br /> return mw.getCurrentFrame():expandTemplate{title=&#039;Rotten Tomatoes prose&#039;, args=s}<br /> end<br /> <br /> local function get_edit_icon(entityID)<br /> return mw.getCurrentFrame():expandTemplate{title=&#039;EditAtWikidata&#039;, args={qid=entityID, pid=&#039;P444&#039;}}<br /> end<br /> <br /> local function get_table(entityID)<br /> return get_score(entityID) .. &#039; (&#039; .. get_count(entityID) .. &#039; reviews)&#039;<br /> end<br /> <br /> function p.main(frame)<br /> local args = getArgs(frame, {<br /> wrappers = &#039;Template:Rotten Tomatoes data&#039;,<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({&#039;Missing command.&#039;})<br /> end<br /> command = string.lower(command)<br /> local retval<br /> if command == &#039;score&#039; then<br /> retval = get_score(entityID, &#039;percent&#039;)<br /> elseif command == &#039;average&#039; then<br /> retval = get_score(entityID, &#039;average&#039;)<br /> elseif command == &#039;count&#039; then<br /> retval = get_count(entityID, args)<br /> elseif command == &#039;rtid&#039; then<br /> retval = get_rtid(entityID, args.noprefix)<br /> elseif command == &#039;url&#039; then<br /> retval = get_url(entityID)<br /> elseif command == &#039;date&#039; then<br /> retval = get_date(entityID, &#039;date&#039;, args.df)<br /> elseif command == &#039;year&#039; then<br /> retval = get_date(entityID, command)<br /> elseif command == &#039;month&#039; then<br /> retval = get_date(entityID, command)<br /> elseif command == &#039;day&#039; then<br /> retval = get_date(entityID, command)<br /> elseif command == &#039;access date&#039; or command == &#039;accessdate&#039; or command == &#039;access-date&#039; then<br /> retval = get_access_date(entityID, args.df)<br /> elseif command == &#039;as of&#039; or command == &#039;asof&#039; then<br /> retval = get_asof(entityID, args)<br /> elseif command == &#039;prose&#039; then<br /> retval = get_rtprose(entityID, args)<br /> elseif command == &#039;prose&#039; then<br /> categories = categories .. &#039;[[Category:Articles using Template:RT data with prose]]&#039;<br /> elseif command == &#039;edit&#039; then<br /> retval = get_edit_icon(entityID)<br /> elseif command == &#039;table&#039; then<br /> retval = get_table(entityID)<br /> else<br /> return Error.error({&#039;Invalid command.&#039;})<br /> end<br /> if falsy(retval) then<br /> return Error.error({&#039;RT data for &quot;&#039; .. command .. &#039;&quot; unavailable.&#039;})<br /> end<br /> return retval<br /> end<br /> <br /> return p</div> Aidan9382