[latex3-commits] [git/LaTeX3-latex3-latex3] main: Fix graphic searching with multiple extensions (14ef39444)

Joseph Wright joseph.wright at morningstar2.co.uk
Mon Apr 11 18:45:47 CEST 2022


Repository : https://github.com/latex3/latex3
On branch  : main
Link       : https://github.com/latex3/latex3/commit/14ef394444b9a601b6dc3b234aeba0a4fe520e46

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

commit 14ef394444b9a601b6dc3b234aeba0a4fe520e46
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Mon Apr 11 17:45:43 2022 +0100

    Fix graphic searching with multiple extensions
    
    Test coming up in a later commit.


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

14ef394444b9a601b6dc3b234aeba0a4fe520e46
 l3experimental/CHANGELOG.md              |  3 +++
 l3experimental/l3graphics/l3graphics.dtx | 16 ++++++++++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/l3experimental/CHANGELOG.md b/l3experimental/CHANGELOG.md
index eb5896536..fbcbca4ac 100644
--- a/l3experimental/CHANGELOG.md
+++ b/l3experimental/CHANGELOG.md
@@ -7,6 +7,9 @@ this project uses date-based 'snapshot' version identifiers.
 
 ## [Unreleased]
 
+### Fixed
+- Finding graphics files with multiple extensions
+
 ## [2022-04-10]
 
 ### Added
diff --git a/l3experimental/l3graphics/l3graphics.dtx b/l3experimental/l3graphics/l3graphics.dtx
index cf4a70983..28231c69b 100644
--- a/l3experimental/l3graphics/l3graphics.dtx
+++ b/l3experimental/l3graphics/l3graphics.dtx
@@ -631,7 +631,9 @@
 % \begin{macro}{\graphics_get_full_name:nN}
 % \begin{macro}[TF]{\graphics_get_full_name:nN}
 % \begin{macro}{\@@_get_full_name:n}
-%   A simple search.
+%   As well as searching by path, etc., there is a need here to check that
+%   we do not trip over |foo.bar| if |.bar| is not a known extension for
+%   the current backend.
 %    \begin{macrocode}
 \cs_new_protected:Npn \graphics_get_full_name:nN #1#2
   {
@@ -645,8 +647,18 @@
       \seq_set_eq:NN \l_file_search_path_seq \l_graphics_search_path_seq
       \file_get_full_name:nNTF {#1} \l_@@_full_name_str
         {
-          \str_if_eq:eeT { \l_@@_full_name_str } { #1 .tex }
+          \str_if_eq:eeTF { \l_@@_full_name_str } { #1 .tex }
             { \@@_get_full_name:n {#1} }
+            {
+              \file_parse_full_name:VNNN \l_@@_full_name_str
+                \l_@@_dir_str \l_@@_name_str \l_@@_ext_str
+              \seq_map_inline:Nn \l_graphics_search_ext_seq
+                {
+                  \str_if_eq:nVT {##1} \l_@@_ext_str
+                    { \seq_map_break:n { \use_none:nn } }
+                }
+                  \@@_get_full_name:n {#1}
+            }
         }
         { \@@_get_full_name:n {#1} }
     \exp_args:NNNV \group_end:





More information about the latex3-commits mailing list.