diff --git a/lua-libraries/README.tinyyaml b/lua-libraries/README.tinyyaml index 9af1448..ea1f681 100644 --- a/lua-libraries/README.tinyyaml +++ b/lua-libraries/README.tinyyaml @@ -18,3 +18,5 @@ RESILIENT was to avoid a C binding dependency, since style files are reasonably small theoretically (so performance do not really matter) and only need a subset of YAML (so a pure-Lua implementation, even possibly incomplete, ought to be sufficient.) + +Modications are marked with comments MODIFIED RESILIENT diff --git a/lua-libraries/resilient-tinyyaml.lua b/lua-libraries/resilient-tinyyaml.lua index 85bec40..10cd45e 100644 --- a/lua-libraries/resilient-tinyyaml.lua +++ b/lua-libraries/resilient-tinyyaml.lua @@ -107,7 +107,7 @@ function types.timestamp:__init(y, m, d, h, i, s, f, z) self.minute = tonumber(i or 0) self.second = tonumber(s or 0) if type(f) == 'string' and sfind(f, '^%d+$') then - self.fraction = tonumber(f) * math.pow(10, 3 - #f) + self.fraction = tonumber(f) * 10^(3 - #f) -- MODIFIED RESILIENT Lua min compat elseif f then self.fraction = f else diff --git a/packages/resilient/bookmatters/init.lua b/packages/resilient/bookmatters/init.lua index c6d098b..126002a 100644 --- a/packages/resilient/bookmatters/init.lua +++ b/packages/resilient/bookmatters/init.lua @@ -77,7 +77,11 @@ end -- Source: https://www.nbdtech.com/Blog/archive/2008/04/27/Calculating-the-Perceived-Brightness-of-a-Color.aspx local function weightedColorDistanceIn3D (color) - return math.sqrt(math.pow(color.r * 255, 2) * 0.241 + math.pow(color.g * 255, 2) * 0.691 + math.pow(color.b * 255, 2) * 0.068) + return math.sqrt( + (color.r * 255)^2 * 0.241 + + (color.g * 255)^2 * 0.691 + + (color.b * 255)^2 * 0.068 + ) end local function contrastColor(color) if not color.r then @@ -160,7 +164,6 @@ function package:registerCommands () end if metadata["meta:isbn"] then - -- local H = SILE.measurement("100%fh"):tonumber() - SILE.measurement("40mm"):tonumber() SILE.call("skip", { height = offset }) SILE.call("kern", { width = SILE.nodefactory.hfillglue() }) SILE.call("framebox", { fillcolor = "white", padding = pad1, borderwidth = 0 }, { diff --git a/packages/resilient/poetry/init.lua b/packages/resilient/poetry/init.lua index a44baf8..8cf96b2 100644 --- a/packages/resilient/poetry/init.lua +++ b/packages/resilient/poetry/init.lua @@ -5,6 +5,7 @@ -- local ast = require("silex.ast") local createStructuredCommand = ast.createStructuredCommand +local LOG10 = math.log(10) local base = require("packages.resilient.base") @@ -178,7 +179,8 @@ function package:registerCommands () digitSize = SILE.shaper:measureChar("0").width end) local setback = SILE.length("1.75em"):absolute() - indent = SILE.length((math.floor(math.log10(nVerse + iVerse)) + 1) * digitSize):absolute() + local logv = math.floor(math.log(nVerse + iVerse) / LOG10) -- Reminder: math.log10 is not in Lua "min" profiile + indent = SILE.length((logv + 1) * digitSize):absolute() + setback + SILE.length(SILE.settings:get("document.parindent")):absolute() end