Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Hacked a target attribute into the SVG.

  • Loading branch information...
commit 21d534c78c0263e7697f70e4cbd908db92824fe9 1 parent 86fc4de
@shlomif shlomif authored
Showing with 11 additions and 3 deletions.
  1. +11 −3 lib/CPANHQ/Controller/Distribution.pm
View
14 lib/CPANHQ/Controller/Distribution.pm
@@ -110,6 +110,14 @@ sub graph :Chained('release') :PathPart("graph.png") :Args(0) {
return;
}
+sub _preprocess_for_svg :Private {
+ my ($self, $c, $graphviz) = @_;
+
+ $graphviz =~ s{((?:URL|href)=")}{target="_top",$1}gms;
+
+ return $graphviz;
+}
+
sub svg_graph :Chained('release') :PathPart("graph.svg") :Args(0) {
my ($self, $c) = @_;
@@ -124,9 +132,9 @@ sub svg_graph :Chained('release') :PathPart("graph.svg") :Args(0) {
mkpath(dirname($graph_output));
if ( !-f $graph_output ) {
- if ( open( my $png, '|-', qw(dot -Tsvg -o), $graph_output ) ) {
- print $png $graph->as_graphviz;
- close($png);
+ if ( open( my $svg, '|-', qw(dot -Tsvg -o), $graph_output ) ) {
+ print {$svg} $self->_preprocess_for_svg($c, $graph->as_graphviz);
+ close($svg);
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.