Skip to content

Commit 043810b

Browse files
authored
Merge pull request #1031 from alerque/toc-bookmarks
2 parents ee8214e + 78a2b53 commit 043810b

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

classes/book.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ end, "Text to appear on the top of the right page")
9595

9696
SILE.registerCommand("book:sectioning", function (options, content)
9797
local level = SU.required(options, "level", "book:sectioning")
98-
SILE.call("increment-multilevel-counter", {id = "sectioning", level = level})
98+
SILE.call("increment-multilevel-counter", { id = "sectioning", level = level })
9999
if SU.boolean(options.toc, true) then
100-
SILE.call("tocentry", {level = level}, SU.subContent(content))
100+
SILE.call("tocentry", { level = level }, SU.subContent(content))
101101
end
102102
local lang = SILE.settings.get("document.language")
103103
if options.numbering == nil or options.numbering == "yes" then
@@ -107,7 +107,7 @@ SILE.registerCommand("book:sectioning", function (options, content)
107107
end
108108
SILE.call(options.prenumber)
109109
end
110-
SILE.call("show-multilevel-counter", {id="sectioning"})
110+
SILE.call("show-multilevel-counter", { id = "sectioning" })
111111
if options.postnumber then
112112
if SILE.Commands[options.postnumber .. ":" .. lang] then
113113
options.postnumber = options.postnumber .. ":" .. lang
@@ -133,7 +133,7 @@ SILE.registerCommand("chapter", function (options, content)
133133
SILE.call("open-double-page")
134134
SILE.call("noindent")
135135
SILE.scratch.headers.right = nil
136-
SILE.call("set-counter", {id = "footnote", value = 1})
136+
SILE.call("set-counter", { id = "footnote", value = 1 })
137137
SILE.call("book:chapterfont", {}, function ()
138138
SILE.call("book:sectioning", {
139139
numbering = options.numbering,

packages/pdf.lua

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@ local pdf = require("justenoughlibtexpdf")
66
SILE.registerCommand("pdf:destination", function (options, _)
77
local name = SU.required(options, "name", "pdf:bookmark")
88
SILE.typesetter:pushHbox({
9-
outputYourself = function (_, typesetter, _)
9+
outputYourself = function (_, typesetter, line)
1010
SILE.outputters.libtexpdf._init()
1111
local state = typesetter.frame.state
12-
local y = SILE.documentState.paperSize[2] - state.cursorY
13-
pdf.destination(name, state.cursorX:tonumber(), y:tonumber())
12+
typesetter.frame:advancePageDirection(-line.height)
13+
local x, y = state.cursorX, state.cursorY
14+
typesetter.frame:advancePageDirection(line.height)
15+
local _y = SILE.documentState.paperSize[2] - y
16+
pdf.destination(name, x:tonumber(), _y:tonumber())
1417
end
1518
})
1619
end)

0 commit comments

Comments
 (0)