Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle documents on STDIN and/or via Lua 5.1 #69

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/resilient/styles/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ end

function package:readStyles ()
local yaml = require("resilient-tinyyaml")
local fname = SILE.masterFilename .. '-styles.yml'
local basename = pl.path.splitext(SILE.input.filenames[1])
local fname = basename .. '-styles.yml'
local styfile, _ = io.open(fname)
if not styfile then
SILE.scratch.styles.loaded = {}
Expand Down Expand Up @@ -136,7 +137,8 @@ function package.writeStyles () -- NOTE: Not called as a package method (invoked
end

local stydata = tableToYaml(SILE.scratch.styles.specs)
local fname = SILE.masterFilename .. '-styles.yml'
local basename = pl.path.splitext(SILE.input.filenames[1])
local fname = basename .. '-styles.yml'
SU.debug("resilient.styles", "Writing style file", fname, ":", count, "new style(s)")
local styfile, err = io.open(fname, "w")
if not styfile then return SU.error(err) end
Expand Down
6 changes: 4 additions & 2 deletions packages/resilient/tableofcontents/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ end

function package.writeToc (_)
local tocdata = pl.pretty.write(SILE.scratch.tableofcontents)
local tocfile, err = io.open(SILE.masterFilename .. '.toc', "w")
local basename = pl.path.splitext(SILE.input.filenames[1])
local tocfile, err = io.open(basename .. '.toc', "w")
if not tocfile then return SU.error(err) end
tocfile:write("return " .. tocdata)
tocfile:close()
Expand All @@ -115,7 +116,8 @@ function package.readToc (_)
-- already loaded
return SILE.scratch._tableofcontents
end
local tocfile, _ = io.open(SILE.masterFilename .. '.toc')
local basename = pl.path.splitext(pl.path.normpath(SILE.input.filenames[1]))
local tocfile, _ = io.open(basename .. '.toc')
if not tocfile then
return false -- No TOC yet
end
Expand Down