Currently, the only format that properly supports the idx parameter is base64. All other formats only let you select which image you want to export from the first multi-image diagram.
So if you have:
@startuml
class a
newpage
class b
@enduml
And POST it to /svg/1, you do get a class b in the output.
But if you have:
@startuml
class a
@enduml
@startuml
class b
@enduml
POSTing that to /svg/1 results in a class a. But POSTing it to /base64/1 does result in class b correctly.
This is unfortunate, since it makes exporting diagrams that use @startdef in svg completely impossible, since the @startdef always has to come first. To fix the issue, I have partially copied some of this code: https://github.com/plantuml/plantuml/blob/21461b83fc96a733f6879f18a7f0687d6e2ce456/src/net/sourceforge/plantuml/SourceStringReader.java#L154-L177 The solution is a little bit different from the base64 case, returning a 400 result, if the requested image index doesn't exist. Base64 returns 200 with an empty image, which I didn't change, but I think a 400 is more appropriate here.
Currently, the only format that properly supports the
idx
parameter is base64. All other formats only let you select which image you want to export from the first multi-image diagram.So if you have:
And POST it to
/svg/1
, you do get aclass b
in the output.But if you have:
POSTing that to
/svg/1
results in aclass a
. But POSTing it to/base64/1
does result inclass b
correctly.This is unfortunate, since it makes exporting diagrams that use
@startdef
in svg completely impossible, since the@startdef
always has to come first. To fix the issue, I have partially copied some of this code: https://github.com/plantuml/plantuml/blob/21461b83fc96a733f6879f18a7f0687d6e2ce456/src/net/sourceforge/plantuml/SourceStringReader.java#L154-L177 The solution is a little bit different from the base64 case, returning a 400 result, if the requested image index doesn't exist. Base64 returns 200 with an empty image, which I didn't change, but I think a 400 is more appropriate here.