<?php
   // use to convert a tsv file (e.g., one imported into Excel, then copied/pasted
   // into a joe .txt file) into the format needed for nargslist

   require("../admin/fn-pl.php5");
   $year=file_get_contents("nargsyear");
   echo "<p>Processing nargs$year.tsv";
   $ll=explode("\n",file_get_contents("nargs$year.tsv"));
   foreach ($ll as $l) {
      if (!$l=trim($l)) continue;
      $f=explode("\t",str_replace('"',"",$l));
      $code=(int) $f[0];
      if ($code>0) {
         $plant=$f[1];
         linkifyname($plant);
         $e[]="$plant\t$code\t$f[2] ($f[3])\t$linkifylink\t$linkifylength\t$linkifyzones";
      }
   }
   sort($e);
   file_put_contents("nargslist",join("\n",$e)."\n");
   echo "All done: ".count($e)." entries.";
?>

      
     