Give graph an optional "file" param, like table's.

master
Amitai Schleier 2018-10-22 00:24:59 -04:00
parent 81bad6a03f
commit 9332b8115d
2 changed files with 9 additions and 0 deletions

View File

@ -95,6 +95,14 @@ sub render_graph (\%) {
sub graph (@) { sub graph (@) {
my %params=@_; 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. # Support wikilinks in the graph source.
my $src=$params{src}; my $src=$params{src};
$src="" unless defined $src; $src="" unless defined $src;

View File

@ -21,6 +21,7 @@ ikiwiki, [[WikiLinks|ikiwiki/wikilink]] can also be used. For example:
The `graph` directive supports the following parameters: The `graph` directive supports the following parameters:
- `src` - The graphviz source to render. - `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 - `type` - The type of graph to render: `graph` or `digraph`. Defaults to
`digraph`. `digraph`.
- `prog` - The graphviz program to render with: `dot`, `neato`, `fdp`, `twopi`, - `prog` - The graphviz program to render with: `dot`, `neato`, `fdp`, `twopi`,