Skip to content

Commit

Permalink
Merge 17f1350 into 914e00d
Browse files Browse the repository at this point in the history
  • Loading branch information
alerque committed Apr 4, 2023
2 parents 914e00d + 17f1350 commit 1b219eb
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 7 deletions.
8 changes: 6 additions & 2 deletions core/break.lua
Expand Up @@ -694,9 +694,13 @@ end

function lineBreak:dumpActiveRing()
local p = self.activeListHead
io.stderr:write("\n")
if not SILE.quiet then
io.stderr:write("\n")
end
repeat
if p == self.r then io.stderr:write("-> ") else io.stderr:write(" ") end
if not SILE.quiet then
if p == self.r then io.stderr:write("-> ") else io.stderr:write(" ") end
end
SU.debug("break", lineBreak:describeBreakNode(p))
p = p.next
until p == self.activeListHead
Expand Down
2 changes: 2 additions & 0 deletions core/cli.lua
Expand Up @@ -29,6 +29,7 @@ cli.parseArguments = function ()
cliargs:option("-p, --preamble=FILE", "process SIL, XML, or other content before the input document", {})
cliargs:option("-P, --postamble=FILE", "process SIL, XML, or other content after the input document", {})
cliargs:option("-u, --use=MODULE[[PARAMETER=VALUE][,PARAMETER=VALUE]]", "load and initialize a module before processing input", {})
cliargs:flag("-q, --quiet", "suppress warnings and informational messages during processing")
cliargs:flag("-t, --traceback", "display detailed location trace on errors and warnings")
cliargs:flag("-h, --help", "display this help, then exit")
cliargs:flag("-v, --version", "display version information, then exit", print_version)
Expand Down Expand Up @@ -122,6 +123,7 @@ cli.parseArguments = function ()
return summary(...) .. "\n\nRun with --traceback for more detailed trace leading up to errors."
end
SILE.errorHandler = opts.traceback and trace or identity
SILE.quiet = opts.quiet
SILE.traceback = opts.traceback
end

Expand Down
8 changes: 6 additions & 2 deletions core/sile.lua
Expand Up @@ -284,7 +284,9 @@ function SILE.processString (doc, format, filename, options)
inputter = SILE.inputter
else
format = format or detectFormat(doc, filename)
io.stderr:write(("<%s> as %s\n"):format(SILE.currentlyProcessingFile, format))
if not SILE.quiet then
io.stderr:write(("<%s> as %s\n"):format(SILE.currentlyProcessingFile, format))
end
inputter = SILE.inputters[format](options)
-- If we did content detection *and* this is the master file, save the
-- inputter for posterity and postambles
Expand Down Expand Up @@ -432,7 +434,9 @@ function SILE.finish ()
SILE.documentState.documentClass:finish()
SILE.font.finish()
runEvals(SILE.input.evaluateAfters, "evaluate-after")
io.stderr:write("\n")
if not SILE.quiet then
io.stderr:write("\n")
end
end

-- Internal libraries that run core SILE functions on load
Expand Down
2 changes: 2 additions & 0 deletions core/utilities.lua
Expand Up @@ -42,6 +42,7 @@ utilities.error = function(message, bug)
end

utilities.warn = function(message, bug)
if SILE.quiet then return end
io.stderr:write("\n! " .. message)
if SILE.traceback or bug then
io.stderr:write(" at:\n" .. SILE.traceStack:locationTrace())
Expand Down Expand Up @@ -105,6 +106,7 @@ utilities.deprecated = function (old, new, warnat, errorat, extra)
end

utilities.debug = function (category, ...)
if SILE.quiet then return end
if utilities.debugging(category) then
local inputs = table.pack(...)
for i, input in ipairs(inputs) do
Expand Down
4 changes: 3 additions & 1 deletion packages/folio/init.lua
Expand Up @@ -10,7 +10,9 @@ end
function package:outputFolio (frame)
if not frame then frame = "folio" end
local folio = self.class.packages.counters:formatCounter(SILE.scratch.counters.folio)
io.stderr:write("[" .. folio .. "] ")
if not SILE.quiet then
io.stderr:write("[" .. folio .. "] ")
end
if SILE.scratch.counters.folio.off then
if SILE.scratch.counters.folio.off == 2 then
SILE.scratch.counters.folio.off = false
Expand Down
6 changes: 4 additions & 2 deletions sile.in
Expand Up @@ -82,7 +82,7 @@ io.stdout:setvbuf 'no'

SILE.cli:parseArguments()

if not os.getenv 'LUA_REPL_RLWRAP' then
if not os.getenv 'LUA_REPL_RLWRAP' and not SILE.quiet then
io.stderr:write(SILE.full_version .. '\n')
end

Expand All @@ -109,7 +109,9 @@ if SILE.masterFilename then

-- Deprecated, notice given in core.cli when argument used
for _, path in ipairs(SILE.input.includes) do
io.stderr:write("Loading "..path.."\n")
if not SILE.quiet then
io.stderr:write("Loading "..path.."\n")
end
local c = SILE.resolveFile(path, "classes")
if c then
SILE.processFile(c)
Expand Down

0 comments on commit 1b219eb

Please sign in to comment.