ggrossetie / asciidoctor-web-pdf

Convert AsciiDoc documents to PDF using web technologies
https://asciidoctor.org
MIT License
443 stars 90 forks source link

--failure-level ERROR argument does not work #613

Open siaccarino opened 2 years ago

siaccarino commented 2 years ago

Hello,

Expected:

--failure-level argument behaves like in Asciidoctor.js

Observed:

--failure-level ERROR does NOT lead to an exit code != 0 even on build errors

Version:

Asciidoctor Web PDF 1.0.0-alpha.14 using Asciidoctor.js 2.2.6 (Asciidoctor 2.0.17) [https://asciidoctor.org]

Ninja build log with asciidoctor-web-pdf :

[build] [1/1 100% :: 5.820] cd release_plan && asciidoctor-web-pdf index_pdf.adoc --failure-level ERROR -r asciidoctor-kroki -a stylesheet="+/shared_parts/styles_pdf.css,/shared_parts/styles_common.css" -a webfonts! -D release_plan -o release_plan.pdf [build] asciidoctor: ERROR: revisions.adoc: line 8: include file not found: revisions/r_0_1_0.adoc [build] Build finished with exit code 0

Ninja build log with asciidoctor.js:

[build] [1/1 100% :: 0.575] cd release_plan && asciidoctor index.adoc -r asciidoctor-kroki -D build -b xhtml5 -a webfonts! -a linkcss -a copycss --failure-level ERROR [build] FAILED: build/index.html [build] cd release_plan && asciidoctor index.adoc -r asciidoctor-kroki -D build -b xhtml5 -a webfonts! -a linkcss -a copycss --failure-level ERROR [build] asciidoctor: ERROR: revisions.adoc: line 8: include file not found: revisions/r_0_1_0.adoc [build] ninja: build stopped: subcommand failed. [build] Build finished with exit code 1

siaccarino commented 2 years ago
blob@babble:~/xyz$ asciidoctor-web-pdf --help
asciidoctor-web-pdf [files...]

Options:
  ... cut come lines ...
      --failure-level     set minimum logging level that triggers non-zero exit code
  [choices: "info", "INFO", "warn", "WARN", "warning", "WARNING", "error", "ERROR", "fatal", "FATAL"] [default: "FATAL"]

Why is it an improvement if a function that is show in help works as expected? I don't want to make pressure - just want to understand - if the help does not tell the truth what else is not there?

ggrossetie commented 2 years ago

Asciidoctor Web PDF inherits from the Asciidoctor CLI (https://github.com/asciidoctor/asciidoctor-cli.js) mainly to avoid duplication but this feature is not implemented/supported.

Arguably it could be a "bug" but I don't know how to implement it that's why I'lm using "improvement" because we need to define the behavior of this option in this context.

I could also treat it as a bug and remove the option from the --help (since it's not supported and I don't know how to support it) but I don't think that's what you are asking 😉

siaccarino commented 2 years ago

Thanks, what about cherry-picking the failure-level implementation revision from asciidoc.js so that at least the asciidoc rendering part is covered?