Skip to content

Commit

Permalink
fix: Handle documents on STDIN in SILE v0.14.11
Browse files Browse the repository at this point in the history
  • Loading branch information
alerque committed Dec 7, 2023
1 parent b6ed68a commit 31962a4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
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(pl.path.normpath(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(pl.path.normpath(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(pl.path.normpath(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

0 comments on commit 31962a4

Please sign in to comment.