cookutils rev 794

web/cookiso.cgi: change syntax_highlighter()
author Aleksej Bobylev <al.bobylev@gmail.com>
date Mon Mar 14 00:09:44 2016 +0200 (2016-03-14)
parents 2c08c751a8f9
children 3e9b94aa971c
files web/cookiso.cgi
line diff
     1.1 --- a/web/cookiso.cgi	Thu Jan 28 12:58:59 2016 +0100
     1.2 +++ b/web/cookiso.cgi	Mon Mar 14 00:09:44 2016 +0200
     1.3 @@ -27,10 +27,15 @@
     1.4  syntax_highlighter() {
     1.5  	case $1 in
     1.6  		log)
     1.7 -			sed -e 's#OK#<span class="span-ok">OK</span>#g' \
     1.8 -				-e 's#Failed#<span class="span-red">Failed</span>#g' \
     1.9 -				-e 's|\(Filesystem size:\).*G\([0-9\.]*M\) *$|\1 \2|' \
    1.10 -				-e 's|.\[1m|<b>|' -e 's|.\[0m|</b>|' -e 's|.\[[0-9Gm;]*||g' ;;
    1.11 +			esc=$'\033'
    1.12 +			sed -e 's|\(Filesystem size:\).*G\([0-9\.]*M\) *$|\1 \2|' \
    1.13 +				-e "s|$esc\[1m|<span style=\"color: #008; font-weight: bold\">|g" \
    1.14 +				-e "s|$esc\0m|</span>|g" -e "s|$esc\[0;39m|</span>|g" \
    1.15 +				-e "s|$esc\[0;33m|<span style=\"color: #861\">|g" \
    1.16 +				-e "s|$esc\[1;31m|<span style=\"color: #F00; font-weight: bold\">|g" \
    1.17 +				-e "s|$esc\[1;32m|<span style=\"color: #0A0; font-weight: bold\">|g" \
    1.18 +				-e "s|$esc\[[0-9;]*m|<span>|g"
    1.19 +				;;
    1.20  		activity)
    1.21  			sed s"#^\([^']* : \)#<span class='log-date'>\0</span>#"g ;;
    1.22  	esac