From b22f63ba31441200ca915c64445d5a87d146c327 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Wed, 29 Mar 2017 18:17:59 +0200 Subject: [PATCH] common: replace newline output by say() --- apl.plp | 4 ++-- chars.plp | 2 +- charset.plp | 2 +- countries.plp | 2 +- digraphs.plp | 8 ++++---- digraphs.vim.plp | 2 +- emoji.plp | 14 +++++++------- index.plp | 2 +- perl.plp | 12 ++++++------ sc.plp | 10 +++++----- source.plp | 20 ++++++++++---------- termcol.plp | 18 +++++++++--------- writing.plp | 2 +- 13 files changed, 49 insertions(+), 49 deletions(-) diff --git a/apl.plp b/apl.plp index 546be3b..ba51a11 100644 --- a/apl.plp +++ b/apl.plp @@ -51,7 +51,7 @@ my @ops = do 'apl.inc.pl'; <: for my $op (@ops) { $op or do { - print "\n"; + say ''; next; }; @@ -74,7 +74,7 @@ for my $op (@ops) { map { !!$_->[1] && qq( title="$_->[1]"), $_->[0] } [map { EscapeHTML($_) } split /\n/, $_, 2] ) for $monad, $dyad; - print "\n"; + say ''; } :> diff --git a/chars.plp b/chars.plp index 96d74b4..b25c5e2 100644 --- a/chars.plp +++ b/chars.plp @@ -113,7 +113,7 @@ for my $chr (@chars) { my $codepoint = ord $chr; my $ascii = $codepoint <= 127; - print "$chr\n"; + say '', $chr; my $info = $glyphs->glyph_info($codepoint); my ($class, $name, $mnem, $entity, $string) = @$info; print "$_" for sprintf('%X', $codepoint), EscapeHTML($name || '?'); diff --git a/charset.plp b/charset.plp index 3bf294e..85b652b 100644 --- a/charset.plp +++ b/charset.plp @@ -182,7 +182,7 @@ for my $row (@request) { } print "\n"; } - print "\n"; + say ''; } :> diff --git a/countries.plp b/countries.plp index 734a133..60a392d 100644 --- a/countries.plp +++ b/countries.plp @@ -57,7 +57,7 @@ my $cc = do 'countries.inc.pl'; } print "\n"; } - print "\n"; + say ''; } :> diff --git a/digraphs.plp b/digraphs.plp index df84755..950c1b2 100644 --- a/digraphs.plp +++ b/digraphs.plp @@ -93,11 +93,11 @@ if ($mode) { for my $colchars (@columns) { print ''; print qq'' for map {scalar @$_} @{$colchars}; -print "\n"; +say ''; for my $section (qw{thead tfoot}) { print "<$section>'; @@ -126,10 +126,10 @@ for my $c1group (@chars) { printf "\n".'
↳"; print '', EscapeHTML($_) for map {@$_} @{$colchars}; - print " \n"; + say ' '; } for my $c1group (@chars) { print '
%s', join(' ', @class), EscapeHTML($desc), $glyph; } - print "\n", EscapeHTML($c1), "\n"; + say "\n", EscapeHTML($c1); } } -print "
\n"; +say ''; print '
' if exists $get{split}; } diff --git a/digraphs.vim.plp b/digraphs.vim.plp index 423c057..9883031 100644 --- a/digraphs.vim.plp +++ b/digraphs.vim.plp @@ -6,7 +6,7 @@ use open IO => ':utf8'; our $VERSION = 'v1.0'; $header{content_type} = 'text/plain; charset=us-ascii'; -print '" vim digraph proposals ', "\n"; +say '" vim digraph proposals '; PLP_END { print "\n" }; open my $include, '<', 'shiar.inc.txt' or do { diff --git a/emoji.plp b/emoji.plp index f4559cc..ac3be58 100644 --- a/emoji.plp +++ b/emoji.plp @@ -18,7 +18,7 @@ Html({

IM emoticons

<: -print '
'."\n"; +say '
'; for my $system (qw'gmail msn yahoo') { my @info = do "emoji-$system.inc.pl"; @@ -27,16 +27,16 @@ for my $system (qw'gmail msn yahoo') { my $title = $meta->{name} // $system; $title = qq{$title} for $meta->{source} || (); - printf '

%s

'."\n\n", $meta->{name} // $system; - print ''."\n"; + say sprintf '

%s

', $meta->{name} // $system; + say '
'; for (my $i = 0; $i <= $#info; $i++) { my $name = $info[$i]; unless (ref $info[$i+1] eq 'ARRAY') { - printf '
'."\n", $name; + say sprintf '
', $name; next; } my ($input, $flags, $char, $desc) = @{ $info[++$i] }; - printf('
%s%s%s%s'."\n", + say sprintf('
%s%s%s%s', sprintf($meta->{ $flags =~ /\bext\b/ ? 'iconext' : 'icon' } // '%s', $name), EscapeHTML($name), EscapeHTML($input), @@ -44,8 +44,8 @@ for my $system (qw'gmail msn yahoo') { $char ? ''.chr($char) : '', ); } - print "
\n\n"; + say "
\n"; } -print "

\n\n"; +say "
\n"; diff --git a/index.plp b/index.plp index 01b59c4..f8a1938 100644 --- a/index.plp +++ b/index.plp @@ -28,7 +28,7 @@ if (open my $log, '-|', git => 'log', -1, @format) {{ $line or next; # explicitly ignore empty input my ($date, $subject) = split /[\t\n]/, $line; $date =~ s/ \K// and $date .= ''; - print "

Last update: $date $subject

\n"; + say "

Last update: $date $subject

"; }} :> diff --git a/perl.plp b/perl.plp index 57401d2..17145e3 100644 --- a/perl.plp +++ b/perl.plp @@ -26,8 +26,8 @@ for my $vernum (reverse sort keys %{$info}) { my $verrow = $info->{$vernum}; $verrow->{unstable} and next unless exists $get{v}; - print '
'."\n"; - printf '

%vd %s

'."\n", $vernum, $verrow->{release}; + say '
'; + say sprintf '

%vd %s

', $vernum, $verrow->{release}; for (@{ $verrow->{new} }) { my ($topic, $desc, $attr) = @{$_}; if ($attr) { @@ -52,10 +52,10 @@ for my $vernum (reverse sort keys %{$info}) { } $desc .= sprintf ' (%s)', $title; } - printf '
%s
%s'."\n", $topic, $desc || '
'; + say sprintf '
%s
%s', $topic, $desc || '
'; } - printf '
Unicode
v%s'."\n", $_ for $verrow->{unicode} || (); - print "
\n"; - print "
\n\n"; + say sprintf '
Unicode
v%s', $_ for $verrow->{unicode} || (); + say '
'; + say "
\n"; } diff --git a/sc.plp b/sc.plp index 0966fc4..edbc4c6 100644 --- a/sc.plp +++ b/sc.plp @@ -40,19 +40,19 @@ Html({ data => [$datafile], }); -print "

$scver{game} units

\n\n"; +say "

$scver{game} units

\n"; my $units = do $datafile; die "Cannot open unit data: $_\n" for $@ || $! || (); my $patch = shift @{$units} or die "Cannot open unit data: metadata not found\n"; -print "

Unit properties as seen or measured in $scver{name}\n$patch.\n"; -print "Also see the $_ table.\n" for join(', ', +say "

Unit properties as seen or measured in $scver{name}\n$patch."; +say "Also see the $_ table." for join(', ', ('StarCraft 2: HotS') x ($scver{major} < 2), ('original SC: Brood War') x ($scver{major} > 1), ); -print "

\n\n"; +say "

\n"; sub addupgrade { my ($ref, $increase, $org) = @_; @@ -376,7 +376,7 @@ sub showrangeint { my ($race, $cat) = ('', ''); for (@rows) { if ($grouped) { - printf '

%s

'."\n", + say sprintf '

%s

', $race = $_->{race}, ucfirst $race unless $race eq $_->{race}; } diff --git a/source.plp b/source.plp index 7facf51..097f0ac 100644 --- a/source.plp +++ b/source.plp @@ -39,21 +39,21 @@ Html({ stylesheet => [qw'light dark mono red'], }); -print "\n"; +say ''; if (not $source) { print "

Source files

"; print "

Project code distributed under the AGPL. Please contribute back.

"; - print '
    '."\n"; + say '
      '; for (glob '*.plp') { chomp; - printf '
    • %1$s
    • '."\n", EscapeHTML($_); + say sprintf '
    • %1$s
    • ', EscapeHTML($_); } - print "
    \n\n"; + say "
\n"; } else { - print "

Source of $source

\n"; + say "

Source of $source

"; if ($source =~ m{(?:/|^)\.}) { die "File request not permitted\n"; @@ -82,7 +82,7 @@ else { vim_options => [@Text::VimColor::VIM_OPTIONS, '+:set enc=utf-8'], ); my $parsed = $hl->marked; - print "
\n";
+		say '
';
 		foreach (@$parsed) {
 			my ($type, $contents) = @{$_};
 			$contents = Encode::decode_utf8($contents);
@@ -106,14 +106,14 @@ else {
 			print Text::VimColor::_xml_escape($contents);
 			print "" if $tag;
 		}
-		print "
\n"; + say '
'; } else { - print "
\n";
+		say '
';
 		print EscapeHTML(Encode::decode_utf8(ReadFile($source)));
-		print "
\n"; + say '
'; } - print "\n"; + say ''; } diff --git a/termcol.plp b/termcol.plp index f2dde7f..ddf6eb4 100644 --- a/termcol.plp +++ b/termcol.plp @@ -119,15 +119,15 @@ sub coltable { ) if $info->{href} or $info->{title}; if (my $mapinfo = $info->{rgbmap}) { - print ''."\n"; - printf "\n", $caption; + say '
%s
'; + say sprintf '', $caption; print coltable_hsv(@{$mapinfo}); - print "
%s
\n\n"; + say "\n"; } if (my $table = $info->{table}) { - print ''."\n"; - printf "\n", $caption; + say '
%s
'; + say sprintf '', $caption; for my $row (@$table) { print ''; print colcell(ref $_ ? @$_ : $_ ? reverse split /:/ : undef) for @$row; @@ -142,7 +142,7 @@ sub coltable { print "
%s
", img_egapal(\@imgpal, @{$_}); } } - print "
\n\n"; + say "\n"; } if (my $palette = $info->{list}) { @@ -154,8 +154,8 @@ sub coltable { my $rows = 8; my $columns = ceil(@{$palette} / $rows); - print '', "\n"; - printf "\n", $caption; + say '
%s
'; + say sprintf '', $caption; for my $row (0 .. $rows - 1) { print ''; for my $col (0 .. $columns - 1) { @@ -174,7 +174,7 @@ sub coltable { ); print "
%s
", img_egapal($imgpal, @{$_}); } - print "
\n\n"; + say "\n"; } } diff --git a/writing.plp b/writing.plp index 61e9e1f..a718c88 100644 --- a/writing.plp +++ b/writing.plp @@ -45,7 +45,7 @@ for ( my ($source, $title) = @$_; my @table = do "writing-$source.inc.pl"; if ($! or $@) { - print "

$title

\n"; + say "

$title

"; printf "

Table data not found: %s.

\n", $@ || $!; next; } -- 2.30.0