title-boxes.filter - tgtimes - The Gopher Times
(HTM) git clone git://bitreich.org/tgtimes git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/tgtimes
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Tags
(DIR) README
---
title-boxes.filter (1307B)
---
1 #!/usr/bin/env bash
2 #
3 # Use this when boxes is used.
4 # We now use the simpler filter.
5 #
6
7 export TERM=linux
8
9 reset="$(tput sgr0)"
10 italicformat="$(tput sitm)"
11 italicreset="$(tput ritm)"
12 boldformat="$(tput bold)"
13 boldreset="$(echo -ne "\033[22m")"
14 underlineformat="$(tput smul)"
15 underlinereset="$(tput rmul)"
16 reverseformat="$(tput rev)"
17 reversereset="$(echo -ne "\033[27m")"
18
19 redcolor="$(tput setaf 1)"
20 greencolor="$(tput setaf 2)"
21 yellowcolor="$(tput setaf 3)"
22 bluecolor="$(tput setaf 4)"
23 purplecolor="$(tput setaf 5)"
24 cyancolor="$(tput setaf 6)"
25 whitecolor="$(tput setaf 7)"
26 darkgreycolor="$(tput setaf 8)"
27 brightredcolor="$(tput setaf 9)"
28 brightgreencolor="$(tput setaf 10)"
29 brightyellowcolor="$(tput setaf 11)"
30 brightbluecolor="$(tput setaf 12)"
31 brightpurplecolor="$(tput setaf 13)"
32 brightcyancolor="$(tput setaf 14)"
33 brightwhitecolor="$(tput setaf 14)"
34
35 line0=""
36 line1=""
37 line2=""
38
39 i=0
40 while IFS= read -r line;
41 do
42 case "${i}" in
43 0)
44 line0="${line}"
45 ;;
46 1)
47 line1="${line}"
48 ;;
49 2)
50 line2="${line}"
51 nline2="$(printf "%s\n" "${line2}" \
52 | sed 's,^|[ #]*\(.*\)$,\1,')"
53 nline0="$(printf "%s\n" "${line0}" \
54 | sed "s,\[ \],\[${underlineformat} ${nline2} ${reset}\],")"
55 printf "%s\n" "${nline0}"
56 #printf "%s\n" "${line1}"
57 ;;
58 *)
59 printf "%s\n" "${line}"
60 ;;
61 esac
62 i=$((i + 1))
63 done
64