Major fixes

This commit is contained in:
Danielle Hutzley 2023-03-20 16:57:42 -05:00
parent ba7203c2af
commit 450b09554e
1 changed files with 10 additions and 8 deletions

View File

@ -37,14 +37,14 @@ our $DEFAULT = Config->new(
sub isUrl($$) { sub isUrl($$) {
my ($self,$data) = @_; my ($self,$data) = @_;
my ($scheme,$info) =~ /(\w+):\/\/([.*]+)/ || return 0; $data =~ /(\w+):\/\/(.+)/ or return 0;
return grep $scheme, $self->{web_schemes}; return grep $1, $self->{web_schemes};
} }
sub isA($$$) { sub isA($$$) {
my ($self,$url,$type) = @_; my ($self,$url,$type) = @_;
my ($info) =~ /[.*](.[^.]+)^/ || return 0; $url =~ /[.*](.[^.]+)^/ or return 0;
return grep $self->extensions->{$type}, $url; return grep $1, $self->extensions->{type};
} }
package State; package State;
@ -142,8 +142,7 @@ sub parse($$$) {
elsif (index($line, '=>') == 0) { elsif (index($line, '=>') == 0) {
my $data = trimLeft(substr $line, 2); my $data = trimLeft(substr $line, 2);
my ($uri,$content) = split " ". $data; my ($uri,$content) = split " ", $data;
$content = trimLeft $content;
if ($config->isUrl($uri) and $config->isA($uri, 'image')) { if ($config->isUrl($uri) and $config->isA($uri, 'image')) {
print '<a style="display: block;" href="', escape($uri), '">'; print '<a style="display: block;" href="', escape($uri), '">';
@ -164,11 +163,14 @@ sub parse($$$) {
} }
elsif ($config->isUrl($uri)) { elsif ($config->isUrl($uri)) {
print '<a style="display: block;" href="', escape($uri), '">', escape($content), '</a>', "\n"; print '<div>', "\n";
print '<span class="link-delim">=></span> ';
print '<a href="', escape($uri), '">', escape($content), '</a>', "\n";
print '</div>', "\n";
} }
else { else {
print '<p>', $line, '</p>', "\n"; print '<p>', '<span class="link-delim">=></span>', $uri, $content, '</p>', "\n";
} }
} }