]> sipb.mit.edu Git - ikiwiki.git/blob - doc/bugs/Problems_with_graphviz.pm_plug-in_previews.mdwn
(no commit message)
[ikiwiki.git] / 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     <div id="content">
32     <p><img src="./graph-c9fd2a197322feb417bdedbca5e99f5aa65b3f06.png" /></p>
33     
34     </div>
35
36 >>> preview contains
37
38     <div id="preview">
39     <p><img src="./demo/diagrams/graph-c9fd2a197322feb417bdedbca5e99f5aa65b3f06.png" /></p>
40     
41     </div>
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]]
47
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. 
51 >>>>
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]]