summaryrefslogtreecommitdiff
path: root/MODULES.html.sh
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2023-04-17 13:41:57 +0200
committerBruno Haible <bruno@clisp.org>2023-04-17 13:41:57 +0200
commit879c7d6ecfa968a66eb202d5094747064b5e9ff6 (patch)
tree158df7bdc31a0099c40658c1fbcd41781f8d7025 /MODULES.html.sh
parent02287d59a1923059f896bb71d5cd00de6d0acff2 (diff)
downloadgnulib-879c7d6ecfa968a66eb202d5094747064b5e9ff6.tar.gz
MODULES.html.sh: Ensure hyperlinked files are displayable.
* MODULES.html.sh (repo_url_prefix): Use cgit instead of gitweb.
Diffstat (limited to 'MODULES.html.sh')
-rwxr-xr-xMODULES.html.sh38
1 files changed, 37 insertions, 1 deletions
diff --git a/MODULES.html.sh b/MODULES.html.sh
index 0f8294ed56..5892711519 100755
--- a/MODULES.html.sh
+++ b/MODULES.html.sh
@@ -24,13 +24,49 @@ PATH=`dirname "$0"`:$PATH; export PATH
POSIX2001_URL='https://pubs.opengroup.org/onlinepubs/009695399'
POSIX2008_URL='https://pubs.opengroup.org/onlinepubs/9699919799'
+# repo_url_prefix and repo_url_suffix are chosen such that
+# <A HREF="${repo_url_prefix}FILENAME${repo_url_suffix}">...</A>
+# will allow to open the hyperlink and thus see the contents of FILENAME
+# in the browser.
+#
+# There are two possible ways to access files in the git repository:
+# - Through gitweb. This is the preferred UI for humans.
+# repo_url_prefix='https://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob_plain;f='
+# repo_url_suffix=''
+# - Through cgit.
+# repo_url_prefix='https://git.savannah.gnu.org/cgit/gnulib.git/plain/'
+# repo_url_suffix=''
+#
+# Unfortunately, the response headers of gitweb are not right. For example, for
+# FILENAME = lib/stdlib.in.h, gitweb's response headers are:
+# Content-Type: text/x-chdr; charset=ISO-8859-1
+# Content-disposition: inline; filename="lib/stdlib.in.h"
+# whereas cgit's response headers are:
+# Content-Type: text/plain; charset=UTF-8
+# Content-Disposition: inline; filename="stdlib.in.h"
+# gitweb's response headers have three problems:
+# * The content type for .h file is text/x-chdr, for .c files is text/x-csrc.
+# The effect of this content type is that Firefox (on Ubuntu 22.04), by
+# default, does not display the contents of the file but instead opens a
+# download (save) dialog. This is unwelcome in this context.
+# * The charset=ISO-8859-1 causes incorrect display of non-ASCII characters
+# for files such as m4/fnmatch.m4, since all of the gnulib repository is
+# in UTF-8.
+# * The filename="lib/stdlib.in.h" causes Firefox to propose a file name
+# 'lib_stdlib.in.h', if the user has chosen to download the file.
+# These problems come from the gitweb implementation, as can be seen from
+# https://repo.or.cz/git.git/blame_incremental/HEAD:/gitweb/gitweb.perl
+# procedure "sub git_blob_plain". It ends up determining the content type
+# based on some MIME type registry, such as /etc/mime.types.
+#
+# So, we better choose cgit here.
repo_url_prefix=
repo_url_suffix=
if test $# != 0; then
case "$1" in
--git-urls)
# Generate URLs to the official gnulib git repository.
- repo_url_prefix='https://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob_plain;f='
+ repo_url_prefix='https://git.savannah.gnu.org/cgit/gnulib.git/plain/'
repo_url_suffix=''
;;
esac