asciidoctor-gradle-plugin icon indicating copy to clipboard operation
asciidoctor-gradle-plugin copied to clipboard

Inconsistend values for docdir and docfile attributes

Open childen opened this issue 5 years ago • 2 comments

I am trying to migrate a large documentation project from the old (1.5) to the new gradle plugin (>2.0). The project uses file relative includes in most places. To avoid changing to much I tried using the docdir attribute to get file relative includes to work again.

Unfortunately the docdir attribute seems to be set to the sourceDir defined in the gradle build. The docfile attribute seems to be set correctly.

Current behavior (for example):

asciidoctor {
  sourceDir = file('[...]Documentation/UserGuide/docs')
}

docfile => [...]Documentation/UserGuide/docs/DocumentationGuidelines/AsciidocTricks.adoc docdir => [...]Documentation/UserGuide/docs

If I understand the documentation correctly the docdir should be [...]Documentation/UserGuide/docs/DocumentationGuidelines.

I also tried using baseDirFollowsSourceDir().

childen avatar Dec 09 '19 10:12 childen

docdir is never set directlry. to_dir however is set as an option, but to_file only if the user supplies it. https://github.com/asciidoctor/asciidoctor-gradle-plugin/blob/a4507c00eb50d2e807f89105acab788ebf97a002/asciidoctor-gradle-jvm/src/main/groovy/org/asciidoctor/gradle/remote/ExecutorBase.groovy#L78

You can also try to use {includedir}.

ysb33r avatar Dec 09 '19 11:12 ysb33r

I am sorry I have to ask again, but I am not sure I undestand your comment.

For me docdir seems to be set to an unexpected value. If this is not done by the gradle plugin it is a bug in asciidoctor, correct?

I am not sure about the to_dir and to_file options. In what way do they influence the includes and available attributes? Shouldn't they only influence the location where the generated files are saved?

childen avatar Dec 09 '19 12:12 childen