Skip to content

Commit

Permalink
style: Reformat Lua with stylua
Browse files Browse the repository at this point in the history
  • Loading branch information
alerque committed Oct 1, 2024
1 parent d5630af commit 7faee5f
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 13 deletions.
3 changes: 2 additions & 1 deletion core/deprecations.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ local nostd = function ()
in your project directly if needed. Note you may need to install the Lua rock
as well since it no longer ships as a dependency.
]])
]]
)
end
-- luacheck: push ignore std
---@diagnostic disable: lowercase-global
Expand Down
24 changes: 17 additions & 7 deletions packages/math/base-elements.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1395,13 +1395,23 @@ function elements.sqrt:output (x, y, line)
local sw = self.symbolWidth
local dh = h - self.symbolHeight
local symbol = {
_r(self.radicalRuleThickness), "w", -- line width
2, "j", -- round line joins
_r(sw), _r(self.extraAscender), "m",
_r(sw * 0.4), _r(h + d), "l",
_r(sw * 0.15), _r(dh), "l",
0, _r(dh + 0.5), "l",
"S"
_r(self.radicalRuleThickness),
"w", -- line width
2,
"j", -- round line joins
_r(sw),
_r(self.extraAscender),
"m",
_r(sw * 0.4),
_r(h + d),
"l",
_r(sw * 0.15),
_r(dh),
"l",
0,
_r(dh + 0.5),
"l",
"S",
}
local svg = table.concat(symbol, " ")
SILE.outputter:drawSVG(svg, x, y, sw, h, 1)
Expand Down
18 changes: 13 additions & 5 deletions spec/utilities_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,12 @@ describe("SILE.utilities", function ()
}
SU.collatedSort(sortme, nil, function (a, b, stringCompare)
-- Sort by ascending age then ascending name
if a.age < b.age then return true end
if a.age > b.age then return false end
if a.age < b.age then
return true
end
if a.age > b.age then
return false
end
return stringCompare(a.name, b.name) < 0
end)
assert.is.same({
Expand All @@ -330,12 +334,16 @@ describe("SILE.utilities", function ()
{ name = "Alice", year = 2005 },
{ name = "Charlie", year = 1995 },
{ name = "Bob", year = 1990 },
{ name = "Alice", year = 1995 }
{ name = "Alice", year = 1995 },
}
SU.collatedSort(namesAndYears, nil, function (a, b, stringCompare)
local nameCompare = stringCompare(a.name, b.name)
if nameCompare < 0 then return true end
if nameCompare > 0 then return false end
if nameCompare < 0 then
return true
end
if nameCompare > 0 then
return false
end
return a.year < b.year
end)
assert.is.same({
Expand Down

0 comments on commit 7faee5f

Please sign in to comment.