From: Sergey Matveev Date: Thu, 8 May 2025 11:46:17 +0000 (+0300) Subject: Ability to disable links/backs generation X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=49404e92ff37636076e5d5e2adf6729fbd6daaaa;p=zk.git Ability to disable links/backs generation --- diff --git a/zk b/zk index 8a4c90a..bebc2ee 100755 --- a/zk +++ b/zk @@ -65,13 +65,13 @@ quickly open results in the editor. =item * -C URL[ optional text]ECRE> on a separate line will add a -link to the specified URL (with optional text). Pay attention that line -contains carriage-return character at the end. +C URL[ optional text]\r> on a separate line will add a link to the +specified URL (with optional text). Pay attention that line contains +carriage-return character at the end. =item * -CCRE> on a separate line will add an image with +C on a separate line will add an image with optional alternative text similarly as link is specified. =back @@ -96,6 +96,13 @@ to other pages. It also will include all backlinks in them. Each directory will also contain index page with links to all existing pages in current directory and to subdirectories. +=head1 (BACK)LINKS GENERATION + +Set C to disable automatic links-table creation in the +HTML output. Set C to disable automatic backlinks-table. +If C line is presented, then links-table is forcefully generated. +C generated backlinks table. + =head1 HISTORY Older version of that script, written on Z shell, can be found in Git history. @@ -117,6 +124,11 @@ sub usage { usage if $#ARGV == -1; +my $doLinks = ((not exists $ENV{ZK_DO_LINKS}) or + ($ENV{ZK_DO_LINKS} eq "1")) ? 1 : 0; +my $doBacks = ((not exists $ENV{ZK_DO_BACKS}) or + ($ENV{ZK_DO_BACKS} eq "1")) ? 1 : 0; + my %mtimes; my %sizes; my %cats; @@ -263,7 +275,7 @@ sub genHTML { } close $fh; print $out "\n"; - if ($#lnks != -1) { + if ($doLinks and $#lnks != -1) { print $out "\n"; my $mtime; while (my ($i, $l) = each @lnks) { @@ -274,7 +286,7 @@ sub genHTML { print $out "
Links
\n"; } @lnks = sort keys %{$backs{$page}}; - if ($#lnks != -1) { + if ($doBacks and $#lnks != -1) { print $out "\n"; my $rel; foreach my $l (@lnks) {
Backlinks