Wikipedia:List of Wikipedians by featured article nominations/script

This is the script currently run by user:Rick Bot to produce the content of List of Wikipedians by featured article nominations from the by year nomation lists (which are updated separately and assumed to be in the files FAnoms.2007 FAnoms.2006 FAnoms.2005 FAnoms.2004 FAnoms.2003). This script also uses as input preprocessed versions of WP:FA and WP:FFA assumed to be in the files "featureds" and "formers". -- Rick Block (talk) 17:02, 29 May 2007 (UTC)


 * 1) !/bin/bash

cat FAnoms.2007 FAnoms.2006 FAnoms.2005 FAnoms.2004 FAnoms.2003 | awk ' function nomd(nom, article) {

sub("^ *","",nom) sub(" *$","",nom) sub("^ *","",article) sub(" *$","",article) sub("^<.>","",article) sub("$","",article) user = nom if (sub("\\|.*]]","",user) > 0) { sub("^..[uU][sS][eE][rR]:","",user) } user = toupper(substr(user,1,1)) substr(user,2,length(user)-1) if (fulluser[user] == "") { fulluser[user] = nom } if (sub("^'"''"'*\\[","[",article) > 0) { sub("'"'"'* *$","",article) } noms[user] = noms[user] "||" article nomcount[user] = nomcount[user] + 1 }

BEGIN { FS="\\|\\|" }

/^\|\|/ { if ($4 ~ /]] & /) { split($4,multinoms," & ") for (nom in multinoms) { nomd(multinoms[nom],$2) } } else { nomd($4,$2) } }

END { for (nom in nomcount) { if (nom != "") { print nomcount[nom] "||" fulluser[nom] noms[nom] } else { print nomcount[nom] "||MISSING" noms[nom] } } } ' | sort -t'|' +0rn +2f| tee nomlist | cat featureds formers - | awk >WBFAN.table ' BEGIN { FS="\\|\\|" }

/^FEATURED/ { featured[$2] = 1 next }

/^FORMER/ { former[$2] = 1 next }

{ if ( $2 != "MISSING" ) { print "|-" print "| " $2 } numarts = 0 for ( i=3; i<=NF; i=i+1) { sub("\\|.*]]","]]",$i) numarts = numarts + 1 if (numarts > 20) { if ( $2 != "MISSING") { printf "|-\n||\n" }     numarts = 1 }   sub("]] *$","",$i) sub("^ [[" $i "|&#9733; "     }      former[$i] = 2    } else {      if ( $2 != "MISSING") {        print "|  &#9733;"      }      if (featured[$i] > 0) {        featured[$i] = 2      } else {        neverfeatured[$i] = 1      }    }  } }

END {

for (art in featured) { if (featured[art] == 1 ) { if (fanonom == 0) { print "" }

for (art in former) { if (former[art] == 1 ) { if (ffanonom == 0) { print "" }

for (art in neverfeatured) { if (art != "Pumping lemma" && art != "Provinces of Thailand") { if (histonly == 0) { print "" }

}'

/usr/bin/curl "http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_Wikipedians_by_featured_article_nominations&action=raw" | awk >WBFAN ' /^[|]-$/ { skip=1 }

/^[|]}/ { skip=0 while ( getline <"WBFAN.table" ) { print $0 } print "|}" next }

{ if (skip == 1) { next } print $0 }'