Jump to content

Rosetta Code/List authors of task descriptions: Difference between revisions

→‎{{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
(Move full listing to its own page)
(→‎{{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 }\n </span>",
":: 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 celltwo cells
$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"~
$out.say: "|data-sort-value=\n|"{ [[User:$author+@these }\"|$author]] : [[Special:Contributions/$author|",~
" "{ +@these } task{ $s }]]";
!! "|-\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=\"widthpadding: 100%0px;\"|\n",
"\{|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>
</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-0304-3110 :: Total Tasks: 1080:: Tasks: 871 ::<span style="background-color:#ffd"> Draft Tasks: 209 </span>:: By 251 Authors
! Author !! Tasks !! Authored
|-
| data-sort-value="0B2powers"|[[User:2Powers|2Powers]] : [[Special:Contributions/2Powers| 2 tasks]]
|data-sort-value="2"|[[Special:Contributions/2Powers|2 tasks]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
! Task Name !! Date Added !! Status
|-
|style="background-color: #ffd;"| [[Names%20to%20numbers|Names to numbers]]
Line 187 ⟶ 201:
|}
|-
| data-sort-value="0C12.0D175.0C32.0C19"|[[User:12.175.32.19|12.175.32.19]] : [[Special:Contributions/12.175.32.19| 1 task]]
|data-sort-value="1"|[[Special:Contributions/12.175.32.19|1 task]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
! Task Name !! Date Added !! Status
|-
|style="background-color: #fff;"| [[Soundex|Soundex]]
Line 197 ⟶ 211:
|}
|-
| data-sort-value="0C12me0C21"|[[User:12Me21|12Me21]] : [[Special:Contributions/12Me21| 1 task]]
|data-sort-value="1"|[[Special:Contributions/12Me21|1 task]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
! Task Name !! Date Added !! Status
|-
|style="background-color: #fff;"| [[Draw%20a%20rotating%20cube|Draw a rotating cube]]
Line 207 ⟶ 221:
|}
|-
|colspan="23"|many rows omitted...
|-
| data-sort-value="zorro0E1024"|[[User:Zorro1024|Zorro1024]] : [[Special:Contributions/Zorro1024| 2 tasks]]
|data-sort-value="2"|[[Special:Contributions/Zorro1024|2 tasks]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
! Task Name !! Date Added !! Status
|-
|style="background-color: #fff;"| [[Perfect%20shuffle|Perfect shuffle]]
Line 223 ⟶ 237:
|}
|-
| data-sort-value="zzo0C38"|[[User:Zzo38|Zzo38]] : [[Special:Contributions/Zzo38| 1 task]]
|data-sort-value="1"|[[Special:Contributions/Zzo38|1 task]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
! Task Name !! Date Added !! Status
|-
|style="background-color: #fff;"| [[Thue-Morse|Thue-Morse]]
Line 233 ⟶ 247:
|}
|-
| [[User:Русский|Русский]] : [[Special:Contributions/Русский| 3 tasks]]
|data-sort-value="3"|[[Special:Contributions/Русский|3 tasks]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
10,333

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.