helptext anchors

This commit is contained in:
ed 2025-11-30 10:34:50 +01:00
parent 3f4b79ffb8
commit 7f9c139ead
3 changed files with 27 additions and 1 deletions

View file

@ -1,6 +1,12 @@
#!/bin/bash
set -e
command -v gfind >/dev/null &&
command -v gsed >/dev/null &&
command -v gsort >/dev/null && {
sed() { gsed "$@"; }
}
[ -e make-sfx.sh ] || cd scripts
[ -e make-sfx.sh ] && [ -e deps-docker ] || {
echo cd into the scripts folder first

View file

@ -37,7 +37,12 @@ def cnv(src):
hostname = str(socket.gethostname()).split(".")[0]
yield '<!DOCTYPE html>'
yield '<html style="background:#222;color:#fff"><body>'
yield '<html><body><style>'
yield 'html{background:#222;color:#fff;line-height:1.25em}'
yield 'h3{margin:0;padding:0}'
yield 'a{color:#fc5;text-decoration:none;scroll-margin-top:3em}'
yield 'a:active,a:target{background:#fc5;color:#000;box-shadow:0 0 0 .12em #fc5}'
yield '</style>'
skip_sfx = False
in_sfx = 0
in_salt = 0
@ -104,6 +109,15 @@ def cnv(src):
ln = re.sub(r">[0-9]{1,2}\.[0-9]<", ">dynamic<", ln)
if t != ln:
in_th_ram_max = 0
m = re.search(r"^# (.* help page)(.*)", ln)
if m:
zs1, zs2 = m.groups()
zs3 = zs1.replace(" ", "-")
ln = '<h3># <a id="%s" href="#%s">%s</a>%s</h3></a>' % (zs3, zs3, zs1, zs2)
m = re.search(r"^ (-{1,2})([^ ,]+)(.*)", ln)
if m:
zs1, zs2, zs3 = m.groups()
ln = ' <a href="#g-%s" id="g-%s">%s%s</a>%s' % (zs2, zs2, zs1, zs2, zs3)
ln = ln.replace(">/home/ed/", ">~/")
if ln.startswith("0" * 20):

View file

@ -1,6 +1,12 @@
#!/bin/bash
set -e
command -v gfind >/dev/null &&
command -v gsed >/dev/null &&
command -v gsort >/dev/null && {
head() { ghead "$@"; }
}
( ( HLPTXT=CAT && cat || xsel -ob ) | sed -r '
s`/home/ed/`~/`;
s/uuid:[0-9a-f-]{36}/autogenerated/;