From 4653e5cea5d896d3ae53361285de80972d31e920 Mon Sep 17 00:00:00 2001 From: peteyboy Date: Tue, 16 Jun 2026 20:38:26 +0000 Subject: [PATCH 1/2] Update the way links look --- script/connex.pl | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/script/connex.pl b/script/connex.pl index d69f2b1..77a3213 100755 --- a/script/connex.pl +++ b/script/connex.pl @@ -332,7 +332,7 @@ sub page_links_list my $count=0; foreach $link (@page_links){ $count+=1; - $link_list = $link_list . "[$count] $link\n"; + $link_list = $link_list . "[>$count] $link\n"; } return $link_list; } @@ -507,16 +507,31 @@ sub add_page_link{ my $linkline = shift; my $base_url = shift; my $uri_object; + my $uritext; + my $description; local $URI::ABS_ALLOW_RELATIVE_SCHEME = 1; local $URI::ABS_REMOTE_LEADING_DOTS = 1; #remember inside of braces, ^ means NOT, so any NOT SPACE letters are selected, so everything up to next space if (defined($linkline=~ /^=> ([^ ]*)/)){ #has to be something here or I think URI->new_abs has exception that crashes app $uri_object=URI->new_abs($linkline=~ /^=> ([^ ]*)/,$base_url); - push(@page_links, $uri_object->as_string); + $uritext= $uri_object->as_string; + push(@page_links, $uritext); my $count = scalar @page_links; #scalar is size/count of links, but $#page_links is highest INDEX + #below puts the [>1] at the end of the description. #return $linkline =~ s/(^=>.*$)/$1 [\>$count\]/r; don't need to escape on the replace part of a substitution, I guess? - return $linkline =~ s/(^=> .*$)/$1 [>$count]/r; + #below puts the [>1] at the beginning of line, replacing => + #return $linkline =~ s/^=>/[>$count]/r; + + #This reconstructs the uri so it can put the [>1] between the uri and the description, but still on the same + #line as the url, if there isn't a description (was unable to figure out how to do in one regex!) + if ($linkline =~ m/=> .* [^\n]+/){ + $description = ($linkline=~ s/=> [^ ]+ ([^\n]+)/$1/r); + } + else{ + $description= ""; + } + return "=> " . $uritext . " [>$count] " . $description . "\n"; }else{ return $linkline; } -- 2.39.5 From a658151d64f43a15109d2688099cee1c331ba740 Mon Sep 17 00:00:00 2001 From: peteyboy Date: Thu, 18 Jun 2026 21:44:12 +0000 Subject: [PATCH 2/2] One more shot at cleaning up regexes and fixing the rocket link lines as I want --- script/connex.pl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/script/connex.pl b/script/connex.pl index 77a3213..50b782b 100755 --- a/script/connex.pl +++ b/script/connex.pl @@ -513,10 +513,11 @@ sub add_page_link{ local $URI::ABS_ALLOW_RELATIVE_SCHEME = 1; local $URI::ABS_REMOTE_LEADING_DOTS = 1; #remember inside of braces, ^ means NOT, so any NOT SPACE letters are selected, so everything up to next space - if (defined($linkline=~ /^=> ([^ ]*)/)){ #has to be something here or I think URI->new_abs has exception that crashes app + if ($linkline=~ /^=> ([^ ]*)/){ #has to be something here or I think URI->new_abs has exception that crashes app $uri_object=URI->new_abs($linkline=~ /^=> ([^ ]*)/,$base_url); - $uritext= $uri_object->as_string; - push(@page_links, $uritext); + $uritext = ($linkline=~ s/^=> ([^ ]*).*/$1/r); + chomp($uritext); + push(@page_links, $uri_object->as_string); my $count = scalar @page_links; #scalar is size/count of links, but $#page_links is highest INDEX #below puts the [>1] at the end of the description. #return $linkline =~ s/(^=>.*$)/$1 [\>$count\]/r; don't need to escape on the replace part of a substitution, I guess? @@ -525,7 +526,7 @@ sub add_page_link{ #This reconstructs the uri so it can put the [>1] between the uri and the description, but still on the same #line as the url, if there isn't a description (was unable to figure out how to do in one regex!) - if ($linkline =~ m/=> .* [^\n]+/){ + if ($linkline =~ /=> .* [^\n]+/){ $description = ($linkline=~ s/=> [^ ]+ ([^\n]+)/$1/r); } else{ -- 2.39.5