Merge pull request #294 from zupzup/images_in_asciidoc
Issue #293: fix images in asciidoc by setting backend to xhtml
This commit is contained in:
commit
bfe06f9026
@ -45,6 +45,7 @@ import java.io.InputStream;
|
||||
import java.io.StringWriter;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import static org.asciidoctor.Asciidoctor.Factory.create;
|
||||
@ -83,7 +84,7 @@ public class AsciiDoctorTemplateResolver extends TemplateResolver {
|
||||
if (adocFile.isPresent()) {
|
||||
try (FileReader reader = new FileReader(adocFile.get().toFile())) {
|
||||
StringWriter writer = new StringWriter();
|
||||
asciidoctor.convert(reader, writer, Maps.newHashMap());
|
||||
asciidoctor.convert(reader, writer, createAttributes());
|
||||
return new ByteArrayInputStream(writer.getBuffer().toString().getBytes());
|
||||
}
|
||||
}
|
||||
@ -94,6 +95,16 @@ public class AsciiDoctorTemplateResolver extends TemplateResolver {
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, Object> createAttributes() {
|
||||
Map<String, Object> attributes = Maps.newHashMap();
|
||||
attributes.put("backend", "xhtml");
|
||||
|
||||
Map<String, Object> options = Maps.newHashMap();
|
||||
options.put("attributes", attributes);
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
private Optional<Path> find(Path path, String resourceName) throws IOException {
|
||||
return Files.walk(path)
|
||||
.filter(Files::isRegularFile)
|
||||
|
Loading…
x
Reference in New Issue
Block a user