• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

sile-typesetter / sile / 14860011647

06 May 2025 12:44PM UTC coverage: 67.057% (+32.5%) from 34.559%
14860011647

push

github

alerque
chore(typesetters): Fixup access to class from typesetter functions

7 of 7 new or added lines in 2 files covered. (100.0%)

1344 existing lines in 103 files now uncovered.

14880 of 22190 relevant lines covered (67.06%)

11549.16 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/languages/eo/init.lua
1
-- Verkita originale por Fredrick BRENNAN (copypaste@kittens.ph) 2022-jare
2
-- Original file by Fredrick R. Brennan (copypaste@kittens.ph) in 2022
3

4
local unicode = require("languages.unicode")
×
5

UNCOV
6
local language = pl.class(unicode)
×
7
language._name = "eo"
×
8

UNCOV
9
function language:declareSettings ()
×
UNCOV
10
   self.settings:declare({
×
11
      parameter = "languages.eo.ordinal.raisedsuffix",
12
      type = "boolean",
13
      default = false,
14
      help = "Whether to use “ª” or “a” as Esperanto ordinal suffix",
15
   })
UNCOV
16
   self.settings:declare({
×
17
      parameter = "languages.eo.ordinal.hyphenbefore",
18
      type = "boolean",
19
      default = false,
20
      help = "Whether to put a hyphen (-) before Esperanto ordinal suffix",
21
   })
22
end
23

UNCOV
24
function language:registerCommands ()
×
UNCOV
25
   self:registerCommand("book:chapter:post:eo", function ()
×
UNCOV
26
      SILE.typesetter:typeset(self:numberToOrdinal())
×
UNCOV
27
      SILE.call("medskip", {})
×
UNCOV
28
   end, nil, nil, true)
×
29
end
30

UNCOV
31
function language:numberToOrdinal (num)
×
32
   if num == nil then
×
33
      num = ""
×
34
   end
35
   local a, h
36
   h = self.settings:get("languages.eo.ordinal.hyphenbefore") and "-" or ""
×
37
   a = h .. (self.settings:get("languages.eo.ordinal.raisedsuffix") and "ª" or "a")
×
38
   return num .. a
×
39
end
40

41
-- Copied from en.lua
42
local function digits (num)
UNCOV
43
   local i, ret = -1
×
44
   return function ()
45
      i, ret = i + 1, num % 10
×
46
      if num > 0 then
×
UNCOV
47
         num = math.floor(num / 10)
×
UNCOV
48
         return i, ret
×
49
      end
50
   end
51
end
52

53
-- Rezultas la vorton de la postulata nombra parametro
54
-- Returns the Esperanto name of the required number argument
55
function language:numberToString (num)
×
56
   -- typos: ignore start
57
   local words = { "unu", "du", "tri", "kvar", "kvin", "ses", "sep", "ok", "naŭ", [0] = "" }
×
UNCOV
58
   local levels = { "mil", "miliono", "miliardo", [0] = "" }
×
59
   -- typos: ignore end
60
   local ten = "dek"
×
61
   local hundred = "cent"
×
62
   for i = 2, 8, 1 do
×
UNCOV
63
      table.insert(levels, 2 + i, words[i] .. "iliono")
×
UNCOV
64
      table.insert(levels, 2 + i + 1, words[i] .. "iliardo")
×
65
   end
66

UNCOV
67
   local level = false
×
68
   local function getname (pos, dig) --"stateful, but effective." ~ en_string
UNCOV
69
      level = level or (pos % 3 == 0)
×
70
      if dig == 0 then
×
71
         return ""
×
72
      end
73
      local dig_name
74
      if dig == 1 and pos ~= 0 then
×
75
         dig_name = ""
×
76
      else
77
         dig_name = words[dig]
×
78
      end
UNCOV
79
      local name = (pos % 3 == 2 and dig_name .. " " .. hundred .. " " or dig_name .. " ")
×
80
         .. (pos % 3 == 1 and ten .. " " or "")
×
UNCOV
81
      if level then
×
82
         name, level =
×
83
            name
84
               .. levels[math.floor(pos / 3)]
×
UNCOV
85
               .. ((dig > 1 and pos > 5) and "j" or "")
×
UNCOV
86
               .. (pos > 5 and " kaj" or "")
×
UNCOV
87
               .. " ",
×
88
            false
89
      end
UNCOV
90
      return name
×
91
   end
92

UNCOV
93
   local vword = ""
×
94

95
   for i, v in digits(num) do
×
UNCOV
96
      vword = getname(i, v) .. vword
×
97
   end
98

UNCOV
99
   vword = vword:gsub(" kaj $", "")
×
UNCOV
100
   vword = pl.stringx.strip(vword)
×
101

102
   return num == 0 and "nul" or vword
×
103
end
104

105
return language
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc