include file in tooltip

0 votes
asked Jul 31 in Question / help by Jason

I'm trying to create an SVG image with links in it such that I can click on the link to get the sample response body, or I can hover over the link to see a tooltip with the example response.  Here is the "code" I'm using:

note left
    response:
    [[get-response.json{!include get-response.json} example response]]
endnote

Doing this I see the text "!include get-response.json" in the tool-tip.  I tried using a !define like this, but got the same result:


!define get_response !include get-response.json
note left
response:
[[get-metadata-response.json{get_response} example response]]
endnote


Are there any other tricks I can use to accomplish my goal?
 

Thanks.
 

Jason

2 Answers

+1 vote
answered Jul 31 by plantuml (208,860 points)
 
Best answer
Well, I don't think it's possible right now.

But this would be a nice idea/feature so we will think about providing a way to do so.
commented Jul 31 by Jason
I thought that might be the case.  I'll keep an eye on the feature list to see if it is implemented.

Thanks for the quick reply, and your consideration of the feature.
0 votes
answered Aug 1 by plantuml (208,860 points)

By chance, there was another user that makes a request somehow close to yours (see https://forum.plantuml.net/9951/splicing-up-notes )

So now, with last beta, you can have :

@startuml
!function $json()
  foo1: dummy1
  foo2: dummy2
!endfunction

!function $get_response()
!return %retrieve_void_func("$json")
!endfunction

note left
response:
[[get-metadata-response.json{$get_response()} example response]]
endnote
@enduml

The %retrieve_void_func function calls the void function given in the first argument and return as a String the result of this void function.

So you can enhance this, assuming you have get-response.json and get-response2.json files in your local filesystem:

@startuml
!function $getFileContent($filename)
!include $filename
!endfunction

!function $get_response($file)
!return %retrieve_void_func("$getFileContent", $file)
!endfunction

start
note left
response:
[[get-metadata-response1.json{$get_response("get-response.json")} example response1]]
endnote
:next;
note right
response:
[[get-metadata-response2.json{$get_response("get-response2.json")} example response2]]
endnote
@enduml

This is a bit weird, but it works.

Is this what you were expecting ?

commented Aug 5 by Jason
Thanks for this info!  I'll give it a try today and see if I can get that to work for my needs.
...