summaryrefslogtreecommitdiff
path: root/tex/context/third/cyrillicnumbers/cyrillicnumbers.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/third/cyrillicnumbers/cyrillicnumbers.lua')
-rw-r--r--tex/context/third/cyrillicnumbers/cyrillicnumbers.lua57
1 files changed, 27 insertions, 30 deletions
diff --git a/tex/context/third/cyrillicnumbers/cyrillicnumbers.lua b/tex/context/third/cyrillicnumbers/cyrillicnumbers.lua
index ab238ad..1c252ae 100644
--- a/tex/context/third/cyrillicnumbers/cyrillicnumbers.lua
+++ b/tex/context/third/cyrillicnumbers/cyrillicnumbers.lua
@@ -76,31 +76,19 @@ local cyrillic_100k = utf8char(0x488) -- combining hundred thousands sign
local cyrillic_1m = utf8char(0x489) -- combining million sign
local cyrillic_titlo = utf8char(0x483) -- combining titlo
+cyrnum.last_synonyms = {
+ final = true,
+ last = true,
+ right = true,
+ rightmost = true,
+ ["false"] = true,
+}
---local concat_cyrillic_nums = function (chars, upper)
--- dbg(chars)
--- local nchars, result = tablemaxn(chars), ""
--- --if cyrnum.placetitlo and cyrnum.titlomode == "fm" then -- above central char
--- -- dbg("char cnt", nchars)
--- -- dbg("insert pos", mathceil(nchars/2))
--- -- tableinsert(chars, mathceil(nchars/2), cyrillic_titlo)
--- --end
--- for i=#chars, 1, -1 do
--- local this = chars[i]
--- if this then
--- if upper then this = utfupper(this) end
--- if i > 3 then
--- result = result .. cyrillic_1k .. this
--- else
--- result = result .. this
--- end
--- end
--- end
--- if cyrnum.placetitlo and cyrnum.titlomode == "fl" then -- take titlo from font, place it after / above last char
--- result = result .. cyrillic_titlo
--- end
--- return result
---end
+cyrnum.yes_synonyms = {
+ yes = true,
+ yeah = true,
+ ["true"] = true,
+}
local digits_only = function (list)
local result = { }
@@ -119,17 +107,24 @@ local start_titlo, stop_titlo = [[\cyrnumdrawtitlo{]], "}"
local titlofuncs = {
font = function (list)
- if cyrnum.titlolocation == "final" then
- list[#list+1] = cyrillic_titlo
- else -- “middle” or whatever
- local pos = mathceil(tablemaxn(list)/2)
- tableinsert(list, mathceil(tablemaxn(list)/2), cyrillic_titlo)
+ if cyrnum.titlolocation == "l" then
+ local result = lreverse(list)
+ result[#result+1] = cyrillic_titlo
+ return result
end
+ -- “middle” (“m”) or whatever
+ local pos = mathceil(tablemaxn(list)/2)
+ tableinsert(list, mathceil(tablemaxn(list)/2), cyrillic_titlo)
return lreverse(list)
end,
mp = function (list)
- local result = { start_titlo }
+ local result = { }
+ local titlospan = cyrnum.titlospan
+ local titlostart = titlospan and #list > titlospan and #list-titlospan or 1
for i=tablemaxn(list), 1, -1 do
+ if i == titlostart then
+ result[#result+1] = start_titlo
+ end
result[#result+1] = list[i]
end
result[#result+1] = stop_titlo
@@ -190,3 +185,5 @@ converters.Cyrillicnumerals = Tocyrillic
function commands.cyrillicnumerals (n) context(tocyrillic(n)) end
function commands.Cyrillicnumerals (n) context(Tocyrillic(n)) end
+
+-- vim:ft=lua:ts=2:sw=2:expandtab:fo=croql