From 450b09554e3c5971562bbf27e616262c8d0f8694 Mon Sep 17 00:00:00 2001 From: Danielle Hutzley Date: Mon, 20 Mar 2023 16:57:42 -0500 Subject: [PATCH] Major fixes --- cap2site.pl | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/cap2site.pl b/cap2site.pl index 3e3a2c0..c53a1ee 100755 --- a/cap2site.pl +++ b/cap2site.pl @@ -37,14 +37,14 @@ our $DEFAULT = Config->new( sub isUrl($$) { my ($self,$data) = @_; - my ($scheme,$info) =~ /(\w+):\/\/([.*]+)/ || return 0; - return grep $scheme, $self->{web_schemes}; + $data =~ /(\w+):\/\/(.+)/ or return 0; + return grep $1, $self->{web_schemes}; } sub isA($$$) { my ($self,$url,$type) = @_; - my ($info) =~ /[.*](.[^.]+)^/ || return 0; - return grep $self->extensions->{$type}, $url; + $url =~ /[.*](.[^.]+)^/ or return 0; + return grep $1, $self->extensions->{type}; } package State; @@ -142,8 +142,7 @@ sub parse($$$) { elsif (index($line, '=>') == 0) { my $data = trimLeft(substr $line, 2); - my ($uri,$content) = split " ". $data; - $content = trimLeft $content; + my ($uri,$content) = split " ", $data; if ($config->isUrl($uri) and $config->isA($uri, 'image')) { print ''; @@ -164,11 +163,14 @@ sub parse($$$) { } elsif ($config->isUrl($uri)) { - print '', escape($content), '', "\n"; + print '
', "\n"; + print '=> '; + print '', escape($content), '', "\n"; + print '
', "\n"; } else { - print '

', $line, '

', "\n"; + print '

', '=>', $uri, $content, '

', "\n"; } }