split two graphviz bugs from one page; undo one of them
[ikiwiki] / doc / bugs / Problems_with_graphviz.pm_plug-in_previews.mdwn
1 (split from [[Problems_with_graphviz.pm_plug-in]])
2
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.
4
5 >> Here is an updated patch againt ikiwiki-2.5:
6
7 >>> Applied, thanks. --[[Joey]]
8
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 (\%) {
12                 }
13         }
14      
15     -   return "<img src=\"".urlto($dest, $params{page})."\" />\n";
16     +   if ($params{preview}) {
17     +           return "<img src=\"".urlto($dest, "")."\" />\n";
18     +   }
19     +   else {
20     +           return "<img src=\"".urlto($dest, $params{page})."\" />\n";
21     +   }
22      }
23      
24      sub graph (@) {
25
26
27 >> --[[HenrikBrixAndersen]]
28
29 >>> Despite this patch I am still experiencing the problem. Normal page source for a graph contains:
30
31     &lt;div id="content"&gt;
32     &lt;p&gt;&lt;img src="./graph-c9fd2a197322feb417bdedbca5e99f5aa65b3f06.png" /&gt;&lt;/p&gt;
33     
34     &lt;/div&gt;
35
36 >>> preview contains
37
38     &lt;div id="preview"&gt;
39     &lt;p&gt;&lt;img src="./demo/diagrams/graph-c9fd2a197322feb417bdedbca5e99f5aa65b3f06.png" /&gt;&lt;/p&gt;
40     
41     &lt;/div&gt;
42
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]]