Skip to content

Commit

Permalink
refactor: Compatibility upgrade with SILE 0.15
Browse files Browse the repository at this point in the history
  • Loading branch information
Omikhleia authored and Didier Willis committed Aug 1, 2024
1 parent 3426d7d commit bbac269
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 8 deletions.
18 changes: 10 additions & 8 deletions packages/fancytoc/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
-- Only processes 2 levels, e.g. parts (level 0) and chapters (level 1)
-- and display them as some braced content.
--
require("silex.types") -- Compatibility shims

local base = require("packages.base")

local package = pl.class(base)
Expand Down Expand Up @@ -91,8 +93,8 @@ function package:registerCommands ()
end

SILE.settings:temporarily(function()
SILE.settings:set("current.parindent", SILE.nodefactory.glue())
SILE.settings:set("document.parindent", SILE.nodefactory.glue())
SILE.settings:set("current.parindent", SILE.types.node.glue())
SILE.settings:set("document.parindent", SILE.types.node.glue())

cancelFragile(function ()
-- Quick and dirty for now...
Expand All @@ -102,20 +104,20 @@ function package:registerCommands ()
SILE.call("medskip")
if #v.children > 0 then
SILE.call("parbox", { valign = "middle", width = "20%lw" }, function ()
SILE.settings:set("document.parindent", SILE.nodefactory.glue())
SILE.settings:set("document.parindent", SILE.types.node.glue())
SILE.call("raggedright", {}, function ()
SILE.call("fancytoc:level1", { style = "fancytoc-level1" }, v.item.label)
end)
end)
SILE.call("hfill")
SILE.call("bracebox", { bracewidth = "0.8em"}, function()
SILE.call("parbox", { valign = "middle", width = "75%lw" }, function ()
SILE.settings:set("document.parindent", SILE.nodefactory.glue())
SILE.settings:set("document.parindent", SILE.types.node.glue())
for _, c in ipairs(v.children) do
SILE.call("parbox", { valign = "top", strut = "rule", minimize = true, width = "80%lw" }, function ()
SILE.settings:set("document.lskip", SILE.length("1em"))
SILE.settings:set("document.rskip", SILE.nodefactory.hfillglue())
SILE.settings:set("document.parindent", SILE.length("-0.5em"))
SILE.settings:set("document.lskip", SILE.types.length("1em"))
SILE.settings:set("document.rskip", SILE.types.node.hfillglue())
SILE.settings:set("document.parindent", SILE.types.length("-0.5em"))
SILE.call("fancytoc:level2", { style = "fancytoc-level2" }, c.label)
end)
SILE.call("dotfill")
Expand All @@ -128,7 +130,7 @@ function package:registerCommands ()
end)
else
SILE.call("parbox", { valign = "top", width = "20%lw" }, function ()
SILE.settings:set("document.parindent", SILE.nodefactory.glue())
SILE.settings:set("document.parindent", SILE.types.node.glue())
SILE.call("raggedright", {}, function ()
SILE.call("fancytoc:level1", { style = "fancytoc-level1" }, v.item.label)
end)
Expand Down
File renamed without changes.
File renamed without changes.
26 changes: 26 additions & 0 deletions rockspecs/fancytoc.sile-1.1.0-1.rockspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
rockspec_format = "3.0"
package = "fancytoc.sile"
version = "1.1.0-1"
source = {
url = "git+https://github.com/Omikhleia/fancytoc.sile.git",
tag = "v1.1.0",
}
description = {
summary = "Some fancy table of contents for the SILE typesetting system.",
detailed = [[
This package for the SILE typesetter provides an altenative and fancy two-level presentation
with curly braces for a table of contents.
]],
homepage = "https://github.com/Omikhleia/fancytoc.sile",
license = "MIT",
}
dependencies = {
"lua >= 5.1",
"ptable.sile >= 3.1.0",
}
build = {
type = "builtin",
modules = {
["sile.packages.fancytoc"] = "packages/fancytoc/init.lua",
}
}
File renamed without changes.

0 comments on commit bbac269

Please sign in to comment.