tazpanel rev 58

index.cgi: Add some colors to config file
author Christophe Lincoln <pankso@slitaz.org>
date Mon Apr 11 19:23:25 2011 +0200 (2011-04-11)
parents b542e1db674c
children 8be015cdeadb
files index.cgi
line diff
     1.1 --- a/index.cgi	Sun Apr 10 20:28:21 2011 +0200
     1.2 +++ b/index.cgi	Mon Apr 11 19:23:25 2011 +0200
     1.3 @@ -45,7 +45,18 @@
     1.4  		xhtml_header
     1.5  		echo "<h2>$WANT</h2>"
     1.6  		echo '<pre>'
     1.7 -		cat $WANT
     1.8 +		# Handle file type by extension as a Web Server does it.
     1.9 +		# HTML entities: -e 's|&|\&amp;|g' -e 's|<|\&lt;|g' -e 's|>|\&gt;|g'
    1.10 +		case "$WANT" in
    1.11 +			*.conf|*.lst)
    1.12 +				cat $WANT | sed \
    1.13 +					-e s"#^\#\([^']*\)#<span style='color: \#555;'>\0</span>#"g \
    1.14 +					-e s"#^[A-Z]\([^']*\)=#<span style='color: \#000073;'>\0</span>#"g \
    1.15 +					-e s"#^[a-z]\([^']*\)#<span style='color: \#730c00;'>\0</span>#"g \
    1.16 +					-e s"#\"\([^']*\)\"#<span style='color: \#730c00;'>\0</span>#"g ;;
    1.17 +			*)
    1.18 +				cat $WANT ;;
    1.19 +		esac
    1.20  		echo '</pre>' ;;
    1.21  	debug*)
    1.22  		TITLE="- Debug"