https://en.wikipedia.org/w/index.php?action=history&feed=atom&title=Module%3AGAN_link Module:GAN link - Revision history 2025-05-30T02:53:03Z Revision history for this page on the wiki MediaWiki 1.45.0-wmf.3 https://en.wikipedia.org/w/index.php?title=Module:GAN_link&diff=755085174&oldid=prev Mr. Stradivarius: fix error message for bad nomination page titles 2016-12-16T03:47:35Z <p>fix error message for bad nomination page titles</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 03:47, 16 December 2016</td> </tr><tr> <td colspan="2" class="diff-lineno">Line 53:</td> <td colspan="2" class="diff-lineno">Line 53:</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 title = mw.title.new(nominationPage)</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 title = mw.title.new(nominationPage)</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 not 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 not title 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> error(string.format('%s is not a valid title'), 2)</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> error(string.format('%s is not a valid title'<ins style="font-weight: bold; text-decoration: none;">, nominationPage</ins>), 2)</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> elseif title.exists 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 title.exists 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> return makeExistingNominationLink(nominationPage)</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> return makeExistingNominationLink(nominationPage)</div></td> </tr> </table> Mr. Stradivarius https://en.wikipedia.org/w/index.php?title=Module:GAN_link&diff=755079005&oldid=prev Mr. Stradivarius: Protected "Module:GAN link": High-risk Lua module ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite)) 2016-12-16T02:53:00Z <p>Protected &quot;<a href="/wiki/Module:GAN_link" title="Module:GAN link">Module:GAN link</a>&quot;: <a href="/wiki/Wikipedia:High-risk_templates" title="Wikipedia:High-risk templates">High-risk Lua module</a> ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))</p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <tr class="diff-title" lang="en"> <td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td> <td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 02:53, 16 December 2016</td> </tr><tr><td colspan="2" class="diff-notice" lang="en"><div class="mw-diff-empty">(No difference)</div> </td></tr></table> Mr. Stradivarius https://en.wikipedia.org/w/index.php?title=Module:GAN_link&diff=754926749&oldid=prev Mr. Stradivarius: make a replacement for Template:GAN link 2016-12-15T07:41:14Z <p>make a replacement for <a href="/wiki/Template:GAN_link" title="Template:GAN link">Template:GAN link</a></p> <p><b>New page</b></p><div>-- This module implements {{GAN link}}.<br /> <br /> local p = {}<br /> <br /> local function getGANIcon()<br /> return require(&#039;Module:Icon&#039;)._main{&#039;GAN&#039;}<br /> end<br /> <br /> local function makeWikilink(page, display)<br /> if display and display ~= page then<br /> return string.format(&#039;[[%s|%s]]&#039;, page, display)<br /> else<br /> return string.format(&#039;[[%s]]&#039;, page)<br /> end<br /> end<br /> <br /> local function getNominationPage(article, number)<br /> return string.format(&#039;Talk:%s/GA%d&#039;, article, number)<br /> end<br /> <br /> local function makeArticleLink(options)<br /> assert(options.article, &#039;options.article not specified&#039;)<br /> assert(options.formattedArticle, &#039;options.formattedArticle not specified&#039;)<br /> local display<br /> if options.isItalic then<br /> display = string.format(&#039;&lt;i&gt;%s&lt;/i&gt;&#039;, options.article)<br /> elseif options.display then<br /> display = options.display<br /> else<br /> display = options.formattedArticle<br /> end<br /> return makeWikilink(options.article, display)<br /> end<br /> <br /> local function makeExistingNominationLink(nominationPage)<br /> return makeWikilink(nominationPage, &#039;nom&#039;)<br /> end<br /> <br /> local function makeNewNominationLink(nominationPage)<br /> local url = mw.uri.fullUrl(nominationPage, {<br /> action = &#039;edit&#039;,<br /> editintro = &#039;Template:GAN/editintro&#039;,<br /> preload = &#039;Template:GAN/preload&#039;,<br /> })<br /> return string.format(<br /> &quot;&#039;&#039;&#039;&lt;span class=&#039;plainlinks&#039;&gt;[%s start]&lt;/span&gt;&#039;&#039;&#039;&quot;,<br /> tostring(url)<br /> )<br /> end<br /> <br /> local function makeNominationLink(nominationPage)<br /> assert(nominationPage, &#039;no nominationPage argument given to makeNominationLink&#039;)<br /> local title = mw.title.new(nominationPage)<br /> if not title then<br /> error(string.format(&#039;%s is not a valid title&#039;), 2)<br /> elseif title.exists then<br /> return makeExistingNominationLink(nominationPage)<br /> else<br /> return makeNewNominationLink(nominationPage)<br /> end<br /> end<br /> <br /> function p._main(args)<br /> -- Link parameters<br /> local formattedArticle = args[1]<br /> if not formattedArticle then<br /> error(&#039;No article specified&#039;, 2)<br /> end<br /> local article = formattedArticle:gsub(&quot;&#039;&#039;&#039;&quot;, &quot;&quot;):gsub(&quot;&#039;&#039;&quot;, &quot;&quot;)<br /> local display = args[2]<br /> <br /> -- Number<br /> local number<br /> if args[&#039;#&#039;] then<br /> number = tonumber(args[&#039;#&#039;])<br /> if not number then<br /> error(&quot;&#039;%s&#039; is not a valid number&quot;, args[&#039;#&#039;])<br /> end<br /> else<br /> number = 1<br /> end<br /> <br /> -- Formatting parameters<br /> local hasIcon = not not args.icon<br /> local isItalic = not not args.i<br /> <br /> -- Output<br /> local ret = {}<br /> if hasIcon then<br /> ret[#ret + 1] = getGANIcon()<br /> end<br /> ret[#ret + 1] = makeArticleLink{<br /> article = article,<br /> formattedArticle = formattedArticle,<br /> display = display,<br /> isItalic = isItalic,<br /> }<br /> ret[#ret + 1] = string.format(<br /> &#039;(%s)&#039;,<br /> makeNominationLink(getNominationPage(article, number))<br /> )<br /> return table.concat(ret, &#039; &#039;)<br /> end<br /> <br /> function p.main(frame)<br /> local args = require(&#039;Module:Arguments&#039;).getArgs(frame, {<br /> wrappers = &#039;Template:GAN link&#039;<br /> })<br /> return p._main(args)<br /> end<br /> <br /> return p</div> Mr. Stradivarius