Skip to content

Commit

Permalink
synchronized texlive 69394.
Browse files Browse the repository at this point in the history
  • Loading branch information
clerkma committed Jan 12, 2024
1 parent 3f63a04 commit 207e068
Show file tree
Hide file tree
Showing 6 changed files with 161 additions and 5 deletions.
3 changes: 2 additions & 1 deletion texlive/texk/texlive/linked_scripts/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## $Id: Makefile.am 68961 2023-11-24 21:16:55Z karl $
## $Id: Makefile.am 69391 2024-01-11 21:37:18Z karl $
## Makefile.am for the TeX Live subdirectory texk/texlive/linked_scripts/
##
## Copyright 2016-2023 Karl Berry <tex-live@tug.org>
Expand Down Expand Up @@ -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 \
Expand Down
1 change: 1 addition & 0 deletions texlive/texk/texlive/linked_scripts/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
6 changes: 3 additions & 3 deletions texlive/texk/texlive/linked_scripts/bibcop/bibcop.pl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/perl
# (The MIT License)
#
# Copyright (c) 2022-2023 Yegor Bugayenko
# 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
Expand All @@ -21,7 +21,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

# 2023-09-03 0.0.15
# 2024-01-11 0.0.16
package bibcop;

use warnings;
Expand Down Expand Up @@ -861,7 +861,7 @@ sub fail {
" --latex Report errors in LaTeX format using \\PackageWarningNoLine command\n\n" .
"If any issues, report to GitHub: https://github.com/yegor256/bibcop");
} elsif (exists $args{'--version'} or exists $args{'-v'}) {
info('0.0.15 2023-09-03');
info('0.0.16 2024-01-11');
} else {
my ($file) = grep { not($_ =~ /^-.*$/) } @ARGV;
if (not $file) {
Expand Down
153 changes: 153 additions & 0 deletions texlive/texk/texlive/linked_scripts/eolang/eolang.pl
Original file line number Diff line number Diff line change
@@ -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;
2 changes: 1 addition & 1 deletion texlive/texk/texlive/linked_scripts/lwarp/lwarpmk.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

-- Copyright 2016-2024 Brian Dunn

printversion = "v0.913"
printversion = "v0.914"
requiredconfversion = "2" -- also at *lwarpmk.conf

function printhelp ()
Expand Down
1 change: 1 addition & 0 deletions texlive/texk/texlive/linked_scripts/scripts.lst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 207e068

Please sign in to comment.