tazpanel diff lib/libtazpanel @ rev 74

move syntax_highlighter to libtazpanel to be used in other case than file and put colors in CSS so it themeable
author Christophe Lincoln <pankso@slitaz.org>
date Tue Apr 12 03:36:52 2011 +0200 (2011-04-12)
parents 26455264ec32
children 1780ef64bcd5
line diff
     1.1 --- a/lib/libtazpanel	Tue Apr 12 02:42:53 2011 +0200
     1.2 +++ b/lib/libtazpanel	Tue Apr 12 03:36:52 2011 +0200
     1.3 @@ -24,7 +24,6 @@
     1.4  # we use that to help get URL string variables and user names
     1.5  query_string_parser() {
     1.6  	id=0
     1.7 -	#IFS="&"
     1.8  	for var in $(echo "$QUERY_STRING" | sed s'@=@ @'g)
     1.9  	do
    1.10  		id=$((id + 1))
    1.11 @@ -36,7 +35,17 @@
    1.12  			'4') VAR_2=${var% } ;;
    1.13  		esac
    1.14  	done
    1.15 -	#unset IFS
    1.16 +}
    1.17 +
    1.18 +# Syntax highlighting for config file and SHell scripts
    1.19 +syntax_highlighter() {
    1.20 +	case $1 in
    1.21 +		conf)
    1.22 +			sed -e s"#^\#\([^']*\)#<span class='conf-comment'>\0</span>#"g \
    1.23 +				-e s"#^[A-Z]\([^']*\)=#<span class='conf-var'>\0</span>#"g \
    1.24 +				-e s"#^[a-z]\([^']*\)#<span class='conf-var'>\0</span>#"g \
    1.25 +				-e s"#\"\([^']*\)\"#<span class='conf-val'>\0</span>#"g ;;
    1.26 +	esac
    1.27  }
    1.28  
    1.29  # LOG activities