Skip to content

GRAILS-8809 fix for relative image URLs on windows #395

Closed
wants to merge 1 commit into from
View
6 grails-docs/src/main/groovy/grails/doc/PdfBuilder.groovy
@@ -47,7 +47,9 @@ class PdfBuilder {
File htmlFile = new File(guideDir, "single.html")
File outputFile = new File(guideDir, "single.pdf")
- String xml = createXml(htmlFile, baseDir.absolutePath)
+ String base = baseDir.toPath().toUri().toString()
+ base += base.endsWith('/')?'':'/'
+ String xml = createXml(htmlFile, base)
createPdf xml, outputFile, guideDir
}
@@ -57,7 +59,7 @@ class PdfBuilder {
// fix inner anchors
xml = xml.replaceAll('<a href="\\.\\./guide/single\\.html', '<a href="')
// fix image refs to absolute paths
- xml = xml.replaceAll('src="\\.\\./img/', "src=\"file://${base}/img/")
+ xml = xml.replaceAll('src="\\.\\./img/', "src=\"${base}img/")
// convert tabs to spaces otherwise they only take up one space
xml = xml.replaceAll('\t', ' ')
Something went wrong with that request. Please try again.