Major fixes
This commit is contained in:
parent
ba7203c2af
commit
450b09554e
18
cap2site.pl
18
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 '<a style="display: block;" href="', escape($uri), '">';
|
||||
|
@ -164,11 +163,14 @@ sub parse($$$) {
|
|||
}
|
||||
|
||||
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 {
|
||||
print '<p>', $line, '</p>', "\n";
|
||||
print '<p>', '<span class="link-delim">=></span>', $uri, $content, '</p>', "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue