common: replace newline output by say()
authorMischa POSLAWSKY <perl@shiar.org>
Wed, 29 Mar 2017 16:17:59 +0000 (18:17 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Mon, 24 Apr 2017 18:25:18 +0000 (20:25 +0200)
13 files changed:
apl.plp
chars.plp
charset.plp
countries.plp
digraphs.plp
digraphs.vim.plp
emoji.plp
index.plp
perl.plp
sc.plp
source.plp
termcol.plp
writing.plp

diff --git a/apl.plp b/apl.plp
index 546be3beb9a219df5668500019e7dd45bd918593..ba51a112f10e2cef917e8752f7ce8082b7651dd6 100644 (file)
--- a/apl.plp
+++ b/apl.plp
@@ -51,7 +51,7 @@ my @ops = do 'apl.inc.pl';
 <:
 for my $op (@ops) {
        $op or do {
-               print "<tbody>\n";
+               say '<tbody>';
                next;
        };
 
@@ -74,7 +74,7 @@ for my $op (@ops) {
                map { !!$_->[1] && qq( title="$_->[1]"), $_->[0] }
                [map { EscapeHTML($_) } split /\n/, $_, 2]
        ) for $monad, $dyad;
-       print "</td>\n";
+       say '</td>';
 }
 
 :></table>
index 96d74b4293285d0f2d345168bd7beb4d5ae11fce..b25c5e2ccb96aad30abf34c7d08f2252ef19daa3 100644 (file)
--- a/chars.plp
+++ b/chars.plp
@@ -113,7 +113,7 @@ for my $chr (@chars) {
        my $codepoint = ord $chr;
        my $ascii = $codepoint <= 127;
 
-       print "<tr><th>$chr\n";
+       say '<tr><th>', $chr;
        my $info = $glyphs->glyph_info($codepoint);
        my ($class, $name, $mnem, $entity, $string) = @$info;
        print "<td>$_" for sprintf('%X', $codepoint), EscapeHTML($name || '?');
index 3bf294e4489b4a54914bb03e97ab1e6fdac9b5f1..85b652bd89889c6c1586882571aea2ec3308cf16 100644 (file)
@@ -182,7 +182,7 @@ for my $row (@request) {
                }
                print "\n";
        }
-       print "</table></div>\n";
+       say '</table></div>';
 }
 
 :>
index 734a13397728c089efd94b33612b727366340ba0..60a392db5eb2f33989f34b31224c80bf459a8936 100644 (file)
@@ -57,7 +57,7 @@ my $cc = do 'countries.inc.pl';
                }
                print "\n";
        }
-       print "</table>\n";
+       say '</table>';
 }
 
 :>
index df84755cd43bd6ae6ce4ae7e8d25f32e3baba5d0..950c1b252ea8416a4f8aa1b4b15209e13a7f913e 100644 (file)
@@ -93,11 +93,11 @@ if ($mode) {
 for my $colchars (@columns) {
 print '<table class="glyphs dimap"><col>';
 print qq'<colgroup span="$_">' for map {scalar @$_} @{$colchars};
-print "</colgroup><col>\n";
+say '</colgroup><col>';
 for my $section (qw{thead tfoot}) {
        print "<$section><tr><th>↳";
        print '<th>', EscapeHTML($_) for map {@$_} @{$colchars};
-       print "<th>&nbsp;\n";
+       say '<th>&nbsp;';
 }
 for my $c1group (@chars) {
        print '<tbody>';
@@ -126,10 +126,10 @@ for my $c1group (@chars) {
                        printf "\n".'<td class="%s" title="%s">%s',
                                join(' ', @class), EscapeHTML($desc), $glyph;
                }
-               print "\n<th>", EscapeHTML($c1), "\n";
+               say "\n<th>", EscapeHTML($c1);
        }
 }
-print "</table>\n";
+say '</table>';
 print '<hr>' if exists $get{split};
 }
 
index 423c0573d60c86e8cdffb8a1b8eae45893b5b607..9883031bc1d03bf127a9f67115b5c07d8a862927 100644 (file)
@@ -6,7 +6,7 @@ use open IO => ':utf8';
 our $VERSION = 'v1.0';
 
 $header{content_type} = 'text/plain; charset=us-ascii';
-print '" vim digraph proposals <http://sheet.shiar.nl/digraphs>', "\n";
+say '" vim digraph proposals <http://sheet.shiar.nl/digraphs>';
 PLP_END { print "\n" };
 
 open my $include, '<', 'shiar.inc.txt' or do {
index f4559cc760ff7b1884dcf715857a2680cbebe1a6..ac3be58a841a93def0e8c03a1cc70e5ae2f5c79b 100644 (file)
--- a/emoji.plp
+++ b/emoji.plp
@@ -18,7 +18,7 @@ Html({
 <h1>IM emoticons</h1>
 
 <:
-print '<div class="section">'."\n";
+say '<div class="section">';
 
 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{<a href="$_">$title</a>} for $meta->{source} || ();
 
-       printf '<div class="section"><h2>%s</h2>'."\n\n", $meta->{name} // $system;
-       print '<table><tbody>'."\n";
+       say sprintf '<div class="section"><h2>%s</h2>', $meta->{name} // $system;
+       say '<table><tbody>';
        for (my $i = 0; $i <= $#info; $i++) {
                my $name = $info[$i];
                unless (ref $info[$i+1] eq 'ARRAY') {
-                       printf '</table><table><tbody>'."\n", $name;
+                       say sprintf '</table><table><tbody>', $name;
                        next;
                }
                my ($input, $flags, $char, $desc) = @{ $info[++$i] };
-               printf('<tr><th><img src="%s" alt="%s"><td><kbd>%s</kbd><td>%s%s'."\n",
+               say sprintf('<tr><th><img src="%s" alt="%s"><td><kbd>%s</kbd><td>%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 ? '<td>'.chr($char) : '',
                );
        }
-       print "</table></div>\n\n";
+       say "</table></div>\n";
 }
 
-print "</div><hr>\n\n";
+say "</div><hr>\n";
 
index 01b59c4844c8837b7ed0b70672c5f1d738dcc536..f8a193876eb6ed67d4a4fc91c63579b586da5415 100644 (file)
--- 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/<small>/ and $date .= '</small>';
-       print "<p><strong>Last update</strong>: $date $subject</p>\n";
+       say "<p><strong>Last update</strong>: $date $subject</p>";
 }}
 
 :>
index 57401d2be1214cf072e1c349457e380d2f4974e8..17145e360f2ae804d7c2ce87ca490e8c5d9fc53d 100644 (file)
--- 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 '<div class="section">'."\n";
-       printf '<h2>%vd <small>%s</small></h2><dl>'."\n", $vernum, $verrow->{release};
+       say '<div class="section">';
+       say sprintf '<h2>%vd <small>%s</small></h2><dl>', $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 ' <em class="ex">(%s)</em>', $title;
                }
-               printf '<dt>%s<dd>%s'."\n", $topic, $desc || '<br/>';
+               say sprintf '<dt>%s<dd>%s', $topic, $desc || '<br/>';
        }
-       printf '<dt>Unicode</dt><dd>v%s'."\n", $_ for $verrow->{unicode} || ();
-       print "</dl>\n";
-       print "</div>\n\n";
+       say sprintf '<dt>Unicode</dt><dd>v%s', $_ for $verrow->{unicode} || ();
+       say '</dl>';
+       say "</div>\n";
 }
 
diff --git a/sc.plp b/sc.plp
index 0966fc48942aff86d325f1f17a1f0b9cf2ba90ce..edbc4c610f27a6674bc922157205ee924883a544 100644 (file)
--- a/sc.plp
+++ b/sc.plp
@@ -40,19 +40,19 @@ Html({
        data => [$datafile],
 });
 
-print "<h1>$scver{game} units</h1>\n\n";
+say "<h1>$scver{game} units</h1>\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 "<p>Unit properties as seen or measured in $scver{name}\n$patch.\n";
-print "Also see the $_ table.\n" for join(', ',
+say "<p>Unit properties as seen or measured in $scver{name}\n$patch.";
+say "Also see the $_ table." for join(', ',
        ('<a href="/sc/2">StarCraft 2: HotS</a>')    x ($scver{major} < 2),
        ('<a href="/sc">original SC: Brood War</a>') x ($scver{major} > 1),
 );
-print "</p>\n\n";
+say "</p>\n";
 
 sub addupgrade {
        my ($ref, $increase, $org) = @_;
@@ -376,7 +376,7 @@ sub showrangeint {
        my ($race, $cat) = ('', '');
        for (@rows) {
                if ($grouped) {
-                       printf '<tbody id="%s"><tr class="race"><th colspan="20"><h2>%s</h2>'."\n",
+                       say sprintf '<tbody id="%s"><tr class="race"><th colspan="20"><h2>%s</h2>',
                                $race = $_->{race}, ucfirst $race
                                        unless $race eq $_->{race};
                }
index 7facf51a885f7662c1126a514df9f33696662822..097f0ac3f310b103b97cdd68a00fd0dfa5cef2b2 100644 (file)
@@ -39,21 +39,21 @@ Html({
        stylesheet => [qw'light dark mono red'],
 });
 
-print "\n";
+say '';
 
 if (not $source) {
        print "<h1>Source files</h1>";
 
        print "<p>Project code distributed under the AGPL. Please contribute back.</p>";
-       print '<ul>'."\n";
+       say '<ul>';
        for (glob '*.plp') {
                chomp;
-               printf '<li><a href="/source/%s">%1$s</a></li>'."\n", EscapeHTML($_);
+               say sprintf '<li><a href="/source/%s">%1$s</a></li>', EscapeHTML($_);
        }
-       print "</ul>\n\n";
+       say "</ul>\n";
 }
 else {
-       print "<h1>Source of $source</h1>\n";
+       say "<h1>Source of $source</h1>";
 
        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 "<pre>\n";
+               say '<pre>';
                foreach (@$parsed) {
                        my ($type, $contents) = @{$_};
                        $contents = Encode::decode_utf8($contents);
@@ -106,14 +106,14 @@ else {
                        print Text::VimColor::_xml_escape($contents);
                        print "</$tag>" if $tag;
                }
-               print "</pre>\n";
+               say '</pre>';
        }
        else {
-               print "<pre>\n";
+               say '<pre>';
                print EscapeHTML(Encode::decode_utf8(ReadFile($source)));
-               print "</pre>\n";
+               say '</pre>';
        }
 
-       print "\n";
+       say '';
 }
 
index f2dde7f1cf03bc67b0c56b6a8e003bc10cdf2684..ddf6eb4f5d5b40b5c644f6e01a645528095a6343 100644 (file)
@@ -119,15 +119,15 @@ sub coltable {
        ) if $info->{href} or $info->{title};
 
        if (my $mapinfo = $info->{rgbmap}) {
-               print '<table class="color mapped">'."\n";
-               printf "<caption>%s</caption>\n", $caption;
+               say '<table class="color mapped">';
+               say sprintf '<caption>%s</caption>', $caption;
                print coltable_hsv(@{$mapinfo});
-               print "</table>\n\n";
+               say "</table>\n";
        }
 
        if (my $table = $info->{table}) {
-               print '<table class="color mapped">'."\n";
-               printf "<caption>%s</caption>\n", $caption;
+               say '<table class="color mapped">';
+               say sprintf '<caption>%s</caption>', $caption;
                for my $row (@$table) {
                        print '<tr>';
                        print colcell(ref $_ ? @$_ : $_ ? reverse split /:/ : undef) for @$row;
@@ -142,7 +142,7 @@ sub coltable {
                        print "<tr><td colspan=$width>", img_egapal(\@imgpal, @{$_});
                }
        }
-               print "</table>\n\n";
+               say "</table>\n";
        }
 
        if (my $palette = $info->{list}) {
@@ -154,8 +154,8 @@ sub coltable {
                my $rows = 8;
                my $columns = ceil(@{$palette} / $rows);
 
-               print '<table class=color>', "\n";
-               printf "<caption>%s</caption>\n", $caption;
+               say '<table class=color>';
+               say sprintf '<caption>%s</caption>', $caption;
                for my $row (0 .. $rows - 1) {
                        print '<tr>';
                        for my $col (0 .. $columns - 1) {
@@ -174,7 +174,7 @@ sub coltable {
                        );
                        print "<tr><td colspan=$columns>", img_egapal($imgpal, @{$_});
                }
-               print "</table>\n\n";
+               say "</table>\n";
        }
 }
 
index 61e9e1f7f2dc1914ac9ebe1c691f4b0640bf16a1..a718c884bd6a1c8ffab718bc7107a32d3a793c73 100644 (file)
@@ -45,7 +45,7 @@ for (
        my ($source, $title) = @$_;
        my @table = do "writing-$source.inc.pl";
        if ($! or $@) {
-               print "<h2>$title</h2>\n";
+               say "<h2>$title</h2>";
                printf "<p>Table data not found: <em>%s</em>.</p>\n", $@ || $!;
                next;
        }