Bug#948969: wnpp.pl fix

victory <[email protected]>
Newsgroups gmane.linux.debian.devel.www
Message-ID <20200401152321.8f2a6826450a5a31bf79b16b__12943.1329014309$1585722442$gmane$org@gmail.com>
in wnpp.pl,
L107
    push @rfa_bypackage_html, " <pdolink \"$pkg\" />, ";
L122
        push @rfa_bymaint_html, " <pdolink \"$pkg\" />, ";
L136
    push @rfa_byage_html, " <pdolink \"$pkg\" />, ";
L148
    push @orphaned_html, " <pdolink \"$pkg\" />, ";
L160
    push @orphaned_byage_html, " <pdolink \"$pkg\" />";
L174
         " <pdolink \"$pkg\" />, ";
L191
         " <pdolink \"$pkg\" />, ";
L207
         " <pdolink \"$pkg\" />, ";
L286
         " <pdolink \"$rfh_pkg{$_}\" />, ";
L302
         " <pdolink \"$rfh_pkg{$_}\" />, ";
L314
	" <pdolink \"$rfh_pkg{$_}\" />, <popcon \"$popcon{$rfh_pkg{$_}}\" />, ";

these <pdolink ..../> need to be 1 by 1 as pdo site does not accept multiple stanza;;
I suggest most clear way, adding a sub routine named "pdolinks"
and replace these <pdolink> tags w/ a snippet refering this, like:
  &pdolinks($pkg);
---
# this sub routine takes 1 arg, expects "pkg1, pkg2, ..." form
# and returns a scalar: "<pdolink "pkg1" />[, <pdolink "pkg2" />, ...]
# additional description for noob:
# 1st line: $packages takes the 1st arg
# 2nd line: @packages takes indivisual packages for each element
# 3rd-6th lines: cleanup and <pdolink>'ifies every element in @packages
# 8th line: join concatenates array using specified separator as the 1st arg
# if it returns an array, the @..._html arrays will contain every links 1 by 1
sub pdolinks{
  my $packages = shift;
  my @packages = split(/[\s,]+/, $packages);
  for (my $i=0; $i<$#packages; $i++){
    $packages[$i] =~ s/[\s,]//g;
    $packages[$i] = "<pdolink \"$packages[$i]\" />":
  }
  return join(", ", @packages);
}
---

note that I did no test;
additionally, popcon links may have the same issue
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.