diff options
author | Karl Berry <karl@freefriends.org> | 2021-11-12 23:02:10 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-11-12 23:02:10 +0000 |
commit | 933d3ad47a7b54da768a6a1f8a2fe702bcfa9b2e (patch) | |
tree | 683ada03a0364d8f5180c02afb97a0bd5f780ea0 /Master/texmf-dist/scripts | |
parent | 21ec58a3ff045c5ec43e3744d6ffb28ea9ab194a (diff) |
latexindent (12nov21)
git-svn-id: svn://tug.org/texlive/trunk@61039 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts')
4 files changed, 27 insertions, 16 deletions
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm index 168c5d97bbb..41a24db3875 100644 --- a/Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm +++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm @@ -510,10 +510,7 @@ sub yaml_read_settings{ # split at : (@keysValues) = split(/(?<!(?:\\|\[)):(?!\])/,$splitAtQuote[0]); - # tabs need special attention - if ($splitAtQuote[1] =~ m/\\t/){ - $splitAtQuote[1] = '"'.$splitAtQuote[1].'"'; - } + $splitAtQuote[1] = '"'.$splitAtQuote[1].'"'; push(@keysValues,$splitAtQuote[1]); } else { @@ -528,15 +525,29 @@ sub yaml_read_settings{ # semi-colon, so we replace it with just a semi-colon $value =~ s/\\:/:/; - # horizontal space needs special treatment - if($value =~ m/^(?:"|')(\h*)(?:"|')$/){ - # pure horizontal space + # strings need special treatment + if($value =~ m/^"(.*)"$/){ + # double-quoted string + # translate: '\t', '\n', '\"', '\\' + my $raw_value = $value; + $value = $1; + # only translate string starts with an odd number of escape characters '\' + $value =~ s/(?<!\\)((\\\\)*)\\t/$1\t/g; + $value =~ s/(?<!\\)((\\\\)*)\\n/$1\n/g; + $value =~ s/(?<!\\)((\\\\)*)\\"/$1"/g; + # translate '\\' in double-quoted strings, but not in single-quoted strings + $value =~ s/\\\\/\\/g; + $logger->info("double-quoted string found in -y switch: $raw_value, substitute to $value"); + } elsif($value =~ m/^'(.*)'$/){ + # single-quoted string + my $raw_value = $value; $value = $1; - } elsif($value =~ m/^(?:"|')((?:\\t)*)(?:"|')$/){ - # tabs - $value =~ s/^(?:"|')//; - $value =~ s/(?:"|')$//; - $value =~ s/\\t/\t/g; + # special treatment for tabs and newlines + # translate: '\t', '\n' + # only translate string starts with an odd number of escape characters '\' + $value =~ s/(?<!\\)((\\\\)*)\\t/$1\t/g; + $value =~ s/(?<!\\)((\\\\)*)\\n/$1\n/g; + $logger->info("single-quoted string found in -y switch: $raw_value, substitute to $value"); } if(scalar(@keysValues) == 2){ diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm index d25b4f55ab8..1698d3a039f 100644 --- a/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm +++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm @@ -19,6 +19,6 @@ use warnings; use Exporter qw/import/; our @EXPORT_OK = qw/$versionNumber $versionDate/; -our $versionNumber = '3.13'; -our $versionDate = '2021-10-30'; +our $versionNumber = '3.13.1'; +our $versionDate = '2021-11-12'; 1 diff --git a/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml b/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml index 01a766633b5..a5aa0d90db4 100755 --- a/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml +++ b/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml @@ -1,4 +1,4 @@ -# defaultSettings.yaml for latexindent.pl, version 3.13, 2021-10-30 +# defaultSettings.yaml for latexindent.pl, version 3.13.1, 2021-11-12 # a script that aims to # beautify .tex, .sty, .cls files # diff --git a/Master/texmf-dist/scripts/latexindent/latexindent.pl b/Master/texmf-dist/scripts/latexindent/latexindent.pl index 5ba1535efa1..7afb64eeebb 100755 --- a/Master/texmf-dist/scripts/latexindent/latexindent.pl +++ b/Master/texmf-dist/scripts/latexindent/latexindent.pl @@ -1,5 +1,5 @@ #!/usr/bin/env perl -# latexindent.pl, version 3.13, 2021-10-30 +# latexindent.pl, version 3.13.1, 2021-11-12 # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by |