From: Paul Hänsch Date: Sat, 13 Feb 2021 21:24:16 +0000 (+0100) Subject: prefer shell based unstring function X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=8419328ab5ca0de89d4a620bb0ca69a21e07944a;p=serve0 prefer shell based unstring function --- diff --git a/list.sh b/list.sh index e7b856c..1ae43f1 100644 --- a/list.sh +++ b/list.sh @@ -35,8 +35,8 @@ list_item() { "$link" "$link" "${name##/}" \ "$((length / 60))" "$((length % 60))" \ "$width" "$height" \ - "$(printf '%s\n' "${tags#tags=}" \ - | sed -r "$UNSTRING"' s;^;,;; s;,+;,;g; s;,$;;; + "$(UNSTRING "${tags#tags=}" \ + | sed -r 's;^;,;; s;,+;,;g; s;,$;;; :X s;,-?([^,]+)(,|$); [span .tag\n \1]\2;; tX;' )" "$name" "$link" "$link" else diff --git a/view.sh b/view.sh index 90075f7..3aa4d97 100644 --- a/view.sh +++ b/view.sh @@ -37,7 +37,7 @@ printf 'Content-Type: text/html;charset=utf-8\r\n\r\n' [span .time %i:%02imin] [span .dim %ix%i] %s ' "$(HTML "${ITEM##*/}" |sed -r "$w_ascii"' s;[^0-9a-zA-Z&#];&[wbr];g')" \ "$((length / 60))" "$((length % 60))" "$width" "$height" \ - "$(printf '%s\n' "${tags#tags=}" |sed -r "$UNSTRING"' + "$(UNSTRING "${tags#tags=}" |sed -r ' s;^;,;; s;,+;,;g; s;,$;;; :X s;,-?([^,]+)(,|$); [span .tag\n \1]\2;; tX;' )" printf '