fix(presets): add --failure-level ERROR to asciidoctor, add clean to typst/pdflatex/tectonic, skip auto-open on one-shot compile (#35)

Problem: asciidoctor exits 0 on errors so error_parser never ran.
typst, pdflatex, and tectonic had no clean subcommand. auto-open
fired on :Preview compile, surprising users who just want a build.

Solution: pass --failure-level ERROR in asciidoctor args. Add clean
commands to typst (rm pdf), pdflatex (rm pdf/aux/log/synctex.gz),
and tectonic (rm pdf). Gate auto-open on not opts.oneshot so it
only fires during toggle/watch mode.
This commit is contained in:
Barrett Ruth 2026-03-04 14:57:36 -05:00 committed by GitHub
parent d4e7d8c2fd
commit 68e2e82232
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 30 additions and 6 deletions

View file

@ -33,6 +33,10 @@ describe('presets', function()
assert.are.equal('/tmp/document.pdf', output)
end)
it('returns clean command', function()
assert.are.same({ 'rm', '-f', '/tmp/document.pdf' }, presets.typst.clean(ctx))
end)
it('has open enabled', function()
assert.is_true(presets.typst.open)
end)
@ -189,8 +193,16 @@ describe('presets', function()
assert.is_true(presets.pdflatex.open)
end)
it('has no clean command', function()
assert.is_nil(presets.pdflatex.clean)
it('returns clean command removing pdf and aux files', function()
local clean = presets.pdflatex.clean(tex_ctx)
assert.are.same({
'rm',
'-f',
'/tmp/document.pdf',
'/tmp/document.aux',
'/tmp/document.log',
'/tmp/document.synctex.gz',
}, clean)
end)
it('has no reload', function()
@ -240,8 +252,8 @@ describe('presets', function()
assert.is_true(presets.tectonic.open)
end)
it('has no clean command', function()
assert.is_nil(presets.tectonic.clean)
it('returns clean command removing pdf', function()
assert.are.same({ 'rm', '-f', '/tmp/document.pdf' }, presets.tectonic.clean(tex_ctx))
end)
it('has no reload', function()
@ -467,7 +479,7 @@ describe('presets', function()
it('returns args with file and output', function()
assert.are.same(
{ '/tmp/document.adoc', '-o', '/tmp/document.html' },
{ '--failure-level', 'ERROR', '/tmp/document.adoc', '-o', '/tmp/document.html' },
presets.asciidoctor.args(adoc_ctx)
)
end)