original_string: public static function wiki_parser_table_callback($table) {
          $html = "";
          $headers = $table[0];
          $columncount = count($headers);
          $headerhtml = "";
          foreach($headers as $h) {
              $text = trim($h[1]);
              if($h[0] == 'header') {
                  $headerhtml .= "\n".parser_utils::h('th', $text)."\n";
                  $hasheaders = true;
              }
              else if($h[0] == 'normal'){
                  $headerhtml .= "\n".parser_utils::h("td", $text)."\n";
              }
          }
          $headerhtml = "\n".parser_utils::h('tr', $headerhtml)."\n";
          $bodyhtml = "";
          if(isset($hasheaders)) {
              $html = "\n".parser_utils::h('thead', $headerhtml)."\n";
          }
          else {
              $bodyhtml .= $headerhtml;
          }
  
          array_shift($table);
          foreach($table as $row) {
              $htmlrow = "";
              for($i = 0; $i < $columncount; $i++) {
                  $text = "";
                  if(!isset($row[$i])) {
                      $htmlrow .= "\n".parser_utils::h('td', $text)."\n";
                  }
                  else {
                      $text = trim($row[$i][1]);
                      if($row[$i][0] == 'header') {
                          $htmlrow .= "\n".parser_utils::h('th', $text)."\n";
                      }
                      else if($row[$i][0] == 'normal'){
                          $htmlrow .= "\n".parser_utils::h('td', $text)."\n";
                      }   
                  }
              }
              $bodyhtml .= "\n".parser_utils::h('tr', $htmlrow)."\n";
          }
  
          $html .= "\n".parser_utils::h('tbody', $bodyhtml)."\n";
          return "\n".parser_utils::h('table', $html)."\n";
      }
code: public static function wiki_parser_table_callback($table) {
          $html = "";
          $headers = $table[0];
          $columncount = count($headers);
          $headerhtml = "";
          foreach($headers as $h) {
              $text = trim($h[1]);
              if($h[0] == 'header') {
                  $headerhtml .= "\n".parser_utils::h('th', $text)."\n";
                  $hasheaders = true;
              }
              else if($h[0] == 'normal'){
                  $headerhtml .= "\n".parser_utils::h("td", $text)."\n";
              }
          }
          $headerhtml = "\n".parser_utils::h('tr', $headerhtml)."\n";
          $bodyhtml = "";
          if(isset($hasheaders)) {
              $html = "\n".parser_utils::h('thead', $headerhtml)."\n";
          }
          else {
              $bodyhtml .= $headerhtml;
          }
  
          array_shift($table);
          foreach($table as $row) {
              $htmlrow = "";
              for($i = 0; $i < $columncount; $i++) {
                  $text = "";
                  if(!isset($row[$i])) {
                      $htmlrow .= "\n".parser_utils::h('td', $text)."\n";
                  }
                  else {
                      $text = trim($row[$i][1]);
                      if($row[$i][0] == 'header') {
                          $htmlrow .= "\n".parser_utils::h('th', $text)."\n";
                      }
                      else if($row[$i][0] == 'normal'){
                          $htmlrow .= "\n".parser_utils::h('td', $text)."\n";
                      }   
                  }
              }
              $bodyhtml .= "\n".parser_utils::h('tr', $htmlrow)."\n";
          }
  
          $html .= "\n".parser_utils::h('tbody', $bodyhtml)."\n";
          return "\n".parser_utils::h('table', $html)."\n";
      }
code_tokens: public static function wiki_parser_table_callback ( $ table ) { $ html = "" ; $ headers = $ table [ 0 ] ; $ columncount = count ( $ headers ) ; $ headerhtml = "" ; foreach ( $ headers as $ h ) { $ text = trim ( $ h [ 1 ] ) ; if ( $ h [ 0 ] == 'header' ) { $ headerhtml .= "\n" . parser_utils :: h ( 'th' , $ text ) . "\n" ; $ hasheaders = true ; } else if ( $ h [ 0 ] == 'normal' ) { $ headerhtml .= "\n" . parser_utils :: h ( "td" , $ text ) . "\n" ; } } $ headerhtml = "\n" . parser_utils :: h ( 'tr' , $ headerhtml ) . "\n" ; $ bodyhtml = "" ; if ( isset ( $ hasheaders ) ) { $ html = "\n" . parser_utils :: h ( 'thead' , $ headerhtml ) . "\n" ; } else { $ bodyhtml .= $ headerhtml ; } array_shift ( $ table ) ; foreach ( $ table as $ row ) { $ htmlrow = "" ; for ( $ i = 0 ; $ i < $ columncount ; $ i ++ ) { $ text = "" ; if ( ! isset ( $ row [ $ i ] ) ) { $ htmlrow .= "\n" . parser_utils :: h ( 'td' , $ text ) . "\n" ; } else { $ text = trim ( $ row [ $ i ] [ 1 ] ) ; if ( $ row [ $ i ] [ 0 ] == 'header' ) { $ htmlrow .= "\n" . parser_utils :: h ( 'th' , $ text ) . "\n" ; } else if ( $ row [ $ i ] [ 0 ] == 'normal' ) { $ htmlrow .= "\n" . parser_utils :: h ( 'td' , $ text ) . "\n" ; } } } $ bodyhtml .= "\n" . parser_utils :: h ( 'tr' , $ htmlrow ) . "\n" ; } $ html .= "\n" . parser_utils :: h ( 'tbody' , $ bodyhtml ) . "\n" ; return "\n" . parser_utils :: h ( 'table' , $ html ) . "\n" ; }
docstring: Default table generator
docstring_tokens: Default table generator