Compact Archives compact.php modify

In order to display the compact archives as a table, I modified part of the compact.php as below, pay attention to the li part.

foreach ( $dates as $year => $months ) {
    $result .= $before . '<li class="theyear"><a href="' . get_year_link( $year ) . '">' . $year . '</a></li>';
    for ( $month = 1; $month <= 12; $month += 1 ) {
        $month_has_posts = ( isset( $months[$month] ) );
        $dummydate = strtotime( "$month/01/2001" );
        // get the month name; strftime() localizes
        $month_name = strftime( "%B", $dummydate );
        switch ( $style ) {
        case 'initial':
            $month_abbrev = $month_name[0]; // the inital of the month
            break;
        case 'block':
            $month_abbrev = strftime( "%b", $dummydate ); // get the short month name; strftime() localizes
            break;
        case 'numeric':
            $month_abbrev = strftime( "%m", $dummydate ); // get the month number, e.g., '04'
            break;
        default:
            $month_abbrev = $month_name[0]; // the inital of the month
        }
        if ( $month_has_posts ) {
            $result .= '<li><a class="amonth" href="' . get_month_link( $year, $month ) . '" title="' . $month_name . ' ' . $year . '">' . $month_abbrev . '</a></li> ';
        } else {
            $result .= '<li><span class="emptymonth">' . $month_abbrev . '</span></li> ';
        }
    }
    $result .= $after."\n";
}