[latex3-commits] [git/LaTeX3-latex3-latex3] master: Allow for .tex files in image inclusion (f278639)
Joseph Wright
joseph.wright at morningstar2.co.uk
Wed May 8 18:40:27 CEST 2019
Repository : https://github.com/latex3/latex3
On branch : master
Link : https://github.com/latex3/latex3/commit/f27863973373bbdb4edc1e4d1206c44de3373752
>---------------------------------------------------------------
commit f27863973373bbdb4edc1e4d1206c44de3373752
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date: Wed May 8 17:40:27 2019 +0100
Allow for .tex files in image inclusion
>---------------------------------------------------------------
f27863973373bbdb4edc1e4d1206c44de3373752
l3experimental/l3image/l3image.dtx | 43 ++++++++++++++++++++++++++++++------
1 file changed, 36 insertions(+), 7 deletions(-)
diff --git a/l3experimental/l3image/l3image.dtx b/l3experimental/l3image/l3image.dtx
index 2bb9e13..1dc44d8 100644
--- a/l3experimental/l3image/l3image.dtx
+++ b/l3experimental/l3image/l3image.dtx
@@ -494,31 +494,59 @@
% \end{variable}
%
% \begin{macro}{\image_include:n}
+% \begin{macro}{\@@_include_search:n}
% \begin{macro}{\@@_include:}
% \begin{macro}{\image_include:nn}
% \begin{macro}{\@@_include:n}
% Actually including an image is relatively straight-forward: most of the
% work is done by the driver. We only have to deal with making sure the
% box has no apparent depth. Where the first given name is not found, we
-% search based on extension only if the \meta{type} was not given.
+% search based on extension only if the \meta{type} was not given. The one
+% wrinkle is that we may have found a \texttt{.tex} file matching the file
+% name stem: that's not what we want, so we have to filter out.
% \begin{macrocode}
\cs_new_protected:Npn \image_include:n #1
{
\group_begin:
\seq_set_eq:NN \l_file_search_path_seq \l_image_search_path_seq
\file_get_full_name:nNTF {#1} \l_@@_name_tl
- { \@@_include: }
{
- \seq_map_inline:Nn \l_image_search_ext_seq
+ \use:x
{
- \file_get_full_name:nNT { #1 . ##1 } \l_@@_name_tl
- { \seq_map_break:n { \use_i:nnn \@@_include: } }
+ \cs_set_protected:Npn \@@_include_check:w
+ ####1 #1 \tl_to_str:n { .tex }
+ ####2 #1 \tl_to_str:n { .tex }
+ ####3
+ \exp_not:N \q_stop
+ }
+ {
+ \tl_if_blank:nTF {##3}
+ { \@@_include_search:n {#1} }
+ { \@@_include: }
+ }
+ \use:x
+ {
+ \@@_include_check:w
+ \l_@@_name_tl
+ #1 \tl_to_str:n { .tex }
+ #1 \tl_to_str:n { .tex }
+ \exp_not:N \q_stop
}
- \use:n
- { \__kernel_msg_error:nnn { image } { image-not-found } {#1} }
}
+ { \@@_include_search:n {#1} }
\group_end:
}
+\cs_new_protected:Npn \@@_include_check:w { }
+\cs_new_protected:Npn \@@_include_search:n #1
+ {
+ \seq_map_inline:Nn \l_image_search_ext_seq
+ {
+ \file_get_full_name:nNT { #1 . ##1 } \l_@@_name_tl
+ { \seq_map_break:n { \use_i:nnn \@@_include: } }
+ }
+ \use:n
+ { \__kernel_msg_error:nnn { image } { image-not-found } {#1} }
+ }
\cs_new_protected:Npn \@@_include:
{
\file_parse_full_name:VNNN \l_@@_name_tl
@@ -567,6 +595,7 @@
% \end{macro}
% \end{macro}
% \end{macro}
+% \end{macro}
%
% \begin{macro}{\image_show_list:, \image_log_list:, \@@_list:N}
% \begin{macro}[EXP]{\@@_list_aux:n}
More information about the latex3-commits
mailing list