Removing svgexport.

This commit is contained in:
sergiotarxz 2022-11-19 20:00:37 +01:00
parent c311f33494
commit b85308eca8

View File

@ -50,7 +50,7 @@ sub _ReturnCacheFilter {
push @{ $posts_by_category_filtered{ $post->{category} } }, $post; push @{ $posts_by_category_filtered{ $post->{category} } }, $post;
} }
} }
return (\%posts_by_category_filtered, \%posts_by_slug_filtered); return ( \%posts_by_category_filtered, \%posts_by_slug_filtered );
} }
sub Retrieve { sub Retrieve {
@ -134,15 +134,14 @@ sub PostPreviewOg {
my $svg = my $svg =
$self->_GenerateSVGPostPreview( $title, \@new_content, $post->{image} ); $self->_GenerateSVGPostPreview( $title, \@new_content, $post->{image} );
my $svgexport = path($ENV{HOME})->child('node_modules/.bin/svgexport'); my ( $stdout, $stderr ) = capture {
die "No svgexport." if !-f $svgexport; open my $fh, '|-', qw{convert /dev/stdin png:fd:1};
my $tmpdir = Path::Tiny->tempdir(); binmode $fh, 'utf8';
my $input = $tmpdir->child('input.svg'); print $fh $svg;
my $output = $tmpdir->child('output.png'); close $fh;
};
$input->spew_utf8($svg); say STDERR $stderr;
system $svgexport, $input, $output, 'png'; return $stdout;
return $output->slurp;
} }
sub _AttachImageSVG { sub _AttachImageSVG {
@ -250,7 +249,7 @@ sub _GenerateSVGPostPreview {
)->cdata($line); )->cdata($line);
$n++; $n++;
} }
path($ROOT_PROJECT)->child('a.svg')->spew_utf8($svg->xmlify); path($ROOT_PROJECT)->child('a.svg')->spew_utf8( $svg->xmlify );
return $svg->xmlify; return $svg->xmlify;
} }