1 (split from [[Problems_with_graphviz.pm_plug-in]])
3 [graphviz] generates image URLs relative to the page being rendered, which means the URLs wont work when previewing a graph from the CGI script.
5 >> Here is an updated patch againt ikiwiki-2.5:
7 >>> Applied, thanks. --[[Joey]]
9 --- IkiWiki/Plugin/graphviz.pm.orig 2007-07-27 11:35:05.000000000 +0200
10 +++ IkiWiki/Plugin/graphviz.pm 2007-07-27 11:36:02.000000000 +0200
11 @@ -69,7 +69,12 @@ sub render_graph (\%) {
15 - return "<img src=\"".urlto($dest, $params{page})."\" />\n";
16 + if ($params{preview}) {
17 + return "<img src=\"".urlto($dest, "")."\" />\n";
20 + return "<img src=\"".urlto($dest, $params{page})."\" />\n";
27 >> --[[HenrikBrixAndersen]]
29 >>> Despite this patch I am still experiencing the problem. Normal page source for a graph contains:
32 <p><img src="./graph-c9fd2a197322feb417bdedbca5e99f5aa65b3f06.png" /></p>
39 <p><img src="./demo/diagrams/graph-c9fd2a197322feb417bdedbca5e99f5aa65b3f06.png" /></p>
43 >>> I don't quite understand why, this makes sense from the CGI path (in my
44 >>> case from the root of the site). The browsers appear to be trying to fetch
45 >>> `/demo/diagrams/demo/diagrams/graph-c9fd2a197322feb417bdedbca5e99f5aa65b3f06.png`
46 >>> (i.e., prepending the required relpath twice). -- [[Jon]]
48 >>>> Yeah, that patch may have been right once, but it's wrong now;
49 >>>> preview mode uses `<base>` to make urls work the same as they would
50 >>>> when viewing the html page.
52 >>>> Perhaps this was not noticed for a while while because it only
53 >>>> shows up if previewing an *unchanged* graph on a page that has already
54 >>>> been built before. Fixed now. [[done]] --[[Joey]]