Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Using an absolute path with the include macro under Linux works as expected and includes the target files contents. Specifying an absolute path on Windows fails to include target files contents and renders a hyperlink to the include file instead. Not sure if this is a bug or I am missing some key configuration know how? Environment:Windows:
and
Linux:
Test setup:Create two files in the same folder test.adoc (Windows version) include::C:\sample.adoc[] include::C:/sample.adoc[] include::sample.adoc[]test.adoc (Linux version) include::/sample.adoc[] sample.adoc this text was included from another file Test:Compile test.adoc under both Windows and Linux using the respective test.adoc file and the appropriate absolute path for your test folder. asciidoctor test.adoc Expected result:Linux = Successfully includes |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Welcome richard,
I don't think you're missing anything. I've been able to replicate this using the maven plugin but with some slight different behauviour. However, in my opinon it seems a bug related to how Ruby parses the string of the path, making it think it is not a file but an external link. The difference in my case is that `include::C:/sample.adoc[]`works fine. As a workarround, I would try to avoid using absolute paths and use relative instead. But if you need to, maybe using an URI format would be the more cross-platform solution. http://asciidoctor.org/docs/user-manual/#include-content-from-a-uri Both this options worked for me: include::file://localhost/c:/sample.adoc[] include::file:///c:/sample.adoc[] Note that you need to set the 'allow-uri-read' attribute. |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Thanks abelsromero for taking the time to replicate this and give such a detailed response. Really appreciate it. As a result of your answer I've been able to resolve our problem. However not as might be expected. The following is for anyone else who experiences similar problems: Background:Firstly, despite providing a command line example using MRI Ruby we are in fact a Java shop who have been building an in house documentation system that utilises AsciidoctorJ. I provided a command line example because after removing layer after layer of our own 'gaff' the same issue was present in the 'pure' command line, MRI Ruby version. This seemed the most suitable way to make an enquiry that would be universally clear and reproducible. SolutionBased on your confidence that the URI examples you provided worked I tried a number of things before coming to a solution that worked for us. I did not manage to get the command line Ruby example working but was able to get things working via the AsciidoctorJ API which is good enough for us. Under AsciidoctorJ the solution was:Attributes attributes = new Attributes(); ..... attributes.setAllowUriRead(true); //Solution .... Options options = new Options(); .... asciidoctor.renderFile(file, options); Method:
Hopefully my day of experimentation and abelsromero's good advice will help others who face a similar situation. |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Administrator
|
In reply to this post by abelsromero
On Thu, Sep 18, 2014 at 4:24 PM, abelsromero [via Asciidoctor :: Discussion] <[hidden email]> wrote: in my opinon it seems a bug related to how Ruby parses the string of the path, making it think it is not a file but an external link. You're absolutely right! The problem here is that the Windows path is being detected as a URI and therefore the logic for handling it is going down the wrong path. The UriSniffRx is too lose and is thus matching Windows paths such as c:\sample.adoc and c:/sample.adoc. The reason this problem made it through is due to a missing test. I'll fix it and add a test so we can be sure this won't happen again. |
Free forum by Nabble | Edit this page |