From 1716fb898de74bb3112da7bb15cb5b9deb7ba8d8 Mon Sep 17 00:00:00 2001 From: mrpiggi Date: Tue, 22 Oct 2019 22:28:58 +0200 Subject: [PATCH 1/3] remove quotes after `\IfFileExists` fixes #16 --- README.md | 3 +++ source/svg.dtx | 10 +++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index fe8f917..ed914a6 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,9 @@ it is rendered within the LaTeX document using either ***ImageMagick*** or Versions -------- +**v2.02d** (2019/10/22) ++ fix bugs with current kernel (2019/10/01) regarding file name parsing + **v2.02c** (2019/10/10) + fix bugs with current kernel (2019/10/01) regarding file name parsing diff --git a/source/svg.dtx b/source/svg.dtx index 7715e96..4ed491b 100644 --- a/source/svg.dtx +++ b/source/svg.dtx @@ -1,4 +1,4 @@ -% \CheckSum{3838} +% \CheckSum{3847} % \iffalse meta-comment % % svg and svg-extract -- Include and extract SVG pictures in LaTeX documents @@ -111,11 +111,11 @@ svg-extract -- Extract independent graphic files from SVG pictures \ifx\ProvidesFile\@undefined\def\ProvidesFile#1[#2]{}\fi \ProvidesFile{svg.dtx}[% % -%\NeedsTeXFormat{LaTeX2e} +%\NeedsTeXFormat{LaTeX2e}[2019-10-01] %\ProvidesPackage{svg}[% %\ProvidesPackage{svg-extract}[% %<*driver|package&option> - 2019/10/10 v2.02c\space% + 2019/10/22 v2.02d\space% % (include SVG pictures)% % (extract independent graphics from SVG pictures)% ] @@ -2283,6 +2283,10 @@ svg-extract -- Extract independent graphic files from SVG pictures % \begin{macrocode} \@svg@tempswafalse% \expandafter\IfFileExists\expandafter{\svg@tempa}{% + \expandafter\svg@quotes@check\expandafter{\svg@tempa}% + \if@svg@quotes@found\else% + \svg@quotes@remove{\@filef@und}% + \fi% \@svg@tempswatrue% \edef\@filef@und{\expandafter\trim@spaces\expandafter{\@filef@und}}% \svg@filename@parse[{#1}]{\@filef@und}% From f39961088370b54236bf263b3170d8a229b2e133 Mon Sep 17 00:00:00 2001 From: mrpiggi Date: Tue, 22 Oct 2019 22:30:57 +0200 Subject: [PATCH 2/3] `\svg@iffilenewer` for XeLaTeX fixes #12 --- README.md | 4 +++- source/svg.dtx | 59 +++++++++++++++++++++++++++++--------------------- 2 files changed, 37 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index ed914a6..2fb96a6 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,9 @@ Versions -------- **v2.02d** (2019/10/22) -+ fix bugs with current kernel (2019/10/01) regarding file name parsing ++ fix bugs with current kernel (2019/10/01) regarding file name parsing, see + https://github.com/mrpiggi/svg/issues/16 ++ use `\filemoddate` with XeLaTeX, see https://github.com/mrpiggi/svg/issues/12 **v2.02c** (2019/10/10) + fix bugs with current kernel (2019/10/01) regarding file name parsing diff --git a/source/svg.dtx b/source/svg.dtx index 4ed491b..e1eeaef 100644 --- a/source/svg.dtx +++ b/source/svg.dtx @@ -1,4 +1,4 @@ -% \CheckSum{3847} +% \CheckSum{3884} % \iffalse meta-comment % % svg and svg-extract -- Include and extract SVG pictures in LaTeX documents @@ -410,9 +410,7 @@ svg-extract -- Extract independent graphic files from SVG pictures % graphic~file either does not exist or the file~modification date of the % SVG~file is newer than that of the exported graphic~file. Thus the % compilation time of the \LaTeX~document can be reduced to the necessary -% minimum. Unfortunately a primitive like \cs{pdffilemoddate} is missing for -% XeTeX, so with this engine, the behaviour will be the same as -% \opt{inkscape}|=|\val{forced}. +% minimum. % \item[forced/force/overwrite] % The \app{Inkscape}~export will definitely be done, any already existing % exported file will overwritten regardlessly. @@ -601,13 +599,8 @@ svg-extract -- Extract independent graphic files from SVG pictures % PDF/EPS/PS/PNG~file (see~\opt{inkscapeformat}) and perhaps a correlating % \LaTeX~file (see~\opt{inkscapelatex}). The export with \app{Inkscape} is only % invoked, if the SVG~file is newer than the exported graphic~file or latter -% doesn't exist at all.\footnote{\ignorespaces% -% Due to the lack of XeTeX to compare file~modification dates, using this -% \LaTeX~engine leads to \app{Inkscape}~exports with every run unless -% \opt{inkscape}|=|\val{false} is used.% -% }% -% Once the export has been done, the graphic~file and maybe the \LaTeX~file are -% included. +% doesn't exist at all. Once the export has been done, the graphic~file and +% maybe the \LaTeX~file are included. % % All previously described options can also be used as optional parameters to % \cs{includesvg} and do have the same effect as described before. However, the @@ -2505,23 +2498,39 @@ svg-extract -- Extract independent graphic files from SVG pictures % \begin{macro}{\svg@iffilenewer} % The macro \cs{svg@iffilenewer} is used to decide, whether the export with % \app{Inkscape} is necessary due to an updated SVG~file. This can only be -% done, if \cs{pdf@filemoddate} is definied. Unfortunately this functionality -% isn't provided by Xe\TeX. +% done, if \cs{pdf@filemoddate} is definied. % \begin{macrocode} +\newcommand*\svg@iffilenewer[2]{\@gobbletwo} \ifx\pdf@filemoddate\@undefined - \newcommand*\svg@iffilenewer[2]{\@gobbletwo} + \ifx\filemoddate\@undefined\else + \ifx\strcmp\@undefined\else + \renewcommand*\svg@iffilenewer[2]{% + \begingroup% + \edef\svg@tempa{\filemoddate{#1}}% + \edef\svg@tempb{\filemoddate{#2}}% + \ifnum\strcmp{\svg@tempa}{\svg@tempb}>\z@\relax% + \aftergroup\@firstoftwo% + \else% + \aftergroup\@secondoftwo% + \fi% + \endgroup% + }% + \fi + \fi \else - \newcommand*\svg@iffilenewer[2]{% - \begingroup% - \edef\svg@tempa{\pdf@filemoddate{#1}}% - \edef\svg@tempb{\pdf@filemoddate{#2}}% - \ifnum\pdf@strcmp{\svg@tempa}{\svg@tempb}>\z@\relax% - \aftergroup\@firstoftwo% - \else% - \aftergroup\@secondoftwo% - \fi% - \endgroup% - } + \ifx\pdf@strcmp\@undefined\else + \renewcommand*\svg@iffilenewer[2]{% + \begingroup% + \edef\svg@tempa{\pdf@filemoddate{#1}}% + \edef\svg@tempb{\pdf@filemoddate{#2}}% + \ifnum\pdf@strcmp{\svg@tempa}{\svg@tempb}>\z@\relax% + \aftergroup\@firstoftwo% + \else% + \aftergroup\@secondoftwo% + \fi% + \endgroup% + }% + \fi \fi % \end{macrocode} % \end{macro}^^A \svg@iffilenewer From 8c49113ea88e58d31c16db726c1c767bccd075b5 Mon Sep 17 00:00:00 2001 From: mrpiggi Date: Tue, 22 Oct 2019 22:53:16 +0200 Subject: [PATCH 3/3] add changes to source --- source/svg.dtx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/source/svg.dtx b/source/svg.dtx index e1eeaef..8952e01 100644 --- a/source/svg.dtx +++ b/source/svg.dtx @@ -260,6 +260,10 @@ svg-extract -- Extract independent graphic files from SVG pictures % \changes{v2.02c}{2019/10/10}{% % fix bugs with current kernel (2019/10/01) regarding file name parsing % }^^A +% \changes{v2.02d}{2019/10/22}{% +% fix bugs with current kernel (2019/10/01) regarding file name parsing, see +% \url{https://github.com/mrpiggi/svg/issues/16} +% }^^A % \ToDo{Workaround for missing \cs{transparent} (Lua\TeX lacks support)}[v2.03] % % @@ -2496,9 +2500,13 @@ svg-extract -- Extract independent graphic files from SVG pictures % \end{macrocode} % \end{macro}^^A \svg@file@missing % \begin{macro}{\svg@iffilenewer} +% \changes{v2.02d}{2019/10/22}{% +% use \cs{filemoddate} with Xe\LaTeX, see +% \url{https://github.com/mrpiggi/svg/issues/12} +% }^^A % The macro \cs{svg@iffilenewer} is used to decide, whether the export with % \app{Inkscape} is necessary due to an updated SVG~file. This can only be -% done, if \cs{pdf@filemoddate} is definied. +% done, if \cs{pdf@filemoddate} or \cs{filemoddate} is definied. % \begin{macrocode} \newcommand*\svg@iffilenewer[2]{\@gobbletwo} \ifx\pdf@filemoddate\@undefined