Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
gitweb: provide a way to customize html headers
author
Lénaïc Huard
<lenaic@lhuard.fr.eu.org>
Fri, 21 Oct 2011 07:09:29 +0000
(09:09 +0200)
committer
Junio C Hamano
<gitster@pobox.com>
Fri, 21 Oct 2011 17:18:37 +0000
(10:18 -0700)
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 that
will be inserted at the end of the <head> section of each page generated
by gitweb.
Signed-off-by: Lénaïc Huard <lenaic@lhuard.fr.eu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/gitweb.conf.txt
patch
|
blob
|
history
gitweb/INSTALL
patch
|
blob
|
history
gitweb/Makefile
patch
|
blob
|
history
gitweb/gitweb.perl
patch
|
blob
|
history
t/gitweb-lib.sh
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
55752fa
)
diff --git
a/Documentation/gitweb.conf.txt
b/Documentation/gitweb.conf.txt
index 4ca3e27dc97b81f73215391569f62d52550e33c1..7aba497b74540499f45ca135bc094ecdffff240a 100644
(file)
--- 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 default.
+
Can be set using the `GITWEB_SITENAME` at build time. Unset by default.
+$site_html_head_string::
+ HTML snippet to be included in the <head> 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.
$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 d134ffe4c75fcc303631cdac15c1bed011c45fd1..6d4540679731bdfd33af61635c59b798b19a8888 100644
(file)
--- a/
gitweb/INSTALL
+++ b/
gitweb/INSTALL
@@
-130,6
+130,8
@@
You can specify the following configuration variables 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]
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 <head> section of each page. [No default]
* GITWEB_SITE_HEADER
Filename of html text to include at top of each page. Relative to
gitweb.cgi script. [No default]
* 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 1c85b5fda8bc994e0ecd249e11e8f2331098bea9..e65fc27e4f21b1ef4ca87f79e90202166d8b0144 100644
(file)
--- a/
gitweb/Makefile
+++ b/
gitweb/Makefile
@@
-34,6
+34,7
@@
GITWEB_CSS = static/gitweb.css
GITWEB_LOGO = static/git-logo.png
GITWEB_FAVICON = static/git-favicon.png
GITWEB_JS = static/gitweb.js
GITWEB_LOGO = static/git-logo.png
GITWEB_FAVICON = static/git-favicon.png
GITWEB_JS = static/gitweb.js
+GITWEB_SITE_HTML_HEAD_STRING =
GITWEB_SITE_HEADER =
GITWEB_SITE_FOOTER =
HIGHLIGHT_BIN = highlight
GITWEB_SITE_HEADER =
GITWEB_SITE_FOOTER =
HIGHLIGHT_BIN = highlight
@@
-144,6
+145,7
@@
GITWEB_REPLACE = \
-e 's|++GITWEB_LOGO++|$(GITWEB_LOGO)|g' \
-e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \
-e 's|++GITWEB_JS++|$(GITWEB_JS)|g' \
-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'
-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 70a576a626ac67516af7b980c64ec33da6b7c19b..d33510804ba34afa90c263cb20485d8fc3b0ce46 100755
(executable)
--- a/
gitweb/gitweb.perl
+++ b/
gitweb/gitweb.perl
@@
-85,6
+85,8
@@
sub evaluate_uri {
our $site_name = "++GITWEB_SITENAME++"
|| ($ENV{'SERVER_NAME'} || "Untitled") . " Git";
our $site_name = "++GITWEB_SITENAME++"
|| ($ENV{'SERVER_NAME'} || "Untitled") . " Git";
+# html snippet to include in the <head> section of each page
+our $site_html_head_string = "++GITWEB_SITE_HTML_HEAD_STRING++";
# filename of html text to include at top of each page
our $site_header = "++GITWEB_SITE_HEADER++";
# html text to include at home page
# filename of html text to include at top of each page
our $site_header = "++GITWEB_SITE_HEADER++";
# html text to include at home page
@@
-3868,6
+3870,11
@@
sub git_header_html {
print "<base href=\"".esc_url($base_url)."\" />\n";
}
print_header_links($status);
print "<base href=\"".esc_url($base_url)."\" />\n";
}
print_header_links($status);
+
+ if (defined $site_html_head_string) {
+ print to_utf8($site_html_head_string);
+ }
+
print "</head>\n" .
"<body>\n";
print "</head>\n" .
"<body>\n";
diff --git
a/t/gitweb-lib.sh
b/t/gitweb-lib.sh
index 292753f77c4daf5f3cb55de1c28269b13455544f..21d11d6c2d65982d94f933b2a673b744cbc2e28a 100644
(file)
--- a/
t/gitweb-lib.sh
+++ b/
t/gitweb-lib.sh
@@
-16,6
+16,7
@@
our \$projectroot = "$safe_pwd";
our \$project_maxdepth = 8;
our \$home_link_str = 'projects';
our \$site_name = '[localhost]';
our \$project_maxdepth = 8;
our \$home_link_str = 'projects';
our \$site_name = '[localhost]';
+our \$site_html_head_string = '';
our \$site_header = '';
our \$site_footer = '';
our \$home_text = 'indextext.html';
our \$site_header = '';
our \$site_footer = '';
our \$home_text = 'indextext.html';