From bd9597a9339aa59d79526d3fadf28958c3653ef9 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Thu, 13 Nov 2014 14:43:29 +0000 Subject: [PATCH] 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 --- .../restdocs/gradle/RestDocumentationPlugin.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spring-restdocs-gradle-plugin/src/main/groovy/org/springframework/restdocs/gradle/RestDocumentationPlugin.groovy b/spring-restdocs-gradle-plugin/src/main/groovy/org/springframework/restdocs/gradle/RestDocumentationPlugin.groovy index 9093b8a6..abfdd8c2 100644 --- a/spring-restdocs-gradle-plugin/src/main/groovy/org/springframework/restdocs/gradle/RestDocumentationPlugin.groovy +++ b/spring-restdocs-gradle-plugin/src/main/groovy/org/springframework/restdocs/gradle/RestDocumentationPlugin.groovy @@ -59,7 +59,8 @@ class RestDocumentationPlugin implements Plugin { 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