From 62c287696441619267a6d25a26c18da3624ffdec Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Thu, 15 May 2025 18:02:08 +0300 Subject: [PATCH] Rename to swg --- README | 6 +++--- USAGE | 18 +++++++++--------- VIM | 4 ++-- zk => swg | 23 ++++++++++++----------- 4 files changed, 26 insertions(+), 25 deletions(-) rename zk => swg (96%) diff --git a/README b/README index fbcbfe4..5e39ef4 100644 --- a/README +++ b/README @@ -1,7 +1,7 @@ -zk -- zettelkästen/wiki/static website helper/generator. +swg -- simple wiki/zettelkästen helper/generator. Here is suggested trivially simple format of plaintext data, ready to be -used for zettelkästen, wiki, static website, documentation generation. +used for zettelkästen, wiki, static website, info documentation generation. There are various already existing similar solutions. But most of them are either too complex, or not too flexible enough, or far from being @@ -48,7 +48,7 @@ completely optional feature. Look how [LINKS] should be made. How [FORMAT] is defined. How your [VIM] editor can be used with all of that. -Look for [USAGE] of zk utility itself. +Look for [USAGE] of swg utility itself. Use grep, git-grep or similar tools to search through pages. fzf can be used to quickly navigate to necessary page/file. diff --git a/USAGE b/USAGE index 6db859f..b0fc6b5 100644 --- a/USAGE +++ b/USAGE @@ -1,28 +1,28 @@ -* zk links path/to/page +* swg links path/to/page Prints all (internal) links presented on the page. -* zk backs path/to/page +* swg backs path/to/page Prints all (internal) backlinks to the page. -* zk cats [prefix] +* swg cats [prefix] Print all categories/directories, optionally filtered by prefix. -* zk htmls path/to/dir +* swg htmls path/to/dir Render current directory to a bunch of HTMLs. -* zk dot | dot -Tpng >relations.png +* swg dot | dot -Tpng >relations.png Generates Graphviz'es dot graph with internal links relationships. -* zk info >out.info +* swg info >out.info Generates GNU Info output. If directory does not have "index" file, then it will be autogenerated with all files in the directory (category) and all backlinks to it. -If $ZK_DO_BACKS=0 environment variable is set, then no backlinks table +If $SWG_DO_BACKS=0 environment variable is set, then no backlinks table will be generated on the pages by default. -.zkignore may contain regular expressions (one per line) to ignore +.swgignore may contain regular expressions (one per line) to ignore specified files during processing. Your directory may contain images or binary files, that must not be processed. Files starting with dot will be ignored by default. -If $ZK_PRINT_MISSING environment variable is set, then warning will be +If $SWG_PRINT_MISSING environment variable is set, then warning will be print for links leading to non-existent pages. How to forcefully change the title of the generated HTML page? diff --git a/VIM b/VIM index 9ffa6ff..c8e9fdb 100644 --- a/VIM +++ b/VIM @@ -13,8 +13,8 @@ directories and filenames in them. Square bracketed links can be highlighted with: - syntax region zkLink start="\[\S" end="\S]" - highlight link zkLink String + syntax region swgLink start="\[\S" end="\S]" + highlight link swgLink String Command ([FORMAT]) lines can be highlighted with: diff --git a/zk b/swg similarity index 96% rename from zk rename to swg index b5d9a01..3320eb6 100755 --- a/zk +++ b/swg @@ -1,5 +1,5 @@ #!/usr/bin/env perl -# zk -- zettelkästen/wiki/static website helper/generator +# swg -- simple wiki/zettelkästen helper/generator # Copyright (C) 2022-2025 Sergey Matveev use strict; @@ -7,7 +7,7 @@ use warnings; use utf8; use Carp q{croak}; -use version; our $VERSION = qv('1.0.0'); +use version; our $VERSION = qv(1.0.0); use Encode qw(encode decode); binmode STDOUT, q{:encoding(UTF-8)}; @@ -24,8 +24,8 @@ Usage: $0 dot | dot -Tpng >relations.png $0 info >out.info -By default ZK_DO_BACKS=1 is set. -Do not forget about .zkignore with regular expressions. +By default SWG_DO_BACKS=1 is set. +Do not forget about .swgignore with regular expressions. END_USAGE ; exit 1; @@ -33,8 +33,8 @@ END_USAGE if ($#ARGV == -1) { usage } -my $DoBacks = ((not exists $ENV{ZK_DO_BACKS}) or - ($ENV{ZK_DO_BACKS} eq q{1})) ? 1 : 0; +my $DoBacks = ((not exists $ENV{SWG_DO_BACKS}) or + ($ENV{SWG_DO_BACKS} eq q{1})) ? 1 : 0; my %Mtimes; my %CatFiles; @@ -44,8 +44,9 @@ use File::Basename; { my @ignores; - if (-e q{.zkignore}) { - open my $fh, q{<:encoding(UTF-8)}, q{.zkignore} or croak "$!"; + my $swgignore = q{.swgignore}; + if (-e $swgignore) { + open my $fh, q{<:encoding(UTF-8)}, $swgignore or croak "$!"; while (<$fh>) { chop; push @ignores, $_; @@ -125,14 +126,14 @@ for my $pth (keys %Mtimes) { } if ($w =~ /\/$/) { if (not exists $CatDirs{$w}) { - if (exists $ENV{ZK_PRINT_MISSING}) { + if (exists $ENV{SWG_PRINT_MISSING}) { print "missing $w\n"; } return; } } else { if (not exists $Mtimes{$w}) { - if (exists $ENV{ZK_PRINT_MISSING}) { + if (exists $ENV{SWG_PRINT_MISSING}) { print "missing $w\n"; } return; @@ -501,7 +502,7 @@ if ($ARGV[0] eq q{dump}) { utime $mtime, $mtime, "$ARGV[1]/$pth.txt"; } } elsif ($ARGV[0] eq q{info}) { - print "Autogenerated by zk\n"; + print "Autogenerated by swg $VERSION\n"; my $sep = "\n\n"; print "${sep}File: self, Node: Top, Up: (dir)\n\n"; if (exists $Mtimes{q{index}}) { -- 2.48.1