-
Notifications
You must be signed in to change notification settings - Fork 172
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
CLI should set :mkdirs option by default #1241
Comments
Yep, that looks like the same issue. Since :mkdirs wasn't mentioned, it wasn't coming up in my search of the issue tracker or CHANGELOG. I definitely consider this to be a bug, not a breaking change. For one, the current behavior doesn't match the behavior of asciidoctor, so there's an expectation that it should work. To me, fixing that discrepancy is not a breaking change. If anything, it will unbreak things. Speaking of which, this issue is preventing AsciidoctorJ from being used with the Antora PDF extension, which requires the command to be able to write to a directory that doesn't yet exist. On top of that, most applications I know of will create missing directories when writing to a file (for example, the libreoffice command). Interesting to note that pandoc will not, but that seems like an outlier. My recommendation is to move forward with putting this fix in the 2.5.x line. |
… should be relative to destination dir if source dir is given.
I created #1242 with a fix on the v2.5.x. If possible, could you also check if the breaking changes in the current changelog of the main branch are really breaking changes or should be backported to v2.5.x? (Obviously I need to update it to move this bug fix out of the breaking changes). |
Thanks!
I try not to overthink it. The way I look at it, if it requires users to change their code to avoid their code/logic from breaking, that's a breaking change. If we are fixing something that should have worked, that's not a breaking change, which is the case here. What this change does is allows something that didn't work before to start working. It's impossible (read as: extremely unlikely) that will break existing logic. The only non-breaking change that is listed as a breaking change is this one:
Unless that change causes a compilation change, I don't see how it's breaking. Technically, changing the |
That is an API change in the extension API, so it requires even a code change for existing extensions. |
Thanks for going through the change log! ❤️ |
Setting the option :mkdirs should be fixed in 2.5.11. |
To be consistent with the CLI from the asciidoctor gem (
asciidoctor
), the AsciidoctorJ CLI should set themkdirs
option by default. Enabling this option allows the output file to be written to a directory which does not yet exist. The CLI has no other way of controlling this behavior, so the option should be on by default.Right now, the following example will fail:
However, the same command will succeed when using
asciidoctor
.Here's the code in the Asciidoctor CLI that enables this option: https://github.com/asciidoctor/asciidoctor/blob/fd0e92a78b18e974a567b0ef798d99bbbb8c6acc/lib/asciidoctor/cli/invoker.rb#L96-L104
The text was updated successfully, but these errors were encountered: