diff -Naur latex2html-2024.orig/docs/l2hfiles.dat latex2html-2024/docs/l2hfiles.dat
--- latex2html-2024.orig/docs/l2hfiles.dat 2024-01-01 22:13:03.000000000 +0700
+++ latex2html-2024/docs/l2hfiles.dat 2024-05-28 12:33:22.273968338 +0700
@@ -190,6 +190,7 @@
\item[\gn{\$TOP\_NAVIGATION}] when set, a navigation panel is placed at the top of every \texttt{HTML} page, unless overridden by \fn{\$NO\_NAVIGATION} being set also
\item[\gn{\$TRANSPARENT\_FIGURES}] when set, this specifies that the background of generated images should be made transparent
\item[\gn{\$TRANSPARENT\_IMAGES}] when set, this \emph{prevents} the background of images from being made transparent (no longer used)
+\item[\gn{\$UNICASE\_TITLES}] when set, duplication of generated filenames for \texttt{HTML} pages is checked in case insensitive manner
\item[\gn{\$UNSEGMENT}] when set, \latextohtml{} translates a segmented document as a whole rather than a single segment; use this for testing your segmented document
\item[\gn{\$UP}] when navigation panels are created, this holds a hyperlink to the parent \texttt{HTML} page
\item[\gn{\$UP\_TITLE}] when navigation panels are created, this holds a title of the parent \texttt{HTML} page
diff -Naur latex2html-2024.orig/docs/userman.tex latex2html-2024/docs/userman.tex
--- latex2html-2024.orig/docs/userman.tex 2024-01-01 22:13:03.000000000 +0700
+++ latex2html-2024/docs/userman.tex 2024-05-28 12:34:01.584377906 +0700
@@ -237,11 +237,18 @@
for that page, separated by the `\texttt{\_}' character.\html{\\}
Commas and common short words (\texttt{a an to by of and for the})
are omitted from both title and word-count.
+When duplication of constructed filenames is detected (see also the
+\htmlref{-unicase\_titles}{cs_unicasetitles} option),
+an incremented number starting from 2 is appended to each duplicated filename.
-\smallskip\noindent
-\textbf{Warning:} Use this switch with great caution.
-Currently there are no checks for uniqueness of names or overall length.
-Very long names can easily result from using this feature.%
+\index{filenames!long names}
+\index{filenames!case insensitive}
+
+\item [ -unicase\_titles\label{cs_unicasetitles}]
+\sameas{\fn{\$UNICASE\_TITLES}\texttt{ = 1;}}\\
+If set, and the \htmlref{-long\_titles}{cs_longtitles} option is used,
+duplication of generated filenames is checked in case insensitive manner.
+Useful under case insensitive filesystems such as NTFS or FAT.
\index{filenames!customised}%
\index{filenames!custom title hook@\texttt{custom\_title\_hook}}
diff -Naur latex2html-2024.orig/l2hconf.pin latex2html-2024/l2hconf.pin
--- latex2html-2024.orig/l2hconf.pin 2024-01-01 22:13:03.000000000 +0700
+++ latex2html-2024/l2hconf.pin 2024-05-28 12:34:29.734671249 +0700
@@ -997,6 +997,15 @@
# or when you specify the language through the babel package.
+# When the -long_titles option is used, duplication of generated filenames
+# which differ only in letter case is checked as follows:
+# $UNICASE_TITLES = 0: such filenames are treated as unique
+# (for case sensitive filesystems typical under Unix)
+# $UNICASE_TITLES = 1: such filenames are treated as duplicated
+# (for case insensitive filesystems such as NTFS or FAT)
+$UNICASE_TITLES = 0;
+
+
### Verbosity #################################################################
#
# -verbosity
diff -Naur latex2html-2024.orig/latex2html.1 latex2html-2024/latex2html.1
--- latex2html-2024.orig/latex2html.1 2024-01-01 22:13:03.000000000 +0700
+++ latex2html-2024/latex2html.1 2024-05-28 12:35:00.024986931 +0700
@@ -76,9 +76,19 @@
section heading for that page, separated by the `_' character.
Commas and common short words (a an to by of and for the) are omitted
from both title and word-count.
-Warning: Use this switch with great caution. Currently there are no
-checks for uniqueness of names or overall length. Very long names can
-easily result from using this feature.
+When duplication of constructed filenames is detected (see also the
+.B -unicase_titles
+option), an incremented number starting from 2
+is appended to each duplicated filename.
+.TP
+.B -unicase_titles
+Same as setting:
+.I $UNICASE_TITLES = 1;
+If set, and the
+.B -long_titles
+option is used, duplication of generated filenames
+is checked in case insensitive manner.
+Useful under case insensitive filesystems such as NTFS or FAT.
.TP
.B -custom_titles
Same as setting:
diff -Naur latex2html-2024.orig/latex2html.pin latex2html-2024/latex2html.pin
--- latex2html-2024.orig/latex2html.pin 2024-01-01 22:13:03.000000000 +0700
+++ latex2html-2024/latex2html.pin 2024-05-28 12:35:26.205259816 +0700
@@ -274,6 +274,7 @@
'prefix=s', \$PREFIX,
'auto_prefix!', \$AUTO_PREFIX,
'long_titles=i', \$LONG_TITLES,
+ 'unicase_titles!', \$UNICASE_TITLES,
'custom_titles!', \$CUSTOM_TITLES,
'title|t=s', \$TITLE,
'rooted!', \$ROOTED,
@@ -695,6 +696,26 @@
print "\n *** initialise *** " if ($VERBOSITY > 1);
&initialise; # Initialise some global variables
+ # Early reservation of filename for auto-linked index.html to avoid
+ # eventual duplication if some later generated page would get name 'Index'.
+ # This code to generate "$to" adopted from the do-block with the clause
+ # "L2hos->Link($from,$to);" about 200 lines later.
+ do {
+ local($EXTN) = $EXTN;
+ $EXTN =~ s/_\w+(\.html?)/$1/ if ($frame_main_name);
+ local($from,$to) = (eval($LINKPOINT),eval($LINKNAME));
+ $from = &make_long_title($LONG_LINKPOINT) . $EXTN
+ if ($LONG_TITLES && $LONG_LINKPOINT);
+ if (length($from) && length($to) && ($from ne $to)) {
+ $to =~ s/$frame_main_name(\.html?)/$1/ if ($frame_main_name);
+ if ($UNICASE_TITLES) {
+ $nodenames{"\L$to"} = 1;
+ } else {
+ $nodenames{$to} = 1;
+ }
+ }
+ } unless ($NO_AUTO_LINK || !($LINKPOINT) || !($LINKNAME));
+
print "\n *** check modes *** " if ($VERBOSITY > 1);
&ascii_mode if $ASCII_MODE; # Must come after initialization
&titles_language($TITLES_LANGUAGE);
@@ -9876,7 +9897,7 @@
sub make_name {
local($sec_name, $packed_curr_sec_id) = @_;
local($title,$making_name,$saved) = ('',1,'');
- local($filename) = '';
+ local($filename,$dupname) = ('','');
if ($LONG_TITLES) {
$saved = $_;
&process_command($sections_rx, $_) if /^$sections_rx/;
@@ -9896,12 +9917,14 @@
++$OUT_NODE;
$filename = join("", ${PREFIX}, $title, $EXTN);
# Avoid duplication of filenames
- unless ($nodenames{$filename}) {
- $nodenames{$filename} = 1;
+ $dupname = $filename;
+ $dupname = "\L$filename" if $UNICASE_TITLES;
+ unless ($nodenames{$dupname}) {
+ $nodenames{$dupname} = 1;
} else {
# Duplication detected: add version number to generated filename
$filename =
- join("", ${PREFIX}, $title, ++$nodenames{$filename}, $EXTN);
+ join("", ${PREFIX}, $title, ++$nodenames{$dupname}, $EXTN);
}
$filename;
} else {
@@ -17650,6 +17673,7 @@
S<[ B<-prefix> I ]>
S<[ B<->(B)B ]>
S<[ B<-long_titles> I ]>
+S<[ B<->(B)B ]>
S<[ B<->(B)B ]>
S<[ B<-title>|B<-t> I ]>
S<[ B<->(B)B ]>
@@ -17869,7 +17893,15 @@
The filenames for each HTML page are constructed from the first I
words of the section heading for that page, separated by the `_'
-character.
+character. When duplication of constructed filenames is detected
+(see also the B<-unicase_titles> option), an incremented number
+(starting from 2) is appended to each duplicated filename.
+
+=item B<->(B)B
+
+If set, and the B<-long_titles> option is used, duplication of
+generated filenames is checked in case insensitive manner.
+Useful under case insensitive filesystems such as NTFS or FAT.
=item B<->(B)B