[latex3-commits] [git/LaTeX3-latex3-latex2e] gh355: Try known extensions in file with dots in the name (fixes #355) (02ddf2a6)

PhelypeOleinik phelype.oleinik at latex-project.org
Sun Aug 30 22:54:18 CEST 2020


Repository : https://github.com/latex3/latex2e
On branch  : gh355
Link       : https://github.com/latex3/latex2e/commit/02ddf2a61c2b5a0cf682b4fe8bb9921da65b79e8

>---------------------------------------------------------------

commit 02ddf2a61c2b5a0cf682b4fe8bb9921da65b79e8
Author: PhelypeOleinik <phelype.oleinik at latex-project.org>
Date:   Sun Aug 30 17:54:18 2020 -0300

    Try known extensions in file with dots in the name (fixes #355)
    
    This changes the behaviour when searching graphics files and both
    'file.exta' and 'file.exta.extb' exist, and 'exta' is not a known
    graphics extension.  In that case, the list of known extensions is
    searched, and if 'extb' is valid, that file is tried instead.


>---------------------------------------------------------------

02ddf2a61c2b5a0cf682b4fe8bb9921da65b79e8
 required/graphics/graphics.dtx | 54 +++++++++++++++++++++++++-----------------
 1 file changed, 32 insertions(+), 22 deletions(-)

diff --git a/required/graphics/graphics.dtx b/required/graphics/graphics.dtx
index 2e2ff678..51ef9a4e 100644
--- a/required/graphics/graphics.dtx
+++ b/required/graphics/graphics.dtx
@@ -25,7 +25,7 @@
 %<driver> \ProvidesFile{graphics.drv}
 % \fi
 %         \ProvidesFile{graphics.dtx}
-          [2020/08/09 v1.4b  Standard LaTeX Graphics (DPC,SPQR)]
+          [2020/08/30 v1.4c  Standard LaTeX Graphics (DPC,SPQR)]
 %
 % \iffalse
 %<*driver>
@@ -1134,30 +1134,40 @@
   \else
     \Gin at getbase{\Gin at sepdefault\filename at ext}%
 %    \end{macrocode}
-% At this point try adding an extension, even if the filename has one so
-% that \verb|a.b| may find \verb|a.b.png| if no file is found then revert
-% to the extension as given to get better error reporting.
+% At this point try adding an extension, either if the given file name
+% has none, or if the extension matches no existing graphics inclusion
+% rule, so that \verb|a.b| may find \verb|a.b.png|, if only the latter
+% or if both files exist. If no file is found then revert to the
+% extension as given to get better error reporting.
 %
 % \changes{v1.3d}{2019/11/01}
-%     {Try adding an extension even if the filenam had a dot.}
-%    \begin{macrocode}
-\ifx\Gin at ext\relax
-\let\Gin at savedbase\filename at base
-\let\Gin at savedext\filename at ext
-  \edef\filename at base{\filename at base\Gin at sepdefault\filename at ext}%
-  \let\filename at ext\relax
-   \@for\Gin at temp:=\Gin at extensions\do{%
-      \ifx\Gin at ext\relax
-        \Gin at getbase\Gin at temp
-      \fi}%
-%    \end{macrocode}
-% Restore if no file found using theknown extensions.
+%     {Try adding an extension even if the filename had a dot.}
+% \changes{v1.4c}{2020/08/30}
+%     {Try adding an extension even if the filename had a dot AND
+%      if the filename without the extension exists (but doesn't have
+%      a known extension).}
+%    \begin{macrocode}
+    \ifnum0%
+        \ifx\Gin at ext\relax 1%
+        \else \@ifundefined{Gin at rule@\Gin at ext}{1}{0}%
+        \fi >0
+      \let\Gin at ext\relax
+      \let\Gin at savedbase\filename at base
+      \let\Gin at savedext\filename at ext
+      \edef\filename at base{\filename at base\Gin at sepdefault\filename at ext}%
+      \let\filename at ext\relax
+      \@for\Gin at temp:=\Gin at extensions\do{%
+          \ifx\Gin at ext\relax
+            \Gin at getbase\Gin at temp
+          \fi}%
+%    \end{macrocode}
+% Restore if no file found using the known extensions.
 %    \begin{macrocode}
-  \ifx\Gin at ext\relax
-    \let\filename at base\Gin at savedbase
-    \let\filename at ext\Gin at savedext
-  \fi
-\fi
+      \ifx\Gin at ext\relax
+        \let\filename at base\Gin at savedbase
+        \let\filename at ext\Gin at savedext
+      \fi
+    \fi
 %    \end{macrocode}
 %
 %    \begin{macrocode}





More information about the latex3-commits mailing list.