Skip to content

Commit

Permalink
Merge pull request #14 from Omikhleia/remove-compatibility-shims
Browse files Browse the repository at this point in the history
refactor: Remove compatibility shims for old SILE versions
  • Loading branch information
Omikhleia committed Dec 13, 2023
2 parents 238354d + 0eb0ac3 commit 1b49d34
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ luac.out
*.ref
tests/*.pdf
tests/*.debug

examples/*.pdf
4 changes: 0 additions & 4 deletions .luacheckrc
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
std = "min+sile"
include_files = {
"**/*.lua",
"sile.in",
"*.rockspec",
".busted",
".luacheckrc"
}
exclude_files = {
"benchmark-*",
"compare-*",
"sile-*",
"lua_modules",
"lua-libraries",
".lua",
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ box. The package offers various interesting options and goodies.

## Installation

These packages require SILE v0.14 or upper.
These packages require SILE v0.14.13 or upper.

Installation relies on the **luarocks** package manager.

Expand Down
1 change: 0 additions & 1 deletion packages/framebox/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
--
-- KNOWN ISSUE: RTL and BTT writing directions are not officialy supported yet (untested)
--
require("silex.compat")
local base = require("packages.base")

local package = pl.class(base)
Expand Down
18 changes: 5 additions & 13 deletions packages/parbox/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
-- Paragraph blocks ("parbox") for SILE
-- Or how to wrap width-contrained vboxes into an hbox:
-- A building block for more advanced concepts.
-- 2021-2022 Didier Willis
-- 2021-2023 Didier Willis
-- License: MIT
--
-- Known limitations: LTR-TTB writing direction is assumed.
Expand Down Expand Up @@ -50,20 +50,11 @@ end
-- Main function for parboxing content.
-- Returns a list of vboxes.
local function parboxFraming (options, content)
local oldTypesetter = SILE.typesetter
local parboxTypesetter
local innerVbox

SILE.settings:pushState()
SILE.settings:toplevelState()

if not SILE.typesetters or not SILE.typesetters.base then
-- Compatibility shim for SILE 0.14.0..0.14.5
parboxTypesetter = SILE.defaultTypesetter()
else
-- Breaking change for SILE 0.14.6 and upper
parboxTypesetter = SILE.typesetters.base()
end
local oldTypesetter = SILE.typesetter
local parboxTypesetter = SILE.typesetters.base()

local hlist = {}
local originalLeaveHmode = parboxTypesetter.leaveHmode
Expand All @@ -80,7 +71,8 @@ local function parboxFraming (options, content)

SILE.process(content)
parboxTypesetter:leaveHmode(1)
innerVbox = parboxTypesetter.state.outputQueue

local innerVbox = parboxTypesetter.state.outputQueue

SILE.typesetter = oldTypesetter
SILE.settings:popState()
Expand Down
1 change: 0 additions & 1 deletion packages/ptable/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
-- 2021-2023 Didier Willis
-- License: MIT
--
require("silex.compat")
local base = require("packages.base")

local makeParbox -- assigned at package initialization
Expand Down
1 change: 0 additions & 1 deletion packages/struts/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
-- 2021-2023 Didier Willis
-- License: MIT
--
require("silex.compat")
local base = require("packages.base")

local package = pl.class(base)
Expand Down
31 changes: 31 additions & 0 deletions ptable.sile-2.0.2-1.rockspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
rockspec_format = "3.0"
package = "ptable.sile"
version = "2.0.2-1"
source = {
url = "git+https://github.com/Omikhleia/ptable.sile.git",
tag = "v2.0.2",
}
description = {
summary = "Paragraph boxes, framed boxes and table packages for the SILE typesetting system.",
detailed = [[
This package for the SILE typesetter provides struts, paragraph boxes
(parbox), framed boxes (framebox) and tables (ptable).
]],
homepage = "https://github.com/Omikhleia/ptable.sile",
license = "MIT",
}
dependencies = {
"lua >= 5.1",
}
build = {
type = "builtin",
modules = {
["sile.packages.struts"] = "packages/struts/init.lua",
["sile.packages.parbox"] = "packages/parbox/init.lua",
["sile.packages.ptable"] = "packages/ptable/init.lua",
["sile.packages.framebox"] = "packages/framebox/init.lua",
["sile.packages.framebox.graphics.prng"] = "packages/framebox/graphics/prng.lua",
["sile.packages.framebox.graphics.renderer"] = "packages/framebox/graphics/renderer.lua",
["sile.packages.framebox.graphics.rough"] = "packages/framebox/graphics/rough.lua",
}
}
2 changes: 0 additions & 2 deletions ptable.sile-dev-1.rockspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ description = {
}
dependencies = {
"lua >= 5.1",
"silex.sile",
}
build = {
type = "builtin",
Expand All @@ -26,6 +25,5 @@ build = {
["sile.packages.framebox.graphics.prng"] = "packages/framebox/graphics/prng.lua",
["sile.packages.framebox.graphics.renderer"] = "packages/framebox/graphics/renderer.lua",
["sile.packages.framebox.graphics.rough"] = "packages/framebox/graphics/rough.lua",
["sile.resilient-compat.hboxing"] = "resilient-compat/hboxing.lua",
}
}
3 changes: 2 additions & 1 deletion tests/framebox-004.sil
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
\begin[papersize=a6, class=resilient.book]{document}
\begin[papersize=a6, class=book]{document}
\use[module=packages.framebox]
\use[module=packages.struts]
\use[module=packages.parbox]
\nofolios
\neverindent
% Test case: migrating content in framebox and colleagues.
Expand Down

0 comments on commit 1b49d34

Please sign in to comment.