-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
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.
-* 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?
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:
#!/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 <stargrave@stargrave.org>
use strict;
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)};
$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;
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;
{
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, $_;
}
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;
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\1f\n";
print "${sep}File: self, Node: Top, Up: (dir)\n\n";
if (exists $Mtimes{q{index}}) {