https://en.wikipedia.org/w/index.php?action=history&feed=atom&title=Module%3APerson_length Module:Person length - Revision history 2025-06-07T12:16:33Z Revision history for this page on the wiki MediaWiki 1.45.0-wmf.4 https://en.wikipedia.org/w/index.php?title=Module:Person_length&diff=920271903&oldid=prev MusikBot II: Protected "Module:Person length": High-risk template or module (more info) ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite)) 2019-10-08T17:59:50Z <p>Protected &quot;<a href="/wiki/Module:Person_length" title="Module:Person length">Module:Person length</a>&quot;: <a href="/wiki/Wikipedia:High-risk_templates" title="Wikipedia:High-risk templates">High-risk template or module</a> (<a href="/wiki/User:MusikBot_II/TemplateProtector" title="User:MusikBot II/TemplateProtector">more info</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 17:59, 8 October 2019</td> </tr><tr><td colspan="2" class="diff-notice" lang="en"><div class="mw-diff-empty">(No difference)</div> </td></tr></table> MusikBot II https://en.wikipedia.org/w/index.php?title=Module:Person_length&diff=920141754&oldid=prev Frietjes at 22:21, 7 October 2019 2019-10-07T22:21:03Z <p></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 22:21, 7 October 2019</td> </tr><tr> <td colspan="2" class="diff-lineno">Line 38:</td> <td colspan="2" class="diff-lineno">Line 38:</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 force_cm = (enforce or '') == 'cm'</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 force_cm = (enforce or '') == 'cm'</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> </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> </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> unconverted = <del style="font-weight: bold; text-decoration: none;">clean</del>(s or '') -- basic unit cleaning</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> unconverted = <ins style="font-weight: bold; text-decoration: none;">clean_length</ins>(s or '') -- basic unit cleaning</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> </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> </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 = mw.ustring.gsub(unconverted, '&amp;[Nn][Bb][Ss][Pp];', ' ')</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 = mw.ustring.gsub(unconverted, '&amp;[Nn][Bb][Ss][Pp];', ' ')</div></td> </tr> </table> Frietjes https://en.wikipedia.org/w/index.php?title=Module:Person_length&diff=920141584&oldid=prev Frietjes at 22:19, 7 October 2019 2019-10-07T22:19:45Z <p></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 22:19, 7 October 2019</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" 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>-- This module implements [[Template:Infobox person/<del style="font-weight: bold; text-decoration: none;">height</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>-- This module implements [[Template:Infobox person/<ins style="font-weight: bold; text-decoration: none;">length</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;"><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 p = {}</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 p = {}</div></td> </tr> </table> Frietjes https://en.wikipedia.org/w/index.php?title=Module:Person_length&diff=920141550&oldid=prev Frietjes: working on a lua version of Template:Infobox person/length 2019-10-07T22:19:29Z <p>working on a lua version of <a href="/wiki/Template:Infobox_person/length" title="Template:Infobox person/length">Template:Infobox person/length</a></p> <p><b>New page</b></p><div>-- This module implements [[Template:Infobox person/height]]<br /> <br /> local p = {}<br /> <br /> local function clean_length(s)<br /> s = mw.ustring.gsub(s, &#039;centimetre&#039;, &#039;cm&#039;)<br /> s = mw.ustring.gsub(s, &#039;centimeter&#039;, &#039;cm&#039;)<br /> s = mw.ustring.gsub(s, &#039;cms&#039;, &#039;cm&#039;)<br /> s = mw.ustring.gsub(s, &#039;cm%.&#039;, &#039;cm&#039;)<br /> s = mw.ustring.gsub(s, &#039;metre&#039;, &#039;m&#039;)<br /> s = mw.ustring.gsub(s, &#039;meter&#039;, &#039;m&#039;)<br /> s = mw.ustring.gsub(s, &#039;ms&#039;, &#039;m&#039;)<br /> s = mw.ustring.gsub(s, &#039;m%.&#039;, &#039;m&#039;)<br /> s = mw.ustring.gsub(s, &#039;inches&#039;, &#039;in&#039;)<br /> s = mw.ustring.gsub(s, &#039;inch&#039;, &#039;in&#039;)<br /> s = mw.ustring.gsub(s, &#039;ins&#039;, &#039;in&#039;)<br /> s = mw.ustring.gsub(s, &#039;in%.&#039;, &#039;in&#039;)<br /> s = mw.ustring.gsub(s, &#039;%[%[[Cc]entim|cm%]%]&#039;, &#039;[[Centimetre|cm]]&#039;)<br /> s = mw.ustring.gsub(s, &#039;%[%[cm%]%]s&#039;, &#039;[[Centimetre|cm]]&#039;)<br /> s = mw.ustring.gsub(s, &#039;%[%[m%]%]s&#039;, &#039;[[Metre|m]]&#039;)<br /> s = mw.ustring.gsub(s, &#039;%[%[in|in%]%]&#039;, &#039;[[inch|in]]&#039;)<br /> <br /> return s<br /> end<br /> <br /> local function isnumber(s)<br /> if s then<br /> s = mw.ustring.gsub(s, &#039;%+%s*%d+%s*/%s*%d+%s*$&#039;, &#039;&#039;)<br /> return tonumber(s)<br /> end<br /> return nil<br /> end<br /> <br /> local function get_convert_length_args(s, prefer, enforce)<br /> local prefer_m = (prefer or &#039;&#039;) == &#039;m&#039;<br /> local force_m = (enforce or &#039;&#039;) == &#039;m&#039;<br /> local prefer_cm = (prefer or &#039;&#039;) == &#039;cm&#039;<br /> local force_cm = (enforce or &#039;&#039;) == &#039;cm&#039;<br /> <br /> unconverted = clean(s or &#039;&#039;) -- basic unit cleaning<br /> <br /> s = mw.ustring.gsub(unconverted, &#039;&amp;[Nn][Bb][Ss][Pp];&#039;, &#039; &#039;)<br /> <br /> local m = mw.ustring.find(s, &#039;m&#039;)<br /> local c = mw.ustring.find(s, &#039;cm&#039;)<br /> local i = mw.ustring.find(s, &#039;in&#039;)<br /> <br /> if m == nil and i == nil then<br /> return &#039;&#039;, unconverted<br /> end<br /> <br /> if c ~= nil and i == nil then<br /> local n = mw.ustring.sub(s, 1, c - 1)<br /> if isnumber(n) then<br /> return force_m<br /> and {n/100,&#039;m&#039;,&#039;in&#039;,0,[&#039;abbr&#039;]=&#039;on&#039;}<br /> or {n,&#039;cm&#039;,&#039;in&#039;,0,[&#039;abbr&#039;]=&#039;on&#039;}, mw.ustring.sub(s, c+2)<br /> end<br /> return &#039;&#039;, unconverted<br /> end<br /> <br /> if m ~= nil and c == nil and i == nil then<br /> local n = mw.ustring.sub(s, 1, m - 1)<br /> if isnumber(n) then<br /> return force_cm <br /> and {n*100,&#039;cm&#039;,&#039;in&#039;,0,[&#039;abbr&#039;]=&#039;on&#039;}<br /> or {n,&#039;m&#039;,&#039;in&#039;,0,[&#039;abbr&#039;]=&#039;on&#039;}, mw.ustring.sub(s, m+1)<br /> end<br /> return &#039;&#039;, unconverted<br /> end<br /> <br /> if i ~= nil and m == nil then<br /> local n = mw.ustring.sub(s, 1, i - 1)<br /> if isnumber(n) then<br /> return (force_m or prefer_m)<br /> and {n,&#039;in&#039;,&#039;m&#039;,2,[&#039;abbr&#039;]=&#039;on&#039;}<br /> or {n,&#039;in&#039;,&#039;cm&#039;,0,[&#039;abbr&#039;]=&#039;on&#039;}, mw.ustring.sub(s, i+2)<br /> end<br /> return &#039;&#039;, unconverted<br /> end<br /> <br /> return &#039;&#039;, unconverted<br /> end<br /> <br /> function convert_length(frame, args)<br /> local targs, str = get_convert_length_args(args[1], args[&#039;prefer&#039;] or &#039;&#039;, args[&#039;enforce&#039;] or &#039;&#039;)<br /> <br /> if type(targs) == &#039;table&#039; then<br /> return frame:expandTemplate{ title = &#039;convert&#039;, args = targs} .. str<br /> else<br /> return str<br /> end<br /> end<br /> <br /> function p.length(frame)<br /> return convert_length(frame, frame.args[1] and frame.args or frame:getParent().args)<br /> end<br /> <br /> return p</div> Frietjes