Issue
I am new to ASCIIDOC and just wanted to know WHERE the following problem comes from.
Setup:
- Intellij with the neweset ASCIIDOC-Plugin
- neweset asciidoctor-maven-plugin with
preserveDirectories = true
I organized my asciidocs like this:
- footer.adoc
- header.adoc
- index.adoc
- subfolder
- index.adoc
generated-docs looks like this:
- footer.html
- header.html
- index.html
- subfolder
- index.html
Now, if I want the subfolder/index.html to include header & footer too, I thought I need to write include::../header.adoc[]
into the adoc-file which is no problem for the Intellij-Plugin. But in the generated html you will find following error:
<p>Unresolved directive in index.adoc - include::../header.adoc[]</p>
So when I write the following into the adoc-file: include::header.adoc[]
the generated html is happy but the Intellij ASCIIDOC plugin shows an error:
Unresolved directive in <stdin> - include::header.adoc[]
I am just wondering if this is a bug for the Intellij Plugin-Team or for the Maven-Plugin-Team. Or maybe someone has a workaround this problem?
And a little bonus question: Is it possible to configure the maven plugin to not generate header-/footer.htmls since they are already included into the actual htmls?
Solution
I have no experience with the maven plugin, but I do have lots of experience with AsciiDoc, the IntelliJ Plugin and the Gradle plugin.
The IntelliJ Plugin behaviour is correct. When you convert /subfolder/index.adoc
, the includes are resolved relative to this file, so the include include::../header.adoc
is correct.
You describe that you don't specify which file to render for the maven plugin (header.adoc
is converted). This might be the problem with the maven plugin:
You just specify the source path and all documents are rendered relative to this source path and hence the /subfolder/index.adoc
has the wrong source path.
With the Gradle plugin, you cann specify all documents to be converted. This would also avoid getting header.adoc
converted. From the maven plugin docs I see that you can specify only a single file.
With this in mind, I would suggest to change your file structure in such a way that you have all the files to be converted in one folder. You can then specify this folder and the other files should not be converted. This also shoul dresolve your problem with the relative path name:
/src/docs/
|
+-common/
| |
| +-header.adoc
| +-footer.adoc
+-chapters/
+-main/
|
+-index1.adoc
+-index2.adoc
Answered By - rdmueller
Answer Checked By - David Marino (JavaFixing Volunteer)