From 85440e65319a314515f33f8cc15c5a810c09190c Mon Sep 17 00:00:00 2001 From: Slim Amamou Date: Tue, 12 Feb 2008 19:43:09 +0100 Subject: [PATCH] coloration syntaxique dans l'historique --- bazdig/bazdig.css | 4 ++-- bazdig/codepress/languages/sql.css | 4 ++-- bazdig/history/index.php | 3 ++- lib/code.php | 11 +++++++++++ 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/bazdig/bazdig.css b/bazdig/bazdig.css index 3450343..395b92c 100644 --- a/bazdig/bazdig.css +++ b/bazdig/bazdig.css @@ -33,13 +33,13 @@ h3 { #settings * input:focus { background: yellow; } -#queries a { +#queries pre { display: block; padding: 10px; text-decoration: none; color: black } -#queries a:hover { +#queries pre:hover { background-color: yellow; } #ok { diff --git a/bazdig/codepress/languages/sql.css b/bazdig/codepress/languages/sql.css index 55e939c..435a01d 100755 --- a/bazdig/codepress/languages/sql.css +++ b/bazdig/codepress/languages/sql.css @@ -5,5 +5,5 @@ b {color:blue;font-style:normal;} /* reserved words */ u {color:blue;font-style:normal;} /* types */ a {color:fuchsia;font-style:normal;} /* commands */ -i, i b, i u, i a, i s {color:silver;font-weight:normal;font-style:italic;} /* comments */ -s, s b, s u, s a, s i {color:#2A00FF;font-weight:normal;} /* strings */ +i, i b, i u, i a, i s {color:silver;font-weight:normal;font-style:italic;text-decoration:none;} /* comments */ +s, s b, s u, s a, s i {color:#2A00FF;font-weight:normal;text-decoration:none;} /* strings */ diff --git a/bazdig/history/index.php b/bazdig/history/index.php index 2dce7d1..9a4df2d 100644 --- a/bazdig/history/index.php +++ b/bazdig/history/index.php @@ -17,6 +17,7 @@ ?> bazdig history +
@@ -25,7 +26,7 @@
get_url() .'?q='. rawurlencode($q->code) .'" >
'. $q->code .'
'; + echo '
'. $q->toHTML().'
'; } ?>
diff --git a/lib/code.php b/lib/code.php index 0e2a5b3..04edf7d 100644 --- a/lib/code.php +++ b/lib/code.php @@ -121,4 +121,15 @@ } return $columns; } + + function toHTML() + { + $html = $this->code; + $html = preg_replace("/\'(.*?)(\')/", '\'$1$2', $html); + $html = preg_replace("/\b(add|after|aggregate|alias|all|and|as|authorization|between|by|cascade|cache|cache|called|case|check|column|comment|constraint|createdb|createuser|cycle|database|default|deferrable|deferred|diagnostics|distinct|domain|each|else|elseif|elsif|encrypted|except|exception|for|foreign|from|from|full|function|get|group|having|if|immediate|immutable|in|increment|initially|increment|index|inherits|inner|input|intersect|into|invoker|is|join|key|language|left|like|limit|local|loop|match|maxvalue|minvalue|natural|nextval|no|nocreatedb|nocreateuser|not|null|of|offset|oids|on|only|operator|or|order|outer|owner|partial|password|perform|plpgsql|primary|record|references|replace|restrict|return|returns|right|row|rule|schema|security|sequence|session|sql|stable|statistics|table|temp|temporary|then|time|to|transaction|trigger|type|unencrypted|union|unique|user|using|valid|value|values|view|volatile|when|where|with|without|zone)\b/i", '$1', $html); + $html = preg_replace("/\b(bigint|bigserial|bit|boolean|box|bytea|char|character|cidr|circle|date|decimal|double|float4|float8|inet|int2|int4|int8|integer|interval|line|lseg|macaddr|money|numeric|oid|path|point|polygon|precision|real|refcursor|serial|serial4|serial8|smallint|text|timestamp|varbit|varchar)\b/i", '$1', $html); + $html = preg_replace("/\b(abort|alter|analyze|begin|checkpoint|close|cluster|comment|commit|copy|create|deallocate|declare|delete|drop|end|execute|explain|fetch|grant|insert|listen|load|lock|move|notify|prepare|reindex|reset|restart|revoke|rollback|select|set|show|start|truncate|unlisten|update)\b/", '$1', $html); + $html = preg_replace("/([^:]|^)\-\-(.*?)(--$2$3', $html); + return $html; + } } -- 2.11.4.GIT