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

sile-typesetter / sile / 14510870853

17 Apr 2025 07:55AM UTC coverage: 31.472% (-25.8%) from 57.267%
14510870853

push

github

web-flow
Merge pull request #2267 from Omikhleia/feat-csl-position

0 of 109 new or added lines in 2 files covered. (0.0%)

4871 existing lines in 34 files now uncovered.

6341 of 20148 relevant lines covered (31.47%)

2774.57 hits per line

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

0.0
/packages/math/unicode-accents.lua
1
-- IMPORTANT:
2
-- Normally, if we were to take MathML seriously, we would have to use the Unicode combining characters
3
-- for accents, using reverse mapping tables.
4
-- So our current implementation here is not fully compliant, but the whole thing is a hornet's nest.
5

6
-- Combining character check by Unicode block
7
-- @tparam number codepoint A Unicode codepoint
8
-- @treturn boolean true if the codepoint is a combining character, false otherwise
9
local isCombining = function (codepoint)
10
   return
×
11
      -- Combining Diacritical Marks (0300–036F), since version 1.0, with modifications in subsequent versions down to 4.1
UNCOV
12
      (codepoint >= 0x0300 and codepoint <= 0x036F)
×
13
         -- Combining Diacritical Marks Extended (1AB0–1AFF), version 7.0
UNCOV
14
         or (codepoint >= 0x1AB0 and codepoint <= 0x1AFF)
×
15
         -- Combining Diacritical Marks Supplement (1DC0–1DFF), versions 4.1 to 5.2
UNCOV
16
         or (codepoint >= 0x1DC0 and codepoint <= 0x1DFF)
×
17
         -- Combining Diacritical Marks for Symbols (20D0–20FF), since version 1.0, with modifications in subsequent versions down to 5.1
UNCOV
18
         or (codepoint >= 0x20D0 and codepoint <= 0x20FF)
×
19
         -- Cyrillic Extended-A (2DE0–2DFF), version 5.1
UNCOV
20
         or (codepoint >= 0x2DE0 and codepoint <= 0x2DFF)
×
21
         -- Combining Half Marks (FE20–FE2F), versions 1.0, with modifications in subsequent versions down to 8.0
UNCOV
22
         or (codepoint >= 0xFE20 and codepoint <= 0xFE2F)
×
UNCOV
23
         or false
×
24
end
25

26
-- MathML Core non-normative B.3 (https://www.w3.org/TR/mathml-core/#comb-noncomb)
27
-- W3C Working Draft 27 November 2023, and MathML Core Editor's Draft 26 November 2024 as well:
28
-- The table does not seem complete, see ADDED comments below so that we can map TeX atoms
29
-- accent and bottaccent atoms to non-combining characters...
30
-- For the ADDED stuff, see report https://github.com/w3c/mathml-core/issues/137#issuecomment-2508344714
31
-- See also https://github.com/w3c/mathml/issues/247 on a related issue.
32
-- Grumpy none: All these standards put together are defective by design.
UNCOV
33
local nonCombining = {
×
34
   -- Combining Diacritical Marks (0300–036F)
35
   [0x0300] = 0x0060, -- combining grave accent (above) > grave accent
36
   [0x0301] = 0x00B4, -- combining acute accent (above) > acute accent
37
   [0x0302] = 0x02C6, -- combining circumflex accent (above) > modifier letter circumflex accent
38
   [0x0303] = 0x007E, -- combining tilde (above) > tilde
39
   [0x0304] = 0x00AF, -- combining macron (above) > macron
40
   [0x0305] = 0x203E, -- combining overline (above) > overline
41
   [0x0306] = 0x02D8, -- combining breve (above) > breve
42
   [0x0307] = 0x02D9, -- combining dot (above) > dot above
43
   [0x0308] = 0x00A8, -- combining diaeresis (above) > diaeresis
44
   [0x030A] = 0x02DA, -- combining ring above > ring above (ADDED)
45
   [0x030B] = 0x02DD, -- combining double acute accent (above) > double acute accent
46
   [0x030C] = 0x02C7, -- combining caron (above) > caron
47
   -- [0x0311] (accent in unicode-math) combining inverted breve (above) has no safe non-combining equivalent
48
   [0x0312] = 0x00B8, -- combining comma (above) > cedilla
49
   [0x0316] = 0x0060, -- combining grave accent (below) > grave accent
50
   [0x0317] = 0x00B4, -- combining acute accent (below) > acute accent
51
   [0x031F] = 0x002B, -- combingin plus sign (below) > plus sign
52
   [0x0320] = 0x002D, -- combining minus sign (below) > minus sign
53
   [0x0323] = 0x002E, -- combining dot (below) > full stop
54
   [0x0324] = 0x00A8, -- combining diaeresis (below) > diaeresis
55
   [0x0327] = 0x00B8, -- combining cedilla (below) > cedilla
56
   [0x0328] = 0x02DB, -- combining ogonek (below) > ogonek
57
   [0x032C] = 0x02C7, -- combining caron (below) > caron
58
   [0x032D] = 0x005E, -- circumflex accent below
59
   [0x032E] = 0x02D8, -- combining breve (below) > breve
60
   -- [0x032F] (botaccent is unicode-math) combining inverted breve (below) has no safe non-combining equivalent
61
   [0x0330] = 0x007E, -- combining tilde (below) > tilde
62
   [0x0331] = 0x00AF, -- combining macron (below) > macron (ADDED)
63
   [0x0332] = 0x203E, -- combining low line (below) > overline
64
   [0x0333] = 0x2017, -- combining double low line (below) > double low line (ADDED)
65
   [0x0338] = 0x002F, -- combining long solidus overlay (over) > solidus
66
   -- [0x033A] (botaccent is unicode-math) combining inverted bridge below has no safe non-combining equivalent
67
   -- [0x033F] (accent in unicode-math) combining double overline has no safe non-combining equivalent
68
   -- [0x0346] (accent in unicode-math) combining bridge above has no safe non-combining equivalent
69
   [0x034D] = 0x2194, -- combining left-right arrow (below) > left right arrow (ADDED)
70
   --Combining Diacritical Marks for Symbols (20D0–20FF)
71
   [0x20D0] = 0x21BC, -- combining left harpoon (above) > leftwards harpoon with barb up (ADDED)
72
   [0x20D1] = 0x21C0, -- combining right harpoon (above) > rightwards harpoon with barb up (ADDED)
73
   -- [0x20D4] (accent in unicode-math) combining anticlockwise arrow above has no safe non-combining equivalent
74
   -- [0x20D5] (accent in unicode-math) combining clockwise arrow above has no safe non-combining equivalent
75
   [0x20D6] = 0x2190, -- combining left arrow (above) > left arrow [or U+27F5 long leftwards arrow?] (ADDED)
76
   [0x20D7] = 0x2192, -- combining right arrow (above) > right arrow [or U+27F6 long rightwards arrow?]
77
   [0x20DB] = 0x22EF, -- combining triple underdot (above) > midline horizontal ellipsis (ADDED, LIKELY IMPERFECT)
78
   --[0x20DC] (accent in unicode-math) combining four dots above has no safe non-combining equivalent
79
   [0x20E1] = 0x2194, -- combining left right arrow above > left right arrow (ADDED)
80
   -- [0x20E7] (botaccent is unicode-math) combining annuity symbol has no safe non-combining equivalent
81
   [0x20E8] = 0x22EF, -- combining triple underdot (below) > midline horizontal ellipsis (ADDED, LIKELY IMPERFECT)
82
   -- [0x20E9] (botaccent is unicode-math) combining wide bridge above has no safe non-combining equivalent
83
   [0x20EC] = 0x21C1, -- combining rightwards harpoon with barb downwards > rightwards harpoon with barb downwards (ADDED)
84
   [0x20ED] = 0x21BD, -- combining leftwards harpoon with bard downwards > leftwards harpoon with barb downwards (ADDED)
85
   [0x20EE] = 0x2190, -- combining left arrow (below) > left arrow [or U+27F5 long leftwards arrow?] (ADDED)
86
   [0x20EF] = 0x2192, -- combining right arrow (below) > right arrow [or U+27F6 long rightwards arrow?]
87
}
88

89
-- Make a non-combining equivalent of a combining character
90
-- @tparam string char A single-character string representing a combining character
91
-- @treturn string A single-character string representing the non-combining equivalent
92
local function makeNonCombining (char)
UNCOV
93
   local codepoint = luautf8.codepoint(char, 1)
×
UNCOV
94
   if isCombining(codepoint) then
×
95
      local noncombining = nonCombining[codepoint]
×
96
      if noncombining then
×
97
         return luautf8.char(noncombining)
×
98
      end
99
      SU.warn(("No non-combining equivalent for codepoint 0x%x"):format(codepoint))
×
100
   end
UNCOV
101
   return char
×
102
end
103

UNCOV
104
return {
×
105
   isCombining = isCombining,
106
   makeNonCombining = makeNonCombining,
107
}
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