]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
Give graph an optional "file" param, like table's.
authorAmitai Schleier <schmonz-web-ikiwiki@schmonz.com>
Mon, 22 Oct 2018 04:24:59 +0000 (00:24 -0400)
committerAmitai Schleier <schmonz-web-ikiwiki@schmonz.com>
Mon, 22 Oct 2018 04:24:59 +0000 (00:24 -0400)
IkiWiki/Plugin/graphviz.pm
doc/ikiwiki/directive/graph.mdwn

index d4018edaaf9dad384818488356a3e7e8c4d8841c..479da6f7382c41e664297a3ef22e665fc4cd5812 100644 (file)
@@ -95,6 +95,14 @@ sub render_graph (\%) {
 sub graph (@) {
        my %params=@_;
 
+       if (exists $params{file}) {
+               if (! exists $pagesources{$params{file}}) {
+                       error gettext("cannot find file");
+               }
+               $params{src} = readfile(srcfile($params{file}));
+               add_depends($params{page}, $params{file});
+       }
+
        # Support wikilinks in the graph source.
        my $src=$params{src};
        $src="" unless defined $src;
index 7021e47fb6a64d7e5c27fba2b98c79fab0275908..1463420d7cb62c4bc83e8286edc565ec6145c97c 100644 (file)
@@ -21,6 +21,7 @@ ikiwiki, [[WikiLinks|ikiwiki/wikilink]] can also be used. For example:
 The `graph` directive supports the following parameters:
 
 - `src` - The graphviz source to render.
+* `file` - A file in the wiki containing the graphviz source.
 - `type` - The type of graph to render: `graph` or `digraph`.  Defaults to
   `digraph`.
 - `prog` - The graphviz program to render with: `dot`, `neato`, `fdp`, `twopi`,