for w (`< $p`) {
[[ $w =~ "\[(.*)\]" ]] || continue
w=${match[1]}
- [[ ${pages[$w]} ]] || continue
+ [[ ${pages[$w]} ]] || {
+ [[ $ZK_SHOW_MISSING ]] && print "Missing $w"
+ continue
+ }
links[$p]="$w ${links[$p]}"
}
}
backs[$p]=${(j: :)ws}
}
-autoload -U relative
getrel() {
# nearly the copy-paste of Functions/Misc/relative
local dst=$2:a
genhtml() {
local page=$1
- local data
+ local data p
[[ $# -eq 1 ]] && data=`< $page` || data=$2
data="${data//&/&}"
data="${data//</<}"
for p (${(k)pages}) {
[[ $p = index ]] && continue
getrel $page $p
- data="${data//${p}/<a href=\"${REPLY}.html\">$p</a>}"
+ data="${data//\[${p}\]/<a href=\"${REPLY}.html\">[$p]</a>}"
}
print "<\!DOCTYPE html>
<html><head><title>$page (${pages[$page]})</title></head><body><pre>