From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?iso-8859-1?q?L=E9na=EFc_Huard?= Subject: Re: [PATCH] gitweb: provide a way to customize html headers Date: Fri, 21 Oct 2011 09:09:29 +0200 Message-ID: <201110210909.30145.lenaic@lhuard.fr.eu.org> References: <201110170928.56075.lenaic@lhuard.fr.eu.org> <201110210046.34679.lenaic@lhuard.fr.eu.org> <7vmxcv89jl.fsf@alter.siamese.dyndns.org> Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Jakub Narebski , git@vger.kernel.org To: Junio C Hamano X-From: git-owner@vger.kernel.org Fri Oct 21 09:09:48 2011 Return-path: Envelope-to: gcvg-git-2@lo.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RH9Ed-0004nC-LH for gcvg-git-2@lo.gmane.org; Fri, 21 Oct 2011 09:09:43 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752886Ab1JUHJj convert rfc822-to-quoted-printable (ORCPT ); Fri, 21 Oct 2011 03:09:39 -0400 Received: from freebox.lhuard.fr.eu.org ([88.182.161.122]:55723 "EHLO coruscant.lhuard.fr.eu.org" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752030Ab1JUHJi convert rfc822-to-8bit (ORCPT ); Fri, 21 Oct 2011 03:09:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lhuard.fr.eu.org; s=dkim; h=Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:In-Reply-To:References:Cc:Date:Subject:To:From; bh=PnqJS9Hhjui19bpwm1wI0pY5lo1DGtKQw/lU0KwXE9U=; b=h0GYtgm7DGPGvBkQEB2hi8OfQWNiJ5P8SoOBy8SDdPo+HerEl5r+2g1uFJy9Xu9PU6geaKvRIDBYmtGrXKRUideYAuCZSi0XN0ot+P9LDj50mdTpeCLoWq/zoVnjPmGNz/NH7QVQpIR0dBqnIoJN8BmOmVRKpM7J22wKjuhVypo=; Received: from lenaic by coruscant.lhuard.fr.eu.org with local (Exim 4.76) (envelope-from ) id 1RH9EQ-0004O2-Cm; Fri, 21 Oct 2011 09:09:30 +0200 User-Agent: KMail/1.13.7 (Linux/3.0.0-2-amd64; KDE/4.6.5; x86_64; ; ) In-Reply-To: <7vmxcv89jl.fsf@alter.siamese.dyndns.org> Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: This allows web sites to add some specific html headers to the pages generated by gitweb. The new variable $site_html_head_string can be set to an html snippet t= hat will be inserted at the end of the section of each page generate= d by gitweb. Signed-off-by: L=E9na=EFc Huard --- Le vendredi 21 octobre 2011, Junio C Hamano a =E9crit : > It might have been better if GITWEB_SITE_(HEADER|FOOTER) were named w= ith > "_FILE" suffix, but as long as we consider/declare insert_file is the= norm > and in-place inclusion of mini-string is an oddball, it is sufficient= to > call this GITWEB_SITE_HTML_HEAD_STRING to avoid confusion? Indeed, things will be clearer like this. Documentation/gitweb.conf.txt | 5 +++++ gitweb/INSTALL | 2 ++ gitweb/Makefile | 2 ++ gitweb/gitweb.perl | 7 +++++++ t/gitweb-lib.sh | 1 + 5 files changed, 17 insertions(+), 0 deletions(-) diff --git a/Documentation/gitweb.conf.txt b/Documentation/gitweb.conf.= txt index 4ca3e27..7aba497 100644 --- a/Documentation/gitweb.conf.txt +++ b/Documentation/gitweb.conf.txt @@ -364,6 +364,11 @@ $site_name:: + Can be set using the `GITWEB_SITENAME` at build time. Unset by defaul= t. =20 +$site_html_head_string:: + HTML snippet to be included in the section of each page. + Can be set using `GITWEB_SITE_HTML_HEAD_STRING` at build time. + No default value. + $site_header:: Name of a file with HTML to be included at the top of each page. Relative to the directory containing the 'gitweb.cgi' script. diff --git a/gitweb/INSTALL b/gitweb/INSTALL index d134ffe..6d45406 100644 --- a/gitweb/INSTALL +++ b/gitweb/INSTALL @@ -130,6 +130,8 @@ You can specify the following configuration variabl= es when building GIT: Points to an .html file which is included on the gitweb project overview page ('projects_list' view), if it exists. Relative to gitweb.cgi script. [Default: indextext.html] + * GITWEB_SITE_HTML_HEAD_STRING + html snippet to include in the section of each page. [No def= ault] * GITWEB_SITE_HEADER Filename of html text to include at top of each page. Relative to gitweb.cgi script. [No default] diff --git a/gitweb/Makefile b/gitweb/Makefile index 1c85b5f..e65fc27 100644 --- a/gitweb/Makefile +++ b/gitweb/Makefile @@ -34,6 +34,7 @@ GITWEB_CSS =3D static/gitweb.css GITWEB_LOGO =3D static/git-logo.png GITWEB_FAVICON =3D static/git-favicon.png GITWEB_JS =3D static/gitweb.js +GITWEB_SITE_HTML_HEAD_STRING =3D GITWEB_SITE_HEADER =3D GITWEB_SITE_FOOTER =3D HIGHLIGHT_BIN =3D highlight @@ -144,6 +145,7 @@ GITWEB_REPLACE =3D \ -e 's|++GITWEB_LOGO++|$(GITWEB_LOGO)|g' \ -e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \ -e 's|++GITWEB_JS++|$(GITWEB_JS)|g' \ + -e 's|++GITWEB_SITE_HTML_HEAD_STRING++|$(GITWEB_SITE_HTML_HEAD_STRING= )|g' \ -e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \ -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \ -e 's|++HIGHLIGHT_BIN++|$(HIGHLIGHT_BIN)|g' diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 85d64b2..fa9b83b 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -85,6 +85,8 @@ our $home_link_str =3D "++GITWEB_HOME_LINK_STR++"; our $site_name =3D "++GITWEB_SITENAME++" || ($ENV{'SERVER_NAME'} || "Untitled") . " Git"; =20 +# html snippet to include in the section of each page +our $site_html_head_string =3D "++GITWEB_SITE_HTML_HEAD_STRING++"; # filename of html text to include at top of each page our $site_header =3D "++GITWEB_SITE_HEADER++"; # html text to include at home page @@ -3879,6 +3881,11 @@ EOF print "\n"; } print_header_links($status); + + if (defined $site_html_head_string) { + print to_utf8($site_html_head_string); + } + print "\n" . "\n"; =20 diff --git a/t/gitweb-lib.sh b/t/gitweb-lib.sh index 292753f..21d11d6 100644 --- a/t/gitweb-lib.sh +++ b/t/gitweb-lib.sh @@ -16,6 +16,7 @@ our \$projectroot =3D "$safe_pwd"; our \$project_maxdepth =3D 8; our \$home_link_str =3D 'projects'; our \$site_name =3D '[localhost]'; +our \$site_html_head_string =3D ''; our \$site_header =3D ''; our \$site_footer =3D ''; our \$home_text =3D 'indextext.html'; --=20 1.7.7