diff options
30 files changed, 476 insertions, 57 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/Makefile.am b/Build/source/texk/texlive/linked_scripts/Makefile.am index acc1382f6dd..d7c0ca1ec0c 100644 --- a/Build/source/texk/texlive/linked_scripts/Makefile.am +++ b/Build/source/texk/texlive/linked_scripts/Makefile.am @@ -141,6 +141,7 @@ texmf_other_scripts = \ dviinfox/dviinfox.pl \ easydtx/edtx2dtx.pl \ ebong/ebong.py \ + eolang/eolang.pl \ epspdf/epspdf.tlu \ epspdf/epspdftk.tcl \ epstopdf/epstopdf.pl \ diff --git a/Build/source/texk/texlive/linked_scripts/Makefile.in b/Build/source/texk/texlive/linked_scripts/Makefile.in index 1e3b225408d..30953906f8d 100644 --- a/Build/source/texk/texlive/linked_scripts/Makefile.in +++ b/Build/source/texk/texlive/linked_scripts/Makefile.in @@ -358,6 +358,7 @@ texmf_other_scripts = \ dviinfox/dviinfox.pl \ easydtx/edtx2dtx.pl \ ebong/ebong.py \ + eolang/eolang.pl \ epspdf/epspdf.tlu \ epspdf/epspdftk.tcl \ epstopdf/epstopdf.pl \ diff --git a/Build/source/texk/texlive/linked_scripts/eolang/eolang.pl b/Build/source/texk/texlive/linked_scripts/eolang/eolang.pl new file mode 100755 index 00000000000..3ac32331a4a --- /dev/null +++ b/Build/source/texk/texlive/linked_scripts/eolang/eolang.pl @@ -0,0 +1,153 @@ +#!/usr/bin/perl +# (The MIT License) +# +# Copyright (c) 2022-2024 Yegor Bugayenko +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the 'Software'), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +# 2024-01-11 0.18.0 +package eolang; + +use warnings; +use strict; +use File::Basename; + +# Hash of incoming command line arguments. +my %args = map { $_ => 1 } @ARGV; + +# Read file content. +sub readfile { + my ($path) = @_; + open(my $h, '<', $path) or die('Cannot open file: ' . $path); + my $content; { local $/; $content = <$h>; } + return $content; +} + +# Save content to file. +sub savefile { + my ($path, $content) = @_; + open(my $f, '>', $path) or error('Cannot open file for writing: ' . $path); + print $f $content; + close($f); +} + +# Print INFO message to the console. +sub info { + my ($txt) = @_; + print $txt . "\n"; +} + +# Print DEBUG message to the console. +sub debug { + my ($txt) = @_; + if (exists $args{'--verbose'}) { + print $txt . "\n"; + } +} + +# Print ERROR message to the console. +sub error { + my ($txt) = @_; + print STDERR $txt . "\n"; +} + +if (@ARGV+0 eq 0 or exists $args{'--help'} or exists $args{'-?'}) { + info("This script helps embedding \\phiquation and \\phiq into .tex document\n\n" . + "Usage:\n" . + " eolang [<options>] <.tex file path>\n\n" . + "Options:\n" . + " -v, --version Print the current version of the tool and exit\n" . + " -?, --help Print this help screen\n" . + " --verbose Print all possible debugging information\n" . + " --tmpdir=path Temp directory with .tex files ('_eolang' by default)\n\n" . + "If any issues, report to GitHub: https://github.com/yegor256/bibcop"); +} elsif (exists $args{'--version'} or exists $args{'-v'}) { + info('0.18.0 2024-01-11'); +} else { + my ($src, $target) = grep { not($_ =~ /^-.*$/) } @ARGV; + if (not $src) { + error('Source file name must be specified'); + exit(1); + } + debug('Source: ' . $src); + my $job = basename($src); + $job =~ s/\.[^.]+$//; + debug('Job name: ' . $job); + my $tex = readfile($src); + my $tmpdir = dirname($src) . '/_eolang/' . $job; + debug('EO tmpdir: ' . $tmpdir); + foreach my $f (glob($tmpdir . '/*-phiq.tex')) { + my $id = basename($f); + $id =~ s/\.[^.]+$//; + $id =~ s/-phiq$//; + my $phiq = readfile($f); + $phiq =~ s/^\s+|\s+$//g; + my $search = quotemeta($phiq); + $search =~ s/(\\\\[a-zA-Z]+)\\ /$1\\ ?/g; + $search = '\\\\phiq\\s*\\{\\s*' . $search . '\\s*\\}|\\$\\s*' . $search . '\\s*\\$'; + my $re = '\input{' . $tmpdir . '/' . $id . '-phiq-post.tex' . "}"; + my $count = 0; + while (1) { + my $applied = $tex =~ s/${search}/${re}/g; + if (!$applied) { + if ($count eq 0) { + debug("Neither \\phiq{$phiq} nor \$$phiq\$ found, suggested by $f"); + } + last; + } + debug('\\phiq ' . $id . '( ' . $phiq . ' ) -> ' . $re); + $count += 1; + } + } + my @kinds = ('sodg', 'phiquation', 'phiquation*'); + for my $kind (@kinds) { + my $k = $kind; + $k =~ s/\*$//; + foreach my $f (glob($tmpdir . '/*-' . $k . '.tex')) { + my $id = basename($f); + $id =~ s/\.[^.]+$//; + $id =~ s/-${k}$//; + my $search = quotemeta(readfile($f)); + $search = '\\\\begin\\s*\\{\\s*' . quotemeta($kind) . '\\s*\\}\\n' . $search . '\\\\end\\s*\\{\\s*' . quotemeta($kind) . '\\s*\\}\\n'; + my $re = '\input{' . $tmpdir . '/' . $id . '-' . $k . '-post.tex' . "}\% '$kind' replaced\n\n"; + my $count = 0; + while (1) { + my $applied = $tex =~ s/${search}/${re}/g; + if (!$applied) { + if ($count eq 0) { + debug("Didn't find \\begin{$kind} suggested by $f"); + } + last; + } + debug('\\begin{' . $kind . '} ' . $id . ' -> ' . $re); + $count += 1; + } + } + } + if (not $target) { + error('Target file name must be specified'); + exit(1); + } + debug('Target: ' . $target); + savefile($target, $tex); + info("New TeX file save to: ". $target); +} + +# In order to finish it with success: +1; diff --git a/Build/source/texk/texlive/linked_scripts/scripts.lst b/Build/source/texk/texlive/linked_scripts/scripts.lst index ee789b44617..efa9be90b7c 100644 --- a/Build/source/texk/texlive/linked_scripts/scripts.lst +++ b/Build/source/texk/texlive/linked_scripts/scripts.lst @@ -82,6 +82,7 @@ dviasm/dviasm.py dviinfox/dviinfox.pl easydtx/edtx2dtx.pl ebong/ebong.py +eolang/eolang.pl epspdf/epspdf.tlu epspdf/epspdftk.tcl epstopdf/epstopdf.pl diff --git a/Master/bin/aarch64-linux/eolang b/Master/bin/aarch64-linux/eolang new file mode 120000 index 00000000000..a46b695e558 --- /dev/null +++ b/Master/bin/aarch64-linux/eolang @@ -0,0 +1 @@ +../../texmf-dist/scripts/eolang/eolang.pl
\ No newline at end of file diff --git a/Master/bin/amd64-freebsd/eolang b/Master/bin/amd64-freebsd/eolang new file mode 120000 index 00000000000..a46b695e558 --- /dev/null +++ b/Master/bin/amd64-freebsd/eolang @@ -0,0 +1 @@ +../../texmf-dist/scripts/eolang/eolang.pl
\ No newline at end of file diff --git a/Master/bin/amd64-netbsd/eolang b/Master/bin/amd64-netbsd/eolang new file mode 120000 index 00000000000..a46b695e558 --- /dev/null +++ b/Master/bin/amd64-netbsd/eolang @@ -0,0 +1 @@ +../../texmf-dist/scripts/eolang/eolang.pl
\ No newline at end of file diff --git a/Master/bin/armhf-linux/eolang b/Master/bin/armhf-linux/eolang new file mode 120000 index 00000000000..a46b695e558 --- /dev/null +++ b/Master/bin/armhf-linux/eolang @@ -0,0 +1 @@ +../../texmf-dist/scripts/eolang/eolang.pl
\ No newline at end of file diff --git a/Master/bin/i386-freebsd/eolang b/Master/bin/i386-freebsd/eolang new file mode 120000 index 00000000000..a46b695e558 --- /dev/null +++ b/Master/bin/i386-freebsd/eolang @@ -0,0 +1 @@ +../../texmf-dist/scripts/eolang/eolang.pl
\ No newline at end of file diff --git a/Master/bin/i386-linux/eolang b/Master/bin/i386-linux/eolang new file mode 120000 index 00000000000..a46b695e558 --- /dev/null +++ b/Master/bin/i386-linux/eolang @@ -0,0 +1 @@ +../../texmf-dist/scripts/eolang/eolang.pl
\ No newline at end of file diff --git a/Master/bin/i386-netbsd/eolang b/Master/bin/i386-netbsd/eolang new file mode 120000 index 00000000000..a46b695e558 --- /dev/null +++ b/Master/bin/i386-netbsd/eolang @@ -0,0 +1 @@ +../../texmf-dist/scripts/eolang/eolang.pl
\ No newline at end of file diff --git a/Master/bin/i386-solaris/eolang b/Master/bin/i386-solaris/eolang new file mode 120000 index 00000000000..a46b695e558 --- /dev/null +++ b/Master/bin/i386-solaris/eolang @@ -0,0 +1 @@ +../../texmf-dist/scripts/eolang/eolang.pl
\ No newline at end of file diff --git a/Master/bin/universal-darwin/eolang b/Master/bin/universal-darwin/eolang new file mode 120000 index 00000000000..a46b695e558 --- /dev/null +++ b/Master/bin/universal-darwin/eolang @@ -0,0 +1 @@ +../../texmf-dist/scripts/eolang/eolang.pl
\ No newline at end of file diff --git a/Master/bin/windows/eolang.exe b/Master/bin/windows/eolang.exe Binary files differnew file mode 100755 index 00000000000..3332231b08c --- /dev/null +++ b/Master/bin/windows/eolang.exe diff --git a/Master/bin/x86_64-cygwin/eolang b/Master/bin/x86_64-cygwin/eolang new file mode 120000 index 00000000000..a46b695e558 --- /dev/null +++ b/Master/bin/x86_64-cygwin/eolang @@ -0,0 +1 @@ +../../texmf-dist/scripts/eolang/eolang.pl
\ No newline at end of file diff --git a/Master/bin/x86_64-darwinlegacy/eolang b/Master/bin/x86_64-darwinlegacy/eolang new file mode 120000 index 00000000000..a46b695e558 --- /dev/null +++ b/Master/bin/x86_64-darwinlegacy/eolang @@ -0,0 +1 @@ +../../texmf-dist/scripts/eolang/eolang.pl
\ No newline at end of file diff --git a/Master/bin/x86_64-linux/eolang b/Master/bin/x86_64-linux/eolang new file mode 120000 index 00000000000..a46b695e558 --- /dev/null +++ b/Master/bin/x86_64-linux/eolang @@ -0,0 +1 @@ +../../texmf-dist/scripts/eolang/eolang.pl
\ No newline at end of file diff --git a/Master/bin/x86_64-linuxmusl/eolang b/Master/bin/x86_64-linuxmusl/eolang new file mode 120000 index 00000000000..a46b695e558 --- /dev/null +++ b/Master/bin/x86_64-linuxmusl/eolang @@ -0,0 +1 @@ +../../texmf-dist/scripts/eolang/eolang.pl
\ No newline at end of file diff --git a/Master/bin/x86_64-solaris/eolang b/Master/bin/x86_64-solaris/eolang new file mode 120000 index 00000000000..a46b695e558 --- /dev/null +++ b/Master/bin/x86_64-solaris/eolang @@ -0,0 +1 @@ +../../texmf-dist/scripts/eolang/eolang.pl
\ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/eolang/LICENSE.txt b/Master/texmf-dist/doc/latex/eolang/LICENSE.txt index 5744f745f0a..1f211e02878 100644 --- a/Master/texmf-dist/doc/latex/eolang/LICENSE.txt +++ b/Master/texmf-dist/doc/latex/eolang/LICENSE.txt @@ -1,6 +1,6 @@ (The MIT License) -Copyright (c) 2021-2023 Yegor Bugayenko +Copyright (c) 2021-2024 Yegor Bugayenko Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal diff --git a/Master/texmf-dist/doc/latex/eolang/README.md b/Master/texmf-dist/doc/latex/eolang/README.md index 588b1557801..47fa929241d 100644 --- a/Master/texmf-dist/doc/latex/eolang/README.md +++ b/Master/texmf-dist/doc/latex/eolang/README.md @@ -22,7 +22,7 @@ x -> [ \end{document} ``` -Otherwise, you can download [`eolang.sty`](https://yegor256.github.io/eolang/eolang.sty) and add to your project. +Otherwise, you can download [`eolang.sty`](https://yegor256.github.io/eolang.sty) and add to your project. If you want to contribute yourself, make a fork, then create a branch, then run `l3build ctan` in the root directory. diff --git a/Master/texmf-dist/doc/latex/eolang/eolang.pdf b/Master/texmf-dist/doc/latex/eolang/eolang.pdf Binary files differindex 759f2c3ac69..23028cf96af 100644 --- a/Master/texmf-dist/doc/latex/eolang/eolang.pdf +++ b/Master/texmf-dist/doc/latex/eolang/eolang.pdf diff --git a/Master/texmf-dist/doc/man/man1/eolang.1 b/Master/texmf-dist/doc/man/man1/eolang.1 new file mode 100644 index 00000000000..bcac9db30d5 --- /dev/null +++ b/Master/texmf-dist/doc/man/man1/eolang.1 @@ -0,0 +1,24 @@ +.TH eolang 1 "2024-01-11" +.SH NAME +eolang \- Automated Editor of TeX Files that Use "eolang" Package +.SH SYNOPSIS +eolang [<options>] <.tex source file path> <.tex target file path> +.SH DESCRIPTION +The eolang tool is a Perl script for automatically modifying +TeX files that use "eolang" package, helping them pass post-processing +checks in ACM, arXiv, IEEE, and other publishers. +.SH OPTIONS +Various options apply: +.IP --version +Print the version of the tool +.IP --help +Print the introduction screen +.IP --verbose +Print debugging information too +.SH AUTHOR +Yegor Bugayenko (yegor256@gmail.com) +.SH BUGS +Please log issues on the GitHub homepage: +https://github.com/objectionary/eolang.sty/issues. +.SH SEE ALSO +See eolang.pdf for more details. diff --git a/Master/texmf-dist/doc/man/man1/eolang.man1.pdf b/Master/texmf-dist/doc/man/man1/eolang.man1.pdf Binary files differnew file mode 100644 index 00000000000..4f28e9b327d --- /dev/null +++ b/Master/texmf-dist/doc/man/man1/eolang.man1.pdf diff --git a/Master/texmf-dist/scripts/eolang/eolang.pl b/Master/texmf-dist/scripts/eolang/eolang.pl new file mode 100755 index 00000000000..3ac32331a4a --- /dev/null +++ b/Master/texmf-dist/scripts/eolang/eolang.pl @@ -0,0 +1,153 @@ +#!/usr/bin/perl +# (The MIT License) +# +# Copyright (c) 2022-2024 Yegor Bugayenko +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the 'Software'), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +# 2024-01-11 0.18.0 +package eolang; + +use warnings; +use strict; +use File::Basename; + +# Hash of incoming command line arguments. +my %args = map { $_ => 1 } @ARGV; + +# Read file content. +sub readfile { + my ($path) = @_; + open(my $h, '<', $path) or die('Cannot open file: ' . $path); + my $content; { local $/; $content = <$h>; } + return $content; +} + +# Save content to file. +sub savefile { + my ($path, $content) = @_; + open(my $f, '>', $path) or error('Cannot open file for writing: ' . $path); + print $f $content; + close($f); +} + +# Print INFO message to the console. +sub info { + my ($txt) = @_; + print $txt . "\n"; +} + +# Print DEBUG message to the console. +sub debug { + my ($txt) = @_; + if (exists $args{'--verbose'}) { + print $txt . "\n"; + } +} + +# Print ERROR message to the console. +sub error { + my ($txt) = @_; + print STDERR $txt . "\n"; +} + +if (@ARGV+0 eq 0 or exists $args{'--help'} or exists $args{'-?'}) { + info("This script helps embedding \\phiquation and \\phiq into .tex document\n\n" . + "Usage:\n" . + " eolang [<options>] <.tex file path>\n\n" . + "Options:\n" . + " -v, --version Print the current version of the tool and exit\n" . + " -?, --help Print this help screen\n" . + " --verbose Print all possible debugging information\n" . + " --tmpdir=path Temp directory with .tex files ('_eolang' by default)\n\n" . + "If any issues, report to GitHub: https://github.com/yegor256/bibcop"); +} elsif (exists $args{'--version'} or exists $args{'-v'}) { + info('0.18.0 2024-01-11'); +} else { + my ($src, $target) = grep { not($_ =~ /^-.*$/) } @ARGV; + if (not $src) { + error('Source file name must be specified'); + exit(1); + } + debug('Source: ' . $src); + my $job = basename($src); + $job =~ s/\.[^.]+$//; + debug('Job name: ' . $job); + my $tex = readfile($src); + my $tmpdir = dirname($src) . '/_eolang/' . $job; + debug('EO tmpdir: ' . $tmpdir); + foreach my $f (glob($tmpdir . '/*-phiq.tex')) { + my $id = basename($f); + $id =~ s/\.[^.]+$//; + $id =~ s/-phiq$//; + my $phiq = readfile($f); + $phiq =~ s/^\s+|\s+$//g; + my $search = quotemeta($phiq); + $search =~ s/(\\\\[a-zA-Z]+)\\ /$1\\ ?/g; + $search = '\\\\phiq\\s*\\{\\s*' . $search . '\\s*\\}|\\$\\s*' . $search . '\\s*\\$'; + my $re = '\input{' . $tmpdir . '/' . $id . '-phiq-post.tex' . "}"; + my $count = 0; + while (1) { + my $applied = $tex =~ s/${search}/${re}/g; + if (!$applied) { + if ($count eq 0) { + debug("Neither \\phiq{$phiq} nor \$$phiq\$ found, suggested by $f"); + } + last; + } + debug('\\phiq ' . $id . '( ' . $phiq . ' ) -> ' . $re); + $count += 1; + } + } + my @kinds = ('sodg', 'phiquation', 'phiquation*'); + for my $kind (@kinds) { + my $k = $kind; + $k =~ s/\*$//; + foreach my $f (glob($tmpdir . '/*-' . $k . '.tex')) { + my $id = basename($f); + $id =~ s/\.[^.]+$//; + $id =~ s/-${k}$//; + my $search = quotemeta(readfile($f)); + $search = '\\\\begin\\s*\\{\\s*' . quotemeta($kind) . '\\s*\\}\\n' . $search . '\\\\end\\s*\\{\\s*' . quotemeta($kind) . '\\s*\\}\\n'; + my $re = '\input{' . $tmpdir . '/' . $id . '-' . $k . '-post.tex' . "}\% '$kind' replaced\n\n"; + my $count = 0; + while (1) { + my $applied = $tex =~ s/${search}/${re}/g; + if (!$applied) { + if ($count eq 0) { + debug("Didn't find \\begin{$kind} suggested by $f"); + } + last; + } + debug('\\begin{' . $kind . '} ' . $id . ' -> ' . $re); + $count += 1; + } + } + } + if (not $target) { + error('Target file name must be specified'); + exit(1); + } + debug('Target: ' . $target); + savefile($target, $tex); + info("New TeX file save to: ". $target); +} + +# In order to finish it with success: +1; diff --git a/Master/texmf-dist/source/latex/eolang/eolang.dtx b/Master/texmf-dist/source/latex/eolang/eolang.dtx index 9e1bd88e9d2..262c10f2ca1 100644 --- a/Master/texmf-dist/source/latex/eolang/eolang.dtx +++ b/Master/texmf-dist/source/latex/eolang/eolang.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % (The MIT License) % -% Copyright (c) 2021-2023 Yegor Bugayenko +% Copyright (c) 2021-2024 Yegor Bugayenko % % Permission is hereby granted, free of charge, to any person obtaining a copy % of this software and associated documentation files (the 'Software'), to deal @@ -50,7 +50,7 @@ %<package>\NeedsTeXFormat{LaTeX2e} %<package>\ProvidesPackage{eolang} %<*package> -[2024-01-02 0.17.1 Formulas and Graphs for EO Programming Language] +[2024-01-11 0.18.0 Formulas and Graphs for EO Programming Language] %</package> %<*driver> \documentclass{ltxdoc} @@ -426,6 +426,19 @@ %</verb> %\fi +% \DescribeMacro{noshell} +% You may prohibit any interactions with the shell by using the |noshell| option. This may be helpful when you send your document +% for outside processing and want to make sure the compilation won't break due to shell errors: +%\iffalse +%<*verb> +%\fi +\begin{verbatim} +\usepackage[noshell]{eolang} +\end{verbatim} +%\iffalse +%</verb> +%\fi + % \section{More Examples} % The |phiquation| environment treats ends of line as signals to start @@ -757,7 +770,7 @@ % \end{macrocode} % We need \href{https://ctan.org/pkg/iexec}{iexec} for executing Perl scripts: % \begin{macrocode} -\RequirePackage{iexec} +\ifdefined\eolang@noshell\else\RequirePackage{iexec}\fi % \end{macrocode} % Then, we process package options: @@ -774,6 +787,7 @@ tmpdir/.default=_eolang\ifxetex-xe\else\ifluatex-lua\fi\fi, nocomments/.store in=\eolang@nocomments, anonymous/.store in=\eolang@anonymous, + noshell/.store in=\eolang@noshell, tmpdir } \ProcessPgfPackageOptions{/eolang} @@ -781,21 +795,29 @@ % Then, we make a directory where all temporary files will be kept: % \begin{macrocode} -\RequirePackage{shellesc} +\makeatletter +\ifdefined\eolang@noshell\else\RequirePackage{shellesc}\fi \IfFileExists {\eolang@tmpdir/\jobname} {\message{eolang: Temporary directory "\eolang@tmpdir/\jobname" already exists^^J}} - {% - \ifnum\ShellEscapeStatus=1% - \iexec[null]{mkdir -p "\eolang@tmpdir/\jobname"}% - \else% + { + \ifdefined\eolang@noshell \message{eolang: Temporary directory "\eolang@tmpdir/\jobname" - is not created, because -shell-escape is not set, and - it doesn't exist, most probably the compilation - will fail later^^J}% - \fi% + is not created, because of the "noshell" package option, + most probably the compilation will fail later^^J} + \else + \ifnum\ShellEscapeStatus=1 + \iexec[null]{mkdir -p "\eolang@tmpdir/\jobname"} + \else + \message{eolang: Temporary directory "\eolang@tmpdir/\jobname" + is not created, because -shell-escape is not set, and + it doesn't exist, most probably the compilation + will fail later^^J} + \fi + \fi } +\makeatother % \end{macrocode} % \begin{macro}{\eolang@lineno} @@ -840,6 +862,11 @@ % \href{https://ctan.org/pkg/fancyvrb}{fancyvrb}: % \begin{macrocode} \makeatletter +\ifdefined\eolang@noshell + \message{eolang: Perl script is not going to be created, + at "\eolang@tmpdir/\jobname-phi.pl" because of the "noshell" + package option^^J} +\else \openin 15=\eolang@tmpdir/\jobname-phi.pl \ifeof 15 \message{eolang: Perl script is going to be created, @@ -850,7 +877,7 @@ $macro = $ARGV[0]; open(my $fh, '<', $ARGV[1]); my $tex; { local $/; $tex = <$fh>; } -print "% This file is auto-generated by 0.17.1\n"; +print "% This file is auto-generated by 0.18.0\n"; print '% There are ', length($tex), ' chars in the input: ', $ARGV[1], "\n"; print '% ---', "\n"; @@ -986,7 +1013,7 @@ $tex =~ s/\|{2,}/|/g; $tex =~ s/\|([^\|]+)\|/\\textnormal{\\texttt{\1}}{}/g; $tex =~ s/\{TEXT(\d+)\}/'\\text{' . @texts[$1] . '}';/ge; if ($macro eq 'phiq') { - print '$' if ($tex ne ''); + print '\(' if ($tex ne ''); } else { print '\begin{', $macro, "}\n"; if (not($align)) { @@ -1003,7 +1030,7 @@ if ($gathered and not($align)) { } print $tex; if ($macro eq 'phiq') { - print '$' if ($tex ne ''); + print '\)' if ($tex ne ''); } else { if (not($align)) { if ($gathered) { @@ -1023,6 +1050,7 @@ print '\endinput'; "\eolang@tmpdir/\jobname-phi.pl"^^J} \fi \closein 15 +\fi \makeatother % \end{macrocode} % \end{macro} @@ -1039,6 +1067,7 @@ print '\endinput'; % \begin{macro}{\eolang@ifabsent} % \changes{0.17.0}{2023/12/28}{A new supplementary \texttt{eolang@ifabsent} command added} +% \changes{0.18.0}{2024/01/09}{The \texttt{noshell} package option added in order to enable complete prohibition of shell interactions.} % Then, we define the |\eolang@ifabsent| command, which if a given file is absent, runs a processing command, otherwise just inputs it: % \begin{macrocode} \makeatletter @@ -1049,12 +1078,16 @@ print '\endinput'; \message{eolang: File "#1" already exists ^^J}% \input{#1}} {% - \ifnum\ShellEscapeStatus=1\else% - \message{eolang: The -shell-escape command line - option is not provided, most probably compilation - will fail now:^^J}% + \ifdefined\eolang@noshell% + \message{eolang: Shell processing is disabled^^J}% + \else% + \ifnum\ShellEscapeStatus=1\else% + \message{eolang: The -shell-escape command line + option is not provided, most probably compilation + will fail now:^^J}% + \fi% + #2% \fi% - #2% }% } \makeatother @@ -1070,15 +1103,15 @@ print '\endinput'; \def\hash{\eolang@mdfive {\eolang@tmpdir/\jobname/phiquation.tex}-\the\inputlineno}% \eolang@ifabsent - {\eolang@tmpdir/\jobname/\hash-post.tex} + {\eolang@tmpdir/\jobname/\hash-phiquation-post.tex} {% \iexec[null]{cp "\eolang@tmpdir/\jobname/phiquation.tex" - "\eolang@tmpdir/\jobname/\hash.tex"}% + "\eolang@tmpdir/\jobname/\hash-phiquation.tex"}% \message{Start parsing 'phi' at line no. \the\inputlineno^^J} - \iexec[trace,stdout=\eolang@tmpdir/\jobname/\hash-post.tex]{ + \iexec[trace,stdout=\eolang@tmpdir/\jobname/\hash-phiquation-post.tex]{ perl "\eolang@tmpdir/\jobname-phi.pl" '#1' - "\eolang@tmpdir/\jobname/\hash.tex" + "\eolang@tmpdir/\jobname/\hash-phiquation.tex" \ifdefined\eolang@nocomments | perl -pe 's/\%.*(\\n|$)//g'\fi \ifdefined\eolang@phiSaveTo > \eolang@phiSaveTo\fi}% }% @@ -1123,6 +1156,7 @@ print '\endinput'; perl \eolang@tmpdir/\jobname-phi.pl 'phiq' "\eolang@tmpdir/\jobname/\hash-phiq.tex" \ifdefined\eolang@nocomments | perl -pe 's/\%.*(\\n|$)//g' \fi}% + \message{eolang: Parsed `phiq' at line no. \the\inputlineno^^J}% }% \ifdefined\eolang@nodollar\else\catcode`\$\active\fi% }\makeatother @@ -1163,6 +1197,11 @@ print '\endinput'; % \href{https://ctan.org/pkg/fancyvrb}{fancyvrb}: % \begin{macrocode} \makeatletter +\ifdefined\eolang@noshell +\message{eolang: Perl script is not going to be created + at "\eolang@tmpdir/\jobname-sodg.pl", because of the + "noshell" package option^^J} +\else \openin 15=\eolang@tmpdir/\jobname-sodg.pl \ifeof 15 \message{eolang: Perl script is going to be created, @@ -1448,6 +1487,7 @@ print '\endinput'; "\eolang@tmpdir/\jobname-sodg.pl"^^J} \fi \closein 15 +\fi \makeatother % \end{macrocode} % \end{macro} @@ -1590,11 +1630,11 @@ print '\endinput'; {\eolang@tmpdir/\jobname/\hash-sodg-post.tex} {% \iexec[null]{cp "\eolang@tmpdir/\jobname/sodg.tex" - "\eolang@tmpdir/\jobname/\hash.tex"}% + "\eolang@tmpdir/\jobname/\hash-sodg.tex"}% \message{eolang: Start parsing `sodg' at line no. \the\inputlineno^^J} \iexec[trace,stdout=\eolang@tmpdir/\jobname/\hash-sodg-post.tex]{ perl "\eolang@tmpdir/\jobname-sodg.pl" - "\eolang@tmpdir/\jobname/\hash.tex" + "\eolang@tmpdir/\jobname/\hash-sodg.tex" \ifdefined\eolang@nocomments | perl -pe 's/\%.*(\\n|$)//g'\fi \ifdefined\eolang@sodgSaveTo > \eolang@sodgSaveTo\fi}% } diff --git a/Master/texmf-dist/source/latex/eolang/eolang.ins b/Master/texmf-dist/source/latex/eolang/eolang.ins index 329210aa0f1..ab60ddb1f4e 100644 --- a/Master/texmf-dist/source/latex/eolang/eolang.ins +++ b/Master/texmf-dist/source/latex/eolang/eolang.ins @@ -1,6 +1,6 @@ %% (The MIT License) %% -%% Copyright (c) 2021-2023 Yegor Bugayenko +%% Copyright (c) 2021-2024 Yegor Bugayenko %% %% Permission is hereby granted, free of charge, to any person obtaining a copy %% of this software and associated documentation files (the 'Software'), to deal @@ -26,7 +26,7 @@ \preamble (The MIT License) -Copyright (c) 2021-2023 Yegor Bugayenko +Copyright (c) 2021-2024 Yegor Bugayenko Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal diff --git a/Master/texmf-dist/tex/latex/eolang/eolang.sty b/Master/texmf-dist/tex/latex/eolang/eolang.sty index 20bb060b24e..ae8a572fa2d 100644 --- a/Master/texmf-dist/tex/latex/eolang/eolang.sty +++ b/Master/texmf-dist/tex/latex/eolang/eolang.sty @@ -7,7 +7,7 @@ %% eolang.dtx (with options: `package') %% (The MIT License) %% -%% Copyright (c) 2021-2023 Yegor Bugayenko +%% Copyright (c) 2021-2024 Yegor Bugayenko %% %% Permission is hereby granted, free of charge, to any person obtaining a copy %% of this software and associated documentation files (the 'Software'), to deal @@ -31,7 +31,8 @@ \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{eolang} -[2024-01-02 0.17.1 Formulas and Graphs for EO Programming Language] +[2024-01-11 0.18.0 Formulas and Graphs for EO Programming Language] + @@ -84,7 +85,7 @@ \RequirePackage{amsmath} \let\Bbbk\relax\RequirePackage{amssymb} \RequirePackage{fancyvrb} -\RequirePackage{iexec} +\ifdefined\eolang@noshell\else\RequirePackage{iexec}\fi \RequirePackage{pgfopts} \RequirePackage{ifluatex} @@ -95,25 +96,34 @@ tmpdir/.default=_eolang\ifxetex-xe\else\ifluatex-lua\fi\fi, nocomments/.store in=\eolang@nocomments, anonymous/.store in=\eolang@anonymous, + noshell/.store in=\eolang@noshell, tmpdir } \ProcessPgfPackageOptions{/eolang} -\RequirePackage{shellesc} +\makeatletter +\ifdefined\eolang@noshell\else\RequirePackage{shellesc}\fi \IfFileExists {\eolang@tmpdir/\jobname} {\message{eolang: Temporary directory "\eolang@tmpdir/\jobname" already exists^^J}} - {% - \ifnum\ShellEscapeStatus=1% - \iexec[null]{mkdir -p "\eolang@tmpdir/\jobname"}% - \else% + { + \ifdefined\eolang@noshell \message{eolang: Temporary directory "\eolang@tmpdir/\jobname" - is not created, because -shell-escape is not set, and - it doesn't exist, most probably the compilation - will fail later^^J}% - \fi% + is not created, because of the "noshell" package option, + most probably the compilation will fail later^^J} + \else + \ifnum\ShellEscapeStatus=1 + \iexec[null]{mkdir -p "\eolang@tmpdir/\jobname"} + \else + \message{eolang: Temporary directory "\eolang@tmpdir/\jobname" + is not created, because -shell-escape is not set, and + it doesn't exist, most probably the compilation + will fail later^^J} + \fi + \fi } +\makeatother \makeatletter\newcounter{eolang@lineno}\makeatother @@ -123,6 +133,11 @@ \makeatother \makeatletter +\ifdefined\eolang@noshell + \message{eolang: Perl script is not going to be created, + at "\eolang@tmpdir/\jobname-phi.pl" because of the "noshell" + package option^^J} +\else \openin 15=\eolang@tmpdir/\jobname-phi.pl \ifeof 15 \message{eolang: Perl script is going to be created, @@ -133,7 +148,7 @@ $macro = $ARGV[0]; open(my $fh, '<', $ARGV[1]); my $tex; { local $/; $tex = <$fh>; } -print "% This file is auto-generated by 0.17.1\n"; +print "% This file is auto-generated by 0.18.0\n"; print '% There are ', length($tex), ' chars in the input: ', $ARGV[1], "\n"; print '% ---', "\n"; @@ -269,7 +284,7 @@ $tex =~ s/\|{2,}/|/g; $tex =~ s/\|([^\|]+)\|/\\textnormal{\\texttt{\1}}{}/g; $tex =~ s/\{TEXT(\d+)\}/'\\text{' . @texts[$1] . '}';/ge; if ($macro eq 'phiq') { - print '$' if ($tex ne ''); + print '\(' if ($tex ne ''); } else { print '\begin{', $macro, "}\n"; if (not($align)) { @@ -286,7 +301,7 @@ if ($gathered and not($align)) { } print $tex; if ($macro eq 'phiq') { - print '$' if ($tex ne ''); + print '\)' if ($tex ne ''); } else { if (not($align)) { if ($gathered) { @@ -306,6 +321,7 @@ print '\endinput'; "\eolang@tmpdir/\jobname-phi.pl"^^J} \fi \closein 15 +\fi \makeatother \makeatletter @@ -320,12 +336,16 @@ print '\endinput'; \message{eolang: File "#1" already exists ^^J}% \input{#1}} {% - \ifnum\ShellEscapeStatus=1\else% - \message{eolang: The -shell-escape command line - option is not provided, most probably compilation - will fail now:^^J}% + \ifdefined\eolang@noshell% + \message{eolang: Shell processing is disabled^^J}% + \else% + \ifnum\ShellEscapeStatus=1\else% + \message{eolang: The -shell-escape command line + option is not provided, most probably compilation + will fail now:^^J}% + \fi% + #2% \fi% - #2% }% } \makeatother @@ -334,15 +354,15 @@ print '\endinput'; \def\hash{\eolang@mdfive {\eolang@tmpdir/\jobname/phiquation.tex}-\the\inputlineno}% \eolang@ifabsent - {\eolang@tmpdir/\jobname/\hash-post.tex} + {\eolang@tmpdir/\jobname/\hash-phiquation-post.tex} {% \iexec[null]{cp "\eolang@tmpdir/\jobname/phiquation.tex" - "\eolang@tmpdir/\jobname/\hash.tex"}% + "\eolang@tmpdir/\jobname/\hash-phiquation.tex"}% \message{Start parsing 'phi' at line no. \the\inputlineno^^J} - \iexec[trace,stdout=\eolang@tmpdir/\jobname/\hash-post.tex]{ + \iexec[trace,stdout=\eolang@tmpdir/\jobname/\hash-phiquation-post.tex]{ perl "\eolang@tmpdir/\jobname-phi.pl" '#1' - "\eolang@tmpdir/\jobname/\hash.tex" + "\eolang@tmpdir/\jobname/\hash-phiquation.tex" \ifdefined\eolang@nocomments | perl -pe 's/\%.*(\\n|$)//g'\fi \ifdefined\eolang@phiSaveTo > \eolang@phiSaveTo\fi}% }% @@ -379,6 +399,7 @@ print '\endinput'; perl \eolang@tmpdir/\jobname-phi.pl 'phiq' "\eolang@tmpdir/\jobname/\hash-phiq.tex" \ifdefined\eolang@nocomments | perl -pe 's/\%.*(\\n|$)//g' \fi}% + \message{eolang: Parsed `phiq' at line no. \the\inputlineno^^J}% }% \ifdefined\eolang@nodollar\else\catcode`\$\active\fi% }\makeatother @@ -392,6 +413,11 @@ print '\endinput'; \fi \makeatletter +\ifdefined\eolang@noshell +\message{eolang: Perl script is not going to be created + at "\eolang@tmpdir/\jobname-sodg.pl", because of the + "noshell" package option^^J} +\else \openin 15=\eolang@tmpdir/\jobname-sodg.pl \ifeof 15 \message{eolang: Perl script is going to be created, @@ -677,6 +703,7 @@ print '\endinput'; "\eolang@tmpdir/\jobname-sodg.pl"^^J} \fi \closein 15 +\fi \makeatother \setcounter{FancyVerbLine}{0} @@ -789,11 +816,11 @@ print '\endinput'; {\eolang@tmpdir/\jobname/\hash-sodg-post.tex} {% \iexec[null]{cp "\eolang@tmpdir/\jobname/sodg.tex" - "\eolang@tmpdir/\jobname/\hash.tex"}% + "\eolang@tmpdir/\jobname/\hash-sodg.tex"}% \message{eolang: Start parsing `sodg' at line no. \the\inputlineno^^J} \iexec[trace,stdout=\eolang@tmpdir/\jobname/\hash-sodg-post.tex]{ perl "\eolang@tmpdir/\jobname-sodg.pl" - "\eolang@tmpdir/\jobname/\hash.tex" + "\eolang@tmpdir/\jobname/\hash-sodg.tex" \ifdefined\eolang@nocomments | perl -pe 's/\%.*(\\n|$)//g'\fi \ifdefined\eolang@sodgSaveTo > \eolang@sodgSaveTo\fi}% } diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds index 54c4e4a5914..c8a44044e60 100755 --- a/Master/tlpkg/libexec/ctan2tds +++ b/Master/tlpkg/libexec/ctan2tds @@ -3734,6 +3734,7 @@ $standardttf = '\.ttf|\.TTC'; 'dviinfox' => '\.pl$', 'easydtx' => '\.pl$', 'ebong' => '\.py$', + 'eolang' => '\.pl$', 'epstopdf' => 'epstopdf\.pl', # doscripts() does r* 'exceltex' => 'exceltex$', 'fig4latex' => 'fig4latex', @@ -3878,6 +3879,7 @@ $standardttf = '\.ttf|\.TTC'; 'dosepsbin' => 'dosepsbin.man', 'dviasm' => '\.1$', 'easydtx' => '\.1$', + 'eolang' => '\.1$', 'epstopdf' => 'r?epstopdf.1|epstopdf.man1.pdf', # don't keep pdf 'findhyph' => 'findhyph.1', 'fontools' => '\.1$', diff --git a/Master/tlpkg/tlpsrc/eolang.tlpsrc b/Master/tlpkg/tlpsrc/eolang.tlpsrc index ae6ed34e0b0..0276b67b7c9 100644 --- a/Master/tlpkg/tlpsrc/eolang.tlpsrc +++ b/Master/tlpkg/tlpsrc/eolang.tlpsrc @@ -1,7 +1,10 @@ +binpattern f bin/${ARCH}/${PKGNAME} +# hard stmaryrd hard amsmath hard amsfonts hard iexec hard pgf hard fancyvrb -hard pgfopts
\ No newline at end of file +hard pgfopts + |