Skip to content

Fixes #1135. Target file name should be relative to destination dir i… #1137

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

Merged

Conversation

robertpanzer
Copy link
Member

…f source dir is given.

Thank you for opening a pull request and contributing to AsciidoctorJ!

Please take a bit of time giving some details about your pull request:

Kind of change

  • Bug fix
  • New non-breaking feature
  • New breaking feature
  • Documentation update
  • Build improvement

Description

What is the goal of this pull request?
When giving asciidoctor a source dir and a destination dir, source files are created relative to the destination dir instead of flat, i.e. srcdir/a/b/index.adoc should be converted to destinationdir/a/b/index.html instead of destinationdir/index.html.

AsciidoctorJ currently does not do that, this PR tries to fix this.

How does it achieve that?

Similar to how Asciidoctor does, the "invoker" checks if the source file is relative to the srcdir option and then relativizes the path.

Are there any alternative ways to implement this?

Are there any implications of this pull request? Anything a user must know?

Issue

If this PR fixes an open issue, please add a line of the form:

Fixes #1135

For now this is WIP, I need to test what this change means for linked resources etc.

@robertpanzer robertpanzer removed the wip label Jan 15, 2023
@robertpanzer
Copy link
Member Author

Added a test and fixed the special case where the srcDir is ..

I consider this as a breaking change, hence this should not go into the 2.x line.

@robertpanzer
Copy link
Member Author

Another option to solve this might be to directly create a Ruby Asciidoctor::Cli::Invoker with the parsed options, and then call invoke!.
Iirc @mojavelinux asked for that in the past a couple of times already, maybe now is the time to do it.

That should be a separate effort though.
I'll merge this for now, and check in another PR whether I can change the AsciidoctorJ CLI to reuse the Asciidoctor CLI.

@robertpanzer robertpanzer merged commit 5773b9b into asciidoctor:main Jan 22, 2023
@robertpanzer robertpanzer deleted the fix-cli-relative-files-to-srcdir branch January 22, 2023 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Behaves differently to asciidoctor command when converting a directory
1 participant