Rosetta Code/List authors of task descriptions: Difference between revisions
Rosetta Code/List authors of task descriptions (view source)
Revision as of 23:54, 10 April 2018
, 6 years ago→{{header|Perl 6}}: Update table to be sortable on author name and # of tasks, only put task sorting header if an author has 3 or more tasks
Thundergnat (talk | contribs) (Move full listing to its own page) |
Thundergnat (talk | contribs) (→{{header|Perl 6}}: Update table to be sortable on author name and # of tasks, only put task sorting header if an author has 3 or more tasks) |
||
Line 103:
# Add table boilerplate and header
$out.say:
"\{|class=\"wikitable sortable\"\n",
"|+ As of { Date.today } :: Total Tasks: { $count }:: Tasks: { $taskcnt }",
" ::<span style=\"background-color:#ffd\"> Draft Tasks: { $draftcnt }
":: By {+%tasks{*}».<author>.unique} Authors\n",
"! Author !! Tasks !! Authored"
;
Line 116 ⟶ 117:
my $s = +@these == 1 ?? '' !! 's';
# Add author and contributions link to the first
$out.say:
$out.say: "|-\n| [[User:$author|$author]] : [[Special:Contributions/$author|",▼
$author ~~ /\d/
" { +@these } task{ $s }]]";▼
?? "|-\n|data-sort-value=\"{ sort-key $author }\"|[[User:$author|$author]]\n"~
▲
!! "|-\n|[[User:$author|$author]]\n"~
"|data-sort-value=\"{ +@these }\"|[[Special:Contributions/$author|"~
"{ +@these } task{ $s }]]"
;
if +@these > 2 {
$out.say: "|style=\"padding: 0px;\"|\n",▼
$out.say: "
"\{|class=\"broadtable sortable\" style=\"width: 100%;\"\n",
"! Task Name !! Date Added !! Status";
}
else {
▲ $out.say: "|style=\"padding: 0px;\"|\n",
"\{|class=\"broadtable\" style=\"width: 100%;\"";
}
# Tasks by this author, sorted by name
Line 142 ⟶ 156:
$out.say( "|}\n" );
$out.close;
note "Table file saved as: {$tablefile.IO.absolute}";
Line 160 ⟶ 175:
sub uri-query-string (*%fields) { %fields.map({ "{.key}={uri-escape .value}" }).join("&") }
sub sort-key ($a) { $a.lc.subst(/(\d+)/, ->$/ {0~(65+($0.chars)).chr~$0},:g) }
sub clear { "\r" ~ ' ' x 100 ~ "\r" }</lang>
{{out|Sample output}}
Line 169 ⟶ 183:
See full output at [[Rosetta_Code/List_authors_of_task_descriptions/Full_list]]
{|class="wikitable sortable"
|+ As of 2018-
! Author !! Tasks !! Authored
|-
|
|data-sort-value="2"|[[Special:Contributions/2Powers|2 tasks]]
|style="padding: 0px;"|
{|class="broadtable
|-
|style="background-color: #ffd;"| [[Names%20to%20numbers|Names to numbers]]
Line 187 ⟶ 201:
|}
|-
|
|data-sort-value="1"|[[Special:Contributions/12.175.32.19|1 task]]
|style="padding: 0px;"|
{|class="broadtable
|-
|style="background-color: #fff;"| [[Soundex|Soundex]]
Line 197 ⟶ 211:
|}
|-
|
|data-sort-value="1"|[[Special:Contributions/12Me21|1 task]]
|style="padding: 0px;"|
{|class="broadtable
|-
|style="background-color: #fff;"| [[Draw%20a%20rotating%20cube|Draw a rotating cube]]
Line 207 ⟶ 221:
|}
|-
|colspan="
|-
|
|data-sort-value="2"|[[Special:Contributions/Zorro1024|2 tasks]]
|style="padding: 0px;"|
{|class="broadtable
|-
|style="background-color: #fff;"| [[Perfect%20shuffle|Perfect shuffle]]
Line 223 ⟶ 237:
|}
|-
|
|data-sort-value="1"|[[Special:Contributions/Zzo38|1 task]]
|style="padding: 0px;"|
{|class="broadtable
|-
|style="background-color: #fff;"| [[Thue-Morse|Thue-Morse]]
Line 233 ⟶ 247:
|}
|-
|
|data-sort-value="3"|[[Special:Contributions/Русский|3 tasks]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
|