@@ -3,7 +3,8 @@ package com.bitjourney.plantuml
33import com.github.benmanes.caffeine.cache.Caffeine
44import com.github.benmanes.caffeine.cache.LoadingCache
55import com.google.gson.JsonObject
6- import net.sourceforge.plantuml.Option
6+ import net.sourceforge.plantuml.FileFormat
7+ import net.sourceforge.plantuml.FileFormatOption
78import net.sourceforge.plantuml.SourceStringReader
89import net.sourceforge.plantuml.code.TranscoderSmart
910import net.sourceforge.plantuml.dot.GraphvizUtils
@@ -80,7 +81,7 @@ class Main {
8081
8182 // NOTE: Remove "skinparam monochrome true" for a while because it lets "SALT" to cause errors :(
8283 // val defaultConfig: List<String> = Arrays.asList()
83- val option = Option ( " -tsvg " )
84+ val fileFormat = FileFormat . SVG
8485
8586 val loader: LoadingCache <DataSource , ByteArray > = Caffeine .newBuilder()
8687 .maximumWeight(50 * 1024 * 1024 ) // about 50MiB
@@ -150,15 +151,15 @@ class Main {
150151 fun renderToResponse (source : String , response : Response ) {
151152 response.type(" image/svg+xml" )
152153
153- val svg = loader.get(DataSource (source, option ))!!
154+ val svg = loader.get(DataSource (source, fileFormat ))!!
154155 response.header(" Content-Length" , svg.size.toString())
155156 response.raw().outputStream.write(svg)
156157 }
157158
158159 fun render (data : DataSource ): ByteArray {
159- val renderer = SourceStringReader (data.option.defaultDefines, data. source, data.option.config )
160+ val renderer = SourceStringReader (data.source)
160161 val outputStream = ByteArrayOutputStream ()
161- renderer.outputImage(outputStream, data.option.fileFormatOption )
162+ renderer.outputImage(outputStream, FileFormatOption ( data.fileFormat) )
162163 return outputStream.toByteArray()
163164 }
164165
0 commit comments