https://nordiclarp.org/w/index.php?title=Module:Armenian&feed=atom&action=historyModule:Armenian - Revision history2024-03-29T08:40:28ZRevision history for this page on the wikiMediaWiki 1.34.2https://nordiclarp.org/w/index.php?title=Module:Armenian&diff=14666&oldid=prevJohannes Axner: 1 revision imported2019-01-02T01:49:15Z<p>1 revision imported</p>
<table class="diff diff-contentalign-left" data-mw="interface">
<tr class="diff-title" lang="en">
<td colspan="1" style="background-color: #fff; color: #222; text-align: center;">← Older revision</td>
<td colspan="1" style="background-color: #fff; color: #222; text-align: center;">Revision as of 01:49, 2 January 2019</td>
</tr><tr><td colspan="2" class="diff-notice" lang="en"><div class="mw-diff-empty">(No difference)</div>
</td></tr></table>Johannes Axnerhttps://nordiclarp.org/w/index.php?title=Module:Armenian&diff=14665&oldid=preven>Andy M. Wang: fix when passing value greater than 29999 (for templates not spazzing)2016-04-25T22:07:19Z<p>fix when passing value greater than 29999 (for templates not spazzing)</p>
<p><b>New page</b></p><div>-- This module implements {{Armenian}}. It converts numbers to old Armenian<br />
-- numerals, for numbers from 1-29999.<br />
<br />
local p = {}<br />
<br />
function p.main( frame )<br />
-- If we are being called from #invoke, then the number is the first positional<br />
-- argument. If not, it is the frame parameter.<br />
local num<br />
if frame == mw.getCurrentFrame() then<br />
num = frame:getParent().args[ 1 ]<br />
local frameArgsNum = frame.args[ 1 ]<br />
if frameArgsNum then<br />
num = frameArgsNum<br />
end<br />
else<br />
num = frame<br />
end<br />
<br />
-- Convert the input to an integer if possible.<br />
if type( num ) ~= 'number' then<br />
num = tonumber( num )<br />
end<br />
if not num then return '' end<br />
<br />
num = math.floor( num )<br />
-- Exit if the number is not expressible in Armenian numerals.<br />
-- FIXME: Check if Armenian numerals can really be made 10,000x bigger through<br />
-- overlining them as it says in our article. (That claim is unsourced.) If they<br />
-- can, there is code at [[Module:Roman]] that can be stolen from to make it work.<br />
if num < 1 or num > 29999 then return '' end<br />
<br />
local numerals = {<br />
{ 20000, "Ֆ" }, { 10000, "Օ" },<br />
{ 9000, "Ք" }, { 8000, "Փ" }, { 7000, "Ւ" }, { 6000, "Ց" }, { 5000, "Ր" }, { 4000, "Տ" }, { 3000, "Վ" }, { 2000, "Ս" }, { 1000, "Ռ" },<br />
{ 900, "Ջ" }, { 800, "Պ" }, { 700, "Չ" }, { 600, "Ո" }, { 500, "Շ" }, { 400, "Ն" }, { 300, "Յ" }, { 200, "Մ" }, { 100, "Ճ" },<br />
{ 90, "Ղ" }, { 80, "Ձ" }, { 70, "Հ" }, { 60, "Կ" }, { 50, "Ծ" }, { 40, "Խ" }, { 30, "Լ" }, { 20, "Ի" }, { 10, "Ժ" },<br />
{ 9, "Թ" }, { 8, "Ը" }, { 7, "Է" }, { 6, "Զ" }, { 5, "Ե" }, { 4, "Դ" }, { 3, "Գ" }, { 2, "Բ" }, { 1, "Ա" }<br />
}<br />
<br />
local ret = {}<br />
for _, v in ipairs( numerals ) do<br />
local val, letter = unpack( v )<br />
while num >= val do<br />
num = num - val<br />
table.insert( ret, letter )<br />
end<br />
end<br />
return table.concat( ret )<br />
end<br />
<br />
return p</div>en>Andy M. Wang