texlive[44120] Master: latexindent (29apr17)
commits+karl at tug.org
commits+karl at tug.org
Sun Apr 30 00:25:00 CEST 2017
Revision: 44120
http://tug.org/svn/texlive?view=revision&revision=44120
Author: karl
Date: 2017-04-30 00:25:00 +0200 (Sun, 30 Apr 2017)
Log Message:
-----------
latexindent (29apr17)
Modified Paths:
--------------
trunk/Master/bin/win32/latexindent.exe
trunk/Master/texmf-dist/doc/support/latexindent/appendices.tex
trunk/Master/texmf-dist/doc/support/latexindent/latexindent.pdf
trunk/Master/texmf-dist/doc/support/latexindent/latexindent.tex
trunk/Master/texmf-dist/doc/support/latexindent/sec-how-to-use.tex
trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/AlignmentAtAmpersand.pm
trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Document.pm
trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/FileExtension.pm
trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/LogFile.pm
Modified: trunk/Master/bin/win32/latexindent.exe
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/support/latexindent/appendices.tex
===================================================================
--- trunk/Master/texmf-dist/doc/support/latexindent/appendices.tex 2017-04-29 22:24:28 UTC (rev 44119)
+++ trunk/Master/texmf-dist/doc/support/latexindent/appendices.tex 2017-04-29 22:25:00 UTC (rev 44120)
@@ -6,20 +6,24 @@
need to install the missing modules.
\begin{cmhlistings}[language=Perl]{\texttt{helloworld.pl}}{lst:helloworld}
- #!/usr/bin/perl
+#!/usr/bin/perl
- use strict;
- use warnings;
- use FindBin;
- use YAML::Tiny;
- use File::Copy;
- use File::Basename;
- use File::HomeDir;
- use Getopt::Long;
- use Data::Dumper;
+use strict;
+use warnings;
+use utf8;
+use PerlIO::encoding;
+use Unicode::GCString;
+use open ':std', ':encoding(UTF-8)';
+use FindBin;
+use YAML::Tiny;
+use File::Copy;
+use File::Basename;
+use File::HomeDir;
+use Getopt::Long;
+use Data::Dumper;
- print "hello world";
- exit;
+print "hello world";
+exit;
\end{cmhlistings}
My default installation on Ubuntu 12.04 did \emph{not} come
with all of these modules as standard, but Strawberry Perl for Windows \cite{strawberryperl}
Modified: trunk/Master/texmf-dist/doc/support/latexindent/latexindent.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/support/latexindent/latexindent.tex
===================================================================
--- trunk/Master/texmf-dist/doc/support/latexindent/latexindent.tex 2017-04-29 22:24:28 UTC (rev 44119)
+++ trunk/Master/texmf-dist/doc/support/latexindent/latexindent.tex 2017-04-29 22:25:00 UTC (rev 44120)
@@ -407,7 +407,7 @@
sharp corners,
enhanced,
overlay={\node[anchor=north east,outer sep=2pt] at ([xshift=3cm,yshift=4mm]frame.north east) {\includegraphics[width=3cm]{logo}}; }]
- \centering\ttfamily\bfseries latexindent.pl\\[1cm] Version 3.0
+ \centering\ttfamily\bfseries latexindent.pl\\[1cm] Version 3.0.1
\end{tcolorbox}
}
\author{Chris Hughes \thanks{and contributors! See \vref{sec:contributors}. For
Modified: trunk/Master/texmf-dist/doc/support/latexindent/sec-how-to-use.tex
===================================================================
--- trunk/Master/texmf-dist/doc/support/latexindent/sec-how-to-use.tex 2017-04-29 22:24:28 UTC (rev 44119)
+++ trunk/Master/texmf-dist/doc/support/latexindent/sec-how-to-use.tex 2017-04-29 22:25:00 UTC (rev 44120)
@@ -217,7 +217,7 @@
\documentclass{article}
...
\end{cmhlistings}
-%(*@@*) arara: indent: { modifylinebreaks: yes }
+ %(*@@*) arara: indent: { modifylinebreaks: yes }
Hopefully the use of these rules is fairly self-explanatory, but for completeness
\cref{tab:orbsandswitches} shows the relationship between \texttt{arara} directive arguments and the
Modified: trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/AlignmentAtAmpersand.pm
===================================================================
--- trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/AlignmentAtAmpersand.pm 2017-04-29 22:24:28 UTC (rev 44119)
+++ trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/AlignmentAtAmpersand.pm 2017-04-29 22:25:00 UTC (rev 44120)
@@ -16,12 +16,14 @@
# For all communication, please visit: https://github.com/cmhughes/latexindent.pl
use strict;
use warnings;
+use utf8;
+use Unicode::GCString;
+use Data::Dumper;
+use Exporter qw/import/;
use LatexIndent::TrailingComments qw/$trailingCommentRegExp/;
use LatexIndent::Switches qw/$is_t_switch_active $is_tt_switch_active/;
use LatexIndent::GetYamlSettings qw/%masterSettings/;
use LatexIndent::Tokens qw/%tokens/;
-use Data::Dumper;
-use Exporter qw/import/;
our @ISA = "LatexIndent::Document"; # class inheritance, Programming Perl, pg 321
our @EXPORT_OK = qw/align_at_ampersand find_aligned_block/;
our $alignmentBlockCounter;
@@ -170,10 +172,13 @@
$column .= ($column =~ m/\\$/ ? " ": q());
# store the column size
- $columnSizes[$columnCount] = length($column) if(length($column)>$columnSizes[$columnCount]);
+ # reference: http://www.perl.com/pub/2012/05/perlunicook-unicode-column-width-for-printing.html
+ my $gcs = Unicode::GCString->new($column);
+ my $columnWidth = $gcs->columns();
+ $columnSizes[$columnCount] = $columnWidth if($columnWidth > $columnSizes[$columnCount]);
# put the row back together, using " " if the column is empty
- $strippedRow .= ($columnCount>0 ? "&" : q() ).(length($column)>0 ? $column: " ");
+ $strippedRow .= ($columnCount>0 ? "&" : q() ).($columnWidth > 0 ? $column: " ");
# move on to the next column
$columnCount++;
@@ -217,8 +222,31 @@
# finally, reformat the body
foreach(@formattedBody){
if(${$_}{format} and ${$_}{row} !~ m/^\h*$/){
+
+ my $columnCount=0;
+ my $tmpRow = q();
+ foreach my $column (split(/(?<!\\)&/,${$_}{row})){
+ # grab the column width
+ my $gcs = Unicode::GCString->new($column);
+ my $columnWidth = $gcs->columns();
+
+ # reset the padding
+ my $padding = q();
+ if($columnWidth < $columnSizes[$columnCount]){
+ $padding = " " x ($columnSizes[$columnCount] - $columnWidth);
+ }
+ $tmpRow .= $column.$padding." & ";
+ $columnCount++;
+ }
+
+ # remove the final &
+ $tmpRow =~ s/\s&\s$/ /;
+
+ # replace the row with the formatted row
+ ${$_}{row} = $tmpRow;
+
# format the row, and put the trailing \\ and trailing comments back into the row
- ${$_}{row} = sprintf($fmtstring,split(/(?<!\\)&/,${$_}{row})).(${$_}{endPiece} ? ${$_}{endPiece} :q() ).(${$_}{trailingComment}? ${$_}{trailingComment} : q() );
+ ${$_}{row} .= (${$_}{endPiece} ? ${$_}{endPiece} :q() ).(${$_}{trailingComment}? ${$_}{trailingComment} : q() );
# possibly remove space ahead of \\
${$_}{row} =~ s/\h*\\\\/\\\\/ if(!${$self}{alignDoubleBackSlash});
Modified: trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Document.pm
===================================================================
--- trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Document.pm 2017-04-29 22:24:28 UTC (rev 44119)
+++ trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Document.pm 2017-04-29 22:25:00 UTC (rev 44120)
@@ -17,6 +17,8 @@
use strict;
use warnings;
use Data::Dumper;
+use utf8;
+use open ':std', ':encoding(UTF-8)';
# gain access to subroutines in the following modules
use LatexIndent::Switches qw/storeSwitches %switches $is_m_switch_active $is_t_switch_active $is_tt_switch_active/;
Modified: trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/FileExtension.pm
===================================================================
--- trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/FileExtension.pm 2017-04-29 22:24:28 UTC (rev 44119)
+++ trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/FileExtension.pm 2017-04-29 22:25:00 UTC (rev 44120)
@@ -16,9 +16,12 @@
# For all communication, please visit: https://github.com/cmhughes/latexindent.pl
use strict;
use warnings;
-use LatexIndent::GetYamlSettings qw/%masterSettings/;
+use utf8;
+use PerlIO::encoding;
+use open ':std', ':encoding(UTF-8)';
use File::Basename; # to get the filename and directory path
use Exporter qw/import/;
+use LatexIndent::GetYamlSettings qw/%masterSettings/;
our @EXPORT_OK = qw/file_extension_check/;
sub file_extension_check{
Modified: trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/LogFile.pm
===================================================================
--- trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/LogFile.pm 2017-04-29 22:24:28 UTC (rev 44119)
+++ trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/LogFile.pm 2017-04-29 22:25:00 UTC (rev 44120)
@@ -41,7 +41,7 @@
my $self = shift;
# details of the script to log file
- $self->logger("$FindBin::Script version 3.0, a script to indent .tex files",'heading');
+ $self->logger("$FindBin::Script version 3.0.1, a script to indent .tex files",'heading');
$self->logger("$FindBin::Script lives here: $FindBin::RealBin/");
# time the script is used
@@ -50,7 +50,7 @@
if(scalar(@ARGV) < 1 or $switches{showhelp}) {
print <<ENDQUOTE
-latexindent.pl version 3.0
+latexindent.pl version 3.0.1
usage: latexindent.pl [options] [file][.tex|.sty|.cls|.bib|...]
-h, --help
help (see the documentation for detailed instructions and examples)
@@ -118,7 +118,7 @@
# output location of modules
if($FindBin::Script eq 'latexindent.pl' or ($FindBin::Script eq 'latexindent.exe' and $switches{trace} )) {
- my @listOfModules = ('FindBin', 'YAML::Tiny', 'File::Copy', 'File::Basename', 'Getopt::Long','File::HomeDir');
+ my @listOfModules = ('FindBin', 'YAML::Tiny', 'File::Copy', 'File::Basename', 'Getopt::Long','File::HomeDir','Unicode::GCString');
$self->logger("Perl modules are being loaded from the following directories:",'heading');
foreach my $moduleName (@listOfModules) {
(my $file = $moduleName) =~ s|::|/|g;
More information about the tex-live-commits
mailing list