pricecharts

track prices of consumer electronics
Log | Files | Refs | README

commit 4ac0e6db2b9b70dd1a67a03de596f0f78f6667e6
parent 1edc6b0a6349e75e5185b0636d260d57be09b0f7
Author: Kyle Milz <kyle@getaddrinfo.net>
Date:   Sat, 25 Apr 2015 21:07:35 -0600

pc_html: remove ugly xml-stylesheet hack

Diffstat:
Mpc_html | 15++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/pc_html b/pc_html @@ -223,18 +223,12 @@ for (@{$dbh->selectall_arrayref($parts_sql)}) { my $manufacturer_dir = linkify($manufacturer); my $part_link = linkify($part_num); - make_path("$svg_dir/$manufacturer_dir", { verbose => $args{v} }); + make_path("$svg_dir/$manufacturer_dir", { verbose => $args{v} }); my $svg_path = "$svg_dir/$manufacturer_dir/$part_link.svg"; - open my $svg_fh, ">", "$svg_path" or die "couldn't open $svg_path: $!"; - # XXX: not sure how to add this programatically, hack around for now - my @buf = split("\n", $svg->xmlify); - my $css_include = "<?xml-stylesheet href=\"/pricechart.css\" type=\"text/css\"?>"; - # must be the second line - splice (@buf, 1, 0, ($css_include)); - - print $svg_fh "$_\n" for (@buf); + open my $svg_fh, ">", "$svg_path" or die "couldn't open $svg_path: $!"; + print $svg_fh $svg->xmlify; close $svg_fh; $rendered_total++; @@ -351,6 +345,9 @@ sub make_svg my $defs = $svg->defs(); my ($x_scale, $y_scale) = ($center / $domain, $middle / $range); + $defs->tag("link", href => "/pricechart.css", type => "text/css", + rel => "stylesheet", xmlns => "http://www.w3.org/1999/xhtml"); + # make price labels along right side and lines across chart my $num_labels = 5; for (1..$num_labels) {