astro

a POSIX shell compatible gemini client (mirror of https://github.com/blmayer/astro)
git clone https://git.clttr.info/astro.git
Log (Feed) | Files | Refs (Tags) | README | LICENSE

commit be7208a364ce8edd84b87fc19df4f6df74b43bed
parent 3fecc5a486b34afffc21bd11fffad6ac824a7285
Author: René Wagner <rwa@clttr.info>
Date:   Sun,  6 Aug 2023 19:45:11 +0200

replace `sed` calls in link rendering

This reduces the time of rendering geminispace.info/known-hosts (~2200 links on this page by the time of
writing) to half (~24secs to 12secs on my testmachine).

Diffstat:
Mastro | 10+++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/astro b/astro @@ -175,11 +175,9 @@ parseurl() { typesetgmi() { stop - NR=$'\r' while IFS='' read -r line || [ -n "$line" ]; do line="$(echo "$line" | tr -d '\r')" - #line="${line%$NR}" # shellcheck disable=SC2016 echo "$line" | grep -q '^```' && pre=$((1 - pre)) && line="" @@ -200,7 +198,8 @@ typesetgmi() { #"# "*) sty="$sty_header1" && line="${line#??}" ;; #"> "*) sty="$sty_quote" && line="${line#??}" ;; "=>"*) - link="$(echo "$line" | sed -e 's/^=> *\(\S\+\)\(\s*.*\)/\1 \2/g')" + #link="$(echo "$line" | sed -e 's/^=> *\(\S\+\)\(\s*.*\)/\1 \2/g')" + link=${line#???} echo "$link" >> "$linksfile" linkcount=$((linkcount+1)) @@ -209,7 +208,8 @@ typesetgmi() { [ -z "$line" ] && line="$link" sty="$sty_linkt" - line="$(echo "$sty_linkb$sty_linkt" | sed "s/%linkcount/$linkcount/")$line" + #line="$(echo "$sty_linkb$sty_linkt" | sed "s/%linkcount/$linkcount/")$line" + line="$sty_linkb$sty_linkt $linkcount $line" ;; '* '*) sty="$sty_listt" && line="$sty_listb$sty_listt$(echo "$line" | cut -c 2-)";; *) sty="";; @@ -304,7 +304,7 @@ EOF sed -i '1d' "$pagefile" stop "status extract" debug "response status - meta: $status - $meta" - + # Validate case "$status" in 10)