Skip to content

Commit

Permalink
iii: process underline, bold and italics
Browse files Browse the repository at this point in the history
  • Loading branch information
c00kiemon5ter committed Sep 11, 2012
1 parent aa8b197 commit 884ea1e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions iii.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ stty -echonl -echo
tail -f -n "$h" "$i/$n/$c/out" | while read -r date time nick mesg; do
case "$nick" in \<*\>) nick="${nick#<}" nick="${nick%>}"; printf '\a' ;; esac
case "$mesg" in *$u*) date="$(tput setaf $l)$date" ;; esac

# pretify special symbols around words
mesg="$(echo "$mesg" \
| sed "s;\(^\|[[:space:]*_]\)/\([^[:space:]]*\)/\([_*[:space:]]\|$\);\1$(tput sitm)\2$(tput ritm)\3;g" \
| sed "s;\(^\|[[:space:]*m]\)_\([^[:space:]]*\)_\([*[:space:]]\|$\);\1$(tput smul)\2$(tput rmul)\3;g" \
| sed "s;\(^\|[[:space:]]\)\*\([^[:space:]]*\)\*\([[:space:]]\|$\);\1$(tput bold)\2$(tput sgr0)\3;g")"

# value between 1 and 14 - avoid black and white though there's 7 and 8
# based on the nick length and ascii code of the nick's first letter
$r && clr="$(tput setaf $(( ((${#nick} + $(printf "%d" "'$nick")) % 14) + 1)))" || clr="$grn"
Expand Down

0 comments on commit 884ea1e

Please sign in to comment.