Closed alberto0723 closed 7 months ago
Sounds like something wrong with the imagemap functionality.
Can you share an example of the wikitext for a diagram that this is happening with?
Something simple like this already generates the problem. It is not related to the complexity of the graph.
<graphviz border='frame' format='svg'>
digraph MyDiagram {
MyNode [label="Label", URL="#Section"];
}
</graphviz>
=Section=
This is some text that I change without modifying the graph.
Not sure if this is the same problem, but looks related.
<graphviz border='frame' format='svg'>
digraph OneDiagram {
MyNode [label="Label", URL="#Section"];
}
</graphviz>
<graphviz border='frame' format='svg'>
digraph AnotherDiagram {
OtherNode [label="OtherLabel", URL="#Section"];}
</graphviz>
=Section=
The URL of the first graph never works.
It looks like the imagemap data is not being cached at all.
To me it rather looks that the imagemap will only work as long the page remains in the Parser Cache. See also my description the the Talk page of the extension under https://www.mediawiki.org/wiki/Topic:Xjluxsew16svfii6
Yeah, that's right. I'm sorry I've been slow to work on this! I think the image map data should either be saved as a file as well, or saved to the wan cache (prob the latter, although I guess for large diagrams there could be a size issue).
I implemented a solution for this, which stores the image map in a separate file in the LocalRepo also used for the diagram images.
My solution definitely needs an improvement: I was unable to find out how to correctly read contents of a file in the LocalRepo, so I statically added the file system path. I guess this is definitely the wrong way to do it, though it seems to work for my installation.
Anyway, I have no idea how to correctly create a pull request.
If you want to just copy and past your work into a gist that'd be fine.
And you're right, the file path does need to be done via the FileRepo, otherwise it won't work for wikis using other repos (such as the AWS extension).
I've done a little bit of looking at this, and might have a fix for it.
I think this is resolved now. Can you test with the latest, before I tag a release?
Looks good to me, thanks a lot! (The bug I seemed to have found was my mistake, it really works well!)
@tomzu great! I wonder if the bug you found was for an existing image where the first time round it failed to store the imagemap data, but then when you modified the graphviz code it rendered a new image and new data and so worked correctly?
I think a small improvement can be made to make it work in the former situation.
I think all is good here now.
Thanks a lot for the nice work!!!
The diagrams with URL in the nodes are properly created and stored in the diagrams directory with the active URLs. However, there is some weird behavior and sometimes the URLs are not recognized from the wiki page (although they are in the png or svg file). I associate this behavior to: 1) The existence of more than one diagram in the same wiki page 2) Modifying the page, but not the diagram (making some change in the diagram and recreating the file enables the URLs in the wiki again)