From 7f9c139ead6557888b9f353811e25b3af1672c55 Mon Sep 17 00:00:00 2001 From: ed Date: Sun, 30 Nov 2025 10:34:50 +0100 Subject: [PATCH] helptext anchors --- scripts/genhelp.sh | 6 ++++++ scripts/help2html.py | 16 +++++++++++++++- scripts/help2txt.sh | 6 ++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/scripts/genhelp.sh b/scripts/genhelp.sh index 0ecb6603..e9d8412e 100755 --- a/scripts/genhelp.sh +++ b/scripts/genhelp.sh @@ -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 diff --git a/scripts/help2html.py b/scripts/help2html.py index f39332ed..2ddb88be 100755 --- a/scripts/help2html.py +++ b/scripts/help2html.py @@ -37,7 +37,12 @@ def cnv(src): hostname = str(socket.gethostname()).split(".")[0] yield '' - yield '' + yield '' 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 = '

# %s%s

' % (zs3, zs3, zs1, zs2) + m = re.search(r"^ (-{1,2})([^ ,]+)(.*)", ln) + if m: + zs1, zs2, zs3 = m.groups() + ln = ' %s%s%s' % (zs2, zs2, zs1, zs2, zs3) ln = ln.replace(">/home/ed/", ">~/") if ln.startswith("0" * 20): diff --git a/scripts/help2txt.sh b/scripts/help2txt.sh index ec10b29d..27aa1216 100755 --- a/scripts/help2txt.sh +++ b/scripts/help2txt.sh @@ -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/;