Work around AsciiDoctor problem with absolute path includes on Windows

There's a bug in AsciiDoctor that causes it to handle includes of
absolute paths on Windows incorrectly. This results in the included
document being linked to rather than being included inline in the
document. See [1] for more details.

This commit introduces a work around for the problem. Rather than
using a file path for the includes a URI is now used instead. To
allow the URIs to be read the allow-uri-read attribute is also set.
See [2] for details of the work around.

Closes gh-1

[1] https://github.com/asciidoctor/asciidoctor/issues/1144
[2] http://discuss.asciidoctor.org/Including-a-file-using-an-absolute-path-under-Windows-1-5-0-tp2244p2245.html
This commit is contained in:
Andy Wilkinson
2014-11-13 14:43:29 +00:00
parent 5ccd7365cb
commit bd9597a933

View File

@@ -59,7 +59,8 @@ class RestDocumentationPlugin implements Plugin<Project> {
sourceDir = project.file 'src/documentation/asciidoc'
options = [
attributes: [
generated: "$project.buildDir/generated-documentation"
generated: new File("$project.buildDir/generated-documentation").toURI().toURL(),
'allow-uri-read': true
]
]
inputs.files restDocumentationSnippets.outputs.files