summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-06-24 21:51:50 +0000
committerKarl Berry <karl@freefriends.org>2022-06-24 21:51:50 +0000
commit0011b6b38cc71f0b81f926200aa8cabe84ae8371 (patch)
tree78dad34df6c0fc3908d0e6d1e0821b67125b429c /Master/texmf-dist/tex/latex
parent49eb2d79fccd3635979501f993bd2baeb13c731b (diff)
hvextern (24jun22)
git-svn-id: svn://tug.org/texlive/trunk@63711 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rwxr-xr-xMaster/texmf-dist/tex/latex/hvextern/hvextern-checkfile.lua42
-rw-r--r--Master/texmf-dist/tex/latex/hvextern/hvextern.sty48
2 files changed, 74 insertions, 16 deletions
diff --git a/Master/texmf-dist/tex/latex/hvextern/hvextern-checkfile.lua b/Master/texmf-dist/tex/latex/hvextern/hvextern-checkfile.lua
new file mode 100755
index 00000000000..627f86d6bb8
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/hvextern/hvextern-checkfile.lua
@@ -0,0 +1,42 @@
+#!/usr/bin/env texlua
+-----------------------------------------------------------------------
+-- FILE: hvextern-checkfile.lua
+-- DESCRIPTION: check two files for identical code
+-- REQUIREMENTS:
+-- AUTHOR: Herbert Voß
+-- LICENSE: LPPL1.3
+--
+-- $Id: hvextern.lua 578 2022-06-20 16:41:45Z herbert $
+-----------------------------------------------------------------------
+kpse.set_program_name("luatex")
+
+local f = kpse.find_file("hvextern.lua")
+require('hvextern')
+
+--[[
+function GetFileContents(f1,f2)
+ local NewContents, OldContents
+ local File = io.open(f1)
+ if File then
+ NewContents = File:read('*all')
+ File:close()
+ end
+ local File = io.open(f2)
+ if File then
+ OldContents = File:read('*all')
+ File:close()
+ end
+ return NewContents == OldContents
+end
+]]
+
+local f1 = arg[1]
+local f2 = arg[2]
+diffFile = io.open(f1..".diff","w+")
+if GetFileContents(f1,f2) then
+ diffFile:write("\\let\\hvCheckNewFile\\empty")
+else
+ diffFile:write("\\def\\hvCheckNewFile{Code changes}")
+end
+diffFile:close()
+
diff --git a/Master/texmf-dist/tex/latex/hvextern/hvextern.sty b/Master/texmf-dist/tex/latex/hvextern/hvextern.sty
index a7340a2f12c..bf769253083 100644
--- a/Master/texmf-dist/tex/latex/hvextern/hvextern.sty
+++ b/Master/texmf-dist/tex/latex/hvextern/hvextern.sty
@@ -1,4 +1,4 @@
-%% $Id: hvextern.sty 577 2022-06-20 16:35:21Z herbert $
+%% $Id: hvextern.sty 579 2022-06-20 19:23:29Z herbert $
%% This is file `hvextern.sty',
%%
%% Copyright (C) 2016-22
@@ -12,8 +12,8 @@
%% and version 1.3c or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
-\def\hvexternFileversion{0.31}
-\ProvidesFile{hvextern}[2022/06/20 v\hvexternFileversion: package for running external documents (HV)]
+\def\hvexternFileversion{0.32}
+\ProvidesFile{hvextern}[2022/06/23 v\hvexternFileversion: package for running external documents (HV)]
\newif\ifhv@extern@checkCode
\hv@extern@checkCodefalse
@@ -190,15 +190,15 @@
\ResetKeys
-\ifluatex
- \ifhv@extern@checkCode
+\ifhv@extern@checkCode
+ \ifluatex
\hv@ex@typeout{Loading hvextern.lua}%
- \directlua{dofile("hvextern.lua")}%
- \fi
-\else
- \ifhv@extern@checkCode
- \hv@ex@typeout{You need lualatex for option checkCode. Will disable the option!}%
- \hv@extern@checkCodefalse
+ \directlua{kpse.set_program_name("luatex")require "hvextern.lua" }%
+ \else
+ \ifhv@extern@checkCode
+ \hv@ex@typeout{Using xelatex or pdflatex! Will use a temporary file for diff}%
+% \hv@extern@checkCodefalse
+ \fi
\fi
\fi
@@ -445,12 +445,27 @@
\expandafter\hvExternSetKeys\expandafter{\hv@extern@savePara}%
\xdef\hv@extern@fullPath{\hv@extern@ExamplesDir\hvExternDateiname}%
\ifhv@extern@checkCode
- \directlua{if GetFileContents("\hvExternDateiname\hv@extern@ext",
+ \ifluatex
+ \directlua{if GetFileContents("\hvExternDateiname\hv@extern@ext",
"\hv@extern@ExamplesDir\hvExternDateiname\hv@extern@ext") then
tex.print("\\csname hv@ex@typeout\\endcsname{current file is NOT newer: no run }\\global\\csname hv@extern@forcefalse\\endcsname")
else
tex.print("\\csname hv@ex@typeout\\endcsname{current file is newer: force run }\\global\\csname hv@extern@forcetrue\\endcsname")
- end}
+ end}%
+ \else
+ \hv@ex@typeout{Check, if new file has a different code}%
+ \ShellEscape{hvextern-checkfile "\hvExternDateiname\hv@extern@ext"
+ "\hv@extern@ExamplesDir\hvExternDateiname\hv@extern@ext"}%
+ \InputIfFileExists{\hvExternDateiname\hv@extern@ext.diff}{}{}%
+ \ifx\hvCheckNewFile\empty
+ \hv@ex@typeout{current file is NOT newer: no run }%
+ \global\hv@extern@forcefalse
+ \else
+ \hv@ex@typeout{current file is newer: force run }%
+ \global\hv@extern@forcetrue
+ \fi
+ \ifhv@extern@verbose\else\ShellEscape{\hv@rm \hvExternDateiname\hv@extern@ext.diff}\fi
+ \fi
\fi
\ifhv@extern@force
\ifx\hv@extern@runsequence\@empty
@@ -645,7 +660,7 @@
\newcommand\runExtCmd[3][]{%
\begingroup
- \setkeys{hv}{code=false,includegraphic=false,#1}%
+ \setkeys{hv}{cleanup={},code=false,includegraphic=false,#1}%
\xdef\hvExternDateiname{#3-\arabic{hv@example@counter}}%
\xdef\hv@extern@fullPath{\hv@extern@ExamplesDir\hvExternDateiname}%
\hv@ex@typeout{running #2}%
@@ -697,7 +712,7 @@
\ifhv@extern@usefancyvrb
\expandafter\BodyVerbatim\expandafter[\hv@extern@lstOptions]{\hv@extern@fullPath.txt}
\else
- \expandafter\BodyListing\expandafter[\hv@extern@lstOptions]{\hv@extern@fullPath.txt}
+ \expandafter\BodyListing\expandafter[\hv@extern@lstOptions,breakatwhitespace]{\hv@extern@fullPath.txt}
\fi
\ifx\hv@extern@caption\@empty\else\caption{\hv@extern@caption}\fi
\ifx\hv@extern@label\@empty\else\label{\hv@extern@label}\fi
@@ -707,7 +722,8 @@
\ifhv@extern@usefancyvrb
\expandafter\BodyVerbatim\expandafter[\hv@extern@lstOptions]{\hv@extern@fullPath.txt}
\else
- \expandafter\BodyListing\expandafter[\hv@extern@lstOptions]{\hv@extern@fullPath.txt}
+ \hv@extern@tcboxfalse
+ \expandafter\BodyListing\expandafter[\hv@extern@lstOptions,breaklines,breakatwhitespace]{\hv@extern@fullPath.txt}
\fi
\fi
\fi