Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Item14193: fix generation of svg files
- missing SvgFormat parameter
- fixed encoding of interim dot file
  • Loading branch information
MichaelDaum committed Nov 30, 2016
1 parent 00962fd commit 1cff30a
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 11 deletions.
14 changes: 7 additions & 7 deletions .gitignore
Expand Up @@ -2,10 +2,10 @@
graphviz_*
igp_*
*.swp
GraphvizPlugin.md5
GraphvizPlugin.sha1
GraphvizPlugin.tgz
GraphvizPlugin.txt
GraphvizPlugin.zip
GraphvizPlugin_installer
GraphvizPlugin_installer.pl
/GraphvizPlugin.md5
/GraphvizPlugin.sha1
/GraphvizPlugin.tgz
/GraphvizPlugin.txt
/GraphvizPlugin.zip
/GraphvizPlugin_installer
/GraphvizPlugin_installer.pl
1 change: 1 addition & 0 deletions data/System/GraphvizPlugin.txt
Expand Up @@ -183,6 +183,7 @@ digraph G {
%$DEPENDENCIES%

---++ Change History
| 30 Nov 2016: | missing <nop>SvgFormat parameter; fixed encoding of created dot file |
| 02 Mar 2016: | fixed error on =dot= command format; improved error reporting |
| 07 Oct 2015: | compatibility with foswiki >= 2.0.2 |
| 31 Aug 2015: | first final release |
Expand Down
4 changes: 2 additions & 2 deletions lib/Foswiki/Plugins/GraphvizPlugin.pm
Expand Up @@ -23,8 +23,8 @@ use Foswiki::Plugins ();
use Foswiki::Attrs ();
use Foswiki::Plugins::WysiwygPlugin ();

our $VERSION = '1.02';
our $RELEASE = '02 Mar 2016';
our $VERSION = '1.03';
our $RELEASE = '30 Nov 2016';
our $SHORTDESCRIPTION = 'Draw graphs using the !GraphViz utility';
our $NO_PREFS_IN_TOPIC = 1;
our $core;
Expand Down
3 changes: 3 additions & 0 deletions lib/Foswiki/Plugins/GraphvizPlugin/Config.spec
Expand Up @@ -8,4 +8,7 @@ $Foswiki::cfg{GraphvizPlugin}{DotCmd} = '/usr/bin/dot -K%RENDERER|S% -T%TYPE|S%
# **STRING**
$Foswiki::cfg{GraphvizPlugin}{ImageFormat} = '<noautolink><img src=\'$url\' class=\'graphviz\' $style$width$height/></noautolink>';

# **STRING**
$Foswiki::cfg{GraphvizPlugin}{SvgFormat} = '<noautolink><literal>$svg</literal></noautolink>';

1;
5 changes: 3 additions & 2 deletions lib/Foswiki/Plugins/GraphvizPlugin/Core.pm
Expand Up @@ -38,7 +38,7 @@ sub new {
my $this = bless({
dotCmd => $Foswiki::cfg{GraphvizPlugin}{DotCmd} || '/usr/bin/dot -K%RENDERER|S% -T%TYPE|S% -o%OUTFILE|F% %INFILE|F%',
imageFormat => $Foswiki::cfg{GraphvizPlugin}{ImageFormat} || '<noautolink><img src=\'$url\' class=\'graphviz\' $style$width$height/></noautolink>',
svgFormat => $Foswiki::cfg{GraphvizPlugin}{ImageFormat} || '<noautolink><literal>$svg</literal></noautolink>',
svgFormat => $Foswiki::cfg{GraphvizPlugin}{SvgFormat} || '<noautolink><literal>$svg</literal></noautolink>',
@_
}, $class);

Expand Down Expand Up @@ -89,6 +89,7 @@ sub GRAPHVIZ {
}
$thisParams->{_DEFAULT} = "$web.$topic";
my ($meta) = Foswiki::Func::readTopic($web, $topic);
require Foswiki::Macros::INCLUDE;
$text = $session->INCLUDE($thisParams, $meta)
}

Expand Down Expand Up @@ -153,6 +154,7 @@ sub GRAPHVIZ {
UNLINK => TRACE?0:1,
SUFFIX => '.dot'
);
binmode $dotFH;#, ':encoding(utf-8)';

writeDebug("infile=".$dotFH->filename);
writeDebug("outfile=".$outfilePath);
Expand Down Expand Up @@ -196,7 +198,6 @@ sub GRAPHVIZ {
$result =~ s/width="[^"]*"/width="$width"/ if defined $width;
$result =~ s/height="[^"]*"/height="$height"/ if defined $height;
$result =~ s/<svg /<svg $style / if defined $style;

} else {
$result = $this->{imageFormat};

Expand Down

0 comments on commit 1cff30a

Please sign in to comment.