Skip to content
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

Destination directory ignored in Asciidoctorj #853

Closed
ccleve opened this issue Oct 1, 2019 · 6 comments · Fixed by #1153 or #1154
Closed

Destination directory ignored in Asciidoctorj #853

ccleve opened this issue Oct 1, 2019 · 6 comments · Fixed by #1153 or #1154

Comments

@ccleve
Copy link

ccleve commented Oct 1, 2019

In Java:

Options options = new Options();
options.setDestinationDir("../foo/");
asciidoctor.convertFile(new File("./docs/userguide.adoc"), options);

Does not place the output in ../foo. It produces it in-place.

If I add options.setInPlace(false); it has no effect.

I'm using Asciidoctorj 2.1.0.

@mojavelinux mojavelinux transferred this issue from asciidoctor/asciidoctor Oct 1, 2019
@robertpanzer
Copy link
Member

It looks like the destination_dir option is only evaluated by the Asciidoctor CLI which puts the value into the to_dir option.
Using options.setToDir("../foo") seems to do the trick.
Also please set the safe mode to avoid security errors.

@adaussy
Copy link

adaussy commented Oct 10, 2019

Yes I can confirm that options.setInPlace(false) seems to be broken in 2.1.0

@hoxu
Copy link

hoxu commented Aug 5, 2020

Would be nice if this was documented in the README.

@abelsromero
Copy link
Member

I'm nore inclined to understand what should be the expected behauviour and if it makes sense to keep that if the same can be achieved with another option.

/cc @mojavelinux any suggestion for this one and #941?

@mojavelinux
Copy link
Member

It seems like there are two options, one of which is ignored. I would pick one and deprecate the other. And, according to Robert, options.setToDir("../foo") is the one that works. So perhaps stick with that one.

The :to_dir option is documented here: https://asciidoctor.org/docs/user-manual/#ruby-api-options

The Ruby API has no :destination_dir option.

@robertpanzer
Copy link
Member

Agreed.
I am not sure right now how that method made it into AsciidoctorJ.
A fix would be to "redirect" it to the same option that the Asciidoctor and AsciidoctorJ CLI do.

But as Asciidoctor also does not seem to support this option via the API, I think it would be best to not "fix" this in AsciidoctorJ, but instead keep the current – admittedly useless – behavior, and tell users to use the toDir option (and sourceDirwhich is also set by the AsciidoctorJ CLI right now)

abelsromero added a commit to abelsromero/asciidoctorj that referenced this issue Mar 30, 2023
The option only is used for the CLI, in that case
the value is redirected to 'to_dir'.

Fixes asciidoctor#853
Fixes asciidoctor#941
abelsromero added a commit to abelsromero/asciidoctorj that referenced this issue Mar 30, 2023
The option only is used for the CLI, in that case
the value is redirected to 'to_dir'.

Fixes asciidoctor#853
Fixes asciidoctor#941
abelsromero added a commit to abelsromero/asciidoctorj that referenced this issue Mar 30, 2023
The option only is used for the CLI, in that case
the value is redirected to 'to_dir'.

Fixes asciidoctor#853
Fixes asciidoctor#941
abelsromero added a commit to abelsromero/asciidoctorj that referenced this issue Mar 30, 2023
Fix option to set ToDir internally.
Deprecate destinationDir in Options and OptionsBuilder.
Add JavaDoc pointing users to use toDir.

Fixes asciidoctor#853
Fixes asciidoctor#941
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants