Skip to content

Commit

Permalink
feat: showframe working for all the pages
Browse files Browse the repository at this point in the history
  • Loading branch information
jodros committed Nov 11, 2023
1 parent 0c5c0d3 commit 3478f38
Show file tree
Hide file tree
Showing 3 changed files with 169 additions and 4 deletions.
24 changes: 20 additions & 4 deletions packages/frametricks/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,28 @@ function package:registerCommands ()

self:registerCommand("showframe", function (options, _)
local id = options.id or SILE.typesetter.frame.id
if id == "all" then
for _, frame in pairs(SILE.frames) do
SILE.outputter:debugFrame(frame)
options.allpages = options.allpages or true

local show = function()
if id == "all" then
for _, frame in pairs(SILE.frames) do
SILE.outputter:debugFrame(frame)
end
else
SILE.outputter:debugFrame(SILE.getFrame(id))
end
end

if options.allpages and options.allpages ~= "false" then
show()
local oldNewPage = SILE.documentState.documentClass.newPage
SILE.documentState.documentClass.newPage = function (self_)
local page = oldNewPage(self_)
show()
return page
end
else
SILE.outputter:debugFrame(SILE.getFrame(id))
show()
end
end)

Expand Down
136 changes: 136 additions & 0 deletions tests/showframes.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
Set paper size 595.275597 841.8897729
Begin page
Mx 295.2916
My 780.6177
Set font Gentium Plus;10;400;;normal;;;LTR
T 20 w=4.6924 (1)
New page
My 780.5689
T 21 w=4.6924 (2)
New page
T 22 w=4.6924 (3)
New page
My 780.6177
T 23 w=4.6924 (4)
New page
My 780.5103
T 24 w=4.6924 (5)
New page
My 780.6372
T 25 w=4.6924 (6)
New page
My 780.4224
T 26 w=4.6924 (7)
New page
My 780.5689
T 27 w=4.6924 (8)
New page
T 28 w=4.6924 (9)
New page
Mx 292.9454
My 780.6177
T 20 19 w=9.3848 (10)
New page
T 20 20 w=9.3848 (11)
New page
T 20 21 w=9.3848 (12)
New page
T 20 22 w=9.3848 (13)
New page
T 20 23 w=9.3848 (14)
New page
T 20 24 w=9.3848 (15)
New page
My 780.6372
T 20 25 w=9.3848 (16)
New page
My 780.6177
T 20 26 w=9.3848 (17)
New page
T 20 27 w=9.3848 (18)
New page
T 20 28 w=9.3848 (19)
New page
My 780.5689
T 21 19 w=9.3848 (20)
New page
My 780.6177
T 21 20 w=9.3848 (21)
New page
My 780.5689
T 21 21 w=9.3848 (22)
New page
T 21 22 w=9.3848 (23)
New page
My 780.6177
T 21 23 w=9.3848 (24)
New page
My 780.5689
T 21 24 w=9.3848 (25)
New page
My 780.6372
T 21 25 w=9.3848 (26)
New page
My 780.5689
T 21 26 w=9.3848 (27)
New page
T 21 27 w=9.3848 (28)
New page
T 21 28 w=9.3848 (29)
New page
T 22 19 w=9.3848 (30)
New page
My 780.6177
T 22 20 w=9.3848 (31)
New page
My 780.5689
T 22 21 w=9.3848 (32)
New page
T 22 22 w=9.3848 (33)
New page
My 780.6177
T 22 23 w=9.3848 (34)
New page
My 780.5689
T 22 24 w=9.3848 (35)
New page
My 780.6372
T 22 25 w=9.3848 (36)
New page
My 780.5689
T 22 26 w=9.3848 (37)
New page
T 22 27 w=9.3848 (38)
New page
T 22 28 w=9.3848 (39)
New page
My 780.6177
T 23 19 w=9.3848 (40)
New page
T 23 20 w=9.3848 (41)
New page
T 23 21 w=9.3848 (42)
New page
T 23 22 w=9.3848 (43)
New page
T 23 23 w=9.3848 (44)
New page
T 23 24 w=9.3848 (45)
New page
My 780.6372
T 23 25 w=9.3848 (46)
New page
My 780.6177
T 23 26 w=9.3848 (47)
New page
T 23 27 w=9.3848 (48)
New page
T 23 28 w=9.3848 (49)
New page
My 780.5689
T 24 19 w=9.3848 (50)
New page
My 780.6177
T 24 20 w=9.3848 (51)
End page
Finish
13 changes: 13 additions & 0 deletions tests/showframes.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
return function()
local plain = require "classes.plain"
local class = plain()
SILE.documentState.documentClass = class

class:loadPackage("frametricks")

SILE.call("showframe",{ id = "all"})
for i = 1, 50 do
SILE.call("supereject")
end

end

0 comments on commit 3478f38

Please sign in to comment.