Histoire d'avoir des sources joliment affichés dans un objectif d'être plus lisibles, j'ai effectué les modifications suivante par rapport à une installation standard de gitweb : * installation des paquets `source-highlight` et `recode` * ajout de la ligne suivante dans `/usr/share/source-highlight/outlang,map` : {{{ html-raw = html-raw.outlang }}} * création du fichier `/usr/share/source-highlight/html-raw.outlang` avec le contenu suivant : {{{ include "html_common.outlang" doctemplate "" "" end }}} * modification de `/usr/lib/cgi-bin/gitweb.cgi` selon le diff unifié suivant : {{{#!diff --- gitweb.cgi.orig 2008-09-08 03:21:20.000000000 -0400 +++ gitweb.cgi 2008-10-23 18:35:44.000000000 -0400 @@ -3143,7 +3143,7 @@ } my ($have_blame) = gitweb_check_feature('blame'); - open my $fd, "-|", git_cmd(), "cat-file", "blob", $hash + open my $fd, "-|", "/usr/local/lib/gitweb-cat-file", "--git-dir=".$git_dir, "blob", $hash or die_error(undef, "Couldn't cat $file_name, $hash"); my $mimetype = blob_mimetype($fd, $file_name); if ($mimetype !~ m/^text\//) { @@ -3187,13 +3187,15 @@ git_print_page_path($file_name, "blob", $hash_base); print "
\n"; my $nr; + binmode STDOUT, ':raw'; while (my $line = <$fd>) { chomp $line; $nr++; $line = untabify($line); printf "
%4i %s
\n", - $nr, $nr, $nr, esc_html($line, -nbsp=>1); + $nr, $nr, $nr, $line; } + binmode STDOUT, ':utf8'; close $fd or print "Reading blob failed.\n"; print "
"; }}} * création du fichier exécutable `/usr/local/lib/gitweb-cat-file` avec le contenu suivant : {{{#!shell #!/bin/sh # gitweb-cat-file, by Progfou, Oct.2008 # Depends: source-highlight recode export LANG="fr_FR.UTF-8" TEMPFILE=`tempfile` GITDIR=$1 ; shift /usr/bin/git $GITDIR cat-file "$@" >$TEMPFILE FIRSTLINE="`head -1 $TEMPFILE`" case $FIRSTLINE in *python*) COMMAND="source-highlight -f html-raw -s python" ;; *perl*) COMMAND="source-highlight -f html-raw -s perl" ;; "