Changeset 131
- Timestamp:
- 06/20/2006 08:09:19 AM (4 years ago)
- Files:
-
- 1 modified
-
trunk/formatters/wakka.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/formatters/wakka.php
r129 r131 95 95 } 96 96 // table. trigger means: 0==no table, 1==in table no cell, 2==in table data cell, 3==in table header cell 97 else if ( preg_match("/^\|(=|!)?( \d*)?(?:,)?(\d*)?\|(\n)?$/", $thing, $matches) ) {97 else if ( preg_match("/^\|(=|!)?(c|r)?(\d*)?(?:,)?(\d*)?\|(\n)?$/", $thing, $matches) ) { 98 98 //First catch is header|caption|summary, second is colspan, third is rowspan, fourth is linebreak. 99 if ( $trigger_table == 0 ) 100 { 101 $rs = "<table class=\"wikka\">\n"; 102 if ($matches[1] == "!") { 103 $trigger_table = 4; 104 return $rs."<caption>"; 99 if ( $trigger_table == 4 ) { 100 $trigger_table = 1; 101 return '</caption>'."\n"; //Can return here, it is closed. 102 } 103 else if ( $trigger_table == 3 ) $close_part = '</th>'; 104 else if ( $trigger_table == 2 ) $close_part = '</td>'; 105 else if ( $trigger_table == 1 ) $close_part = ''; 106 else $close_part = '<table class="wikka">'."\n"; 107 108 if ( $trigger_table > 1 && $matches[5] == "\n" ) { 109 $trigger_table = 1; 110 return $close_part .= '</tr>'."\n"; //Can return here, it is closed- 111 } 112 113 if ( $matches[1] == '!' ) { 114 $trigger_table = 4; 115 $open_part = '<caption>'; 116 } else { 117 if ( $trigger_table == 1 ) $open_part = '<tr>'; 118 else $open_part = ''; 119 120 if ( $matches[1] == '=' ) { 121 $trigger_table = 3; 122 $open_part .= '<th'; 123 if ( $matches[2] ) { 124 if ( $matches[2] == 'c' ) $open_part .= ' scope="col"'; 125 else if ( $matches[2] == 'r' ) $open_part .= ' scope="row"'; 126 } 105 127 } else { 106 $rs .= "<tr>"; 128 $trigger_table = 2; 129 $open_part .= '<td'; 107 130 } 108 } 109 else if ( $trigger_table == 1 ) { 110 if ($matches[1] == "!") { 111 $trigger_table = 4; 112 return "<caption>"; 113 } else { 114 $rs = "<tr>"; 115 } 116 } 117 else if ( $trigger_table == 2 ) $rs = "</td>"; 118 else if ( $trigger_table == 3 ) $rs = "</th>"; 119 else if ( $trigger_table == 4 ) { 120 $trigger_table = 1; 121 return "</caption>\n"; 122 } 131 132 if ( $matches[3] && $matches[3] > 1 ) $open_part .= ' colspan="'.$matches[3].'"'; 133 if ( $matches[4] && $matches[4] > 1 ) $open_part .= ' rowspan="'.$matches[4].'"'; 134 135 $open_part .= '>'; 136 } 137 138 return $close_part . $open_part; 123 139 124 if ( $trigger_table > 1 && $matches[4] == "\n") {125 $trigger_table = 1;126 return $rs."</tr>\n";127 }128 129 if ( $matches[1] == "=" ) {130 $trigger_table = 3;131 $rs .= "<th";132 } else if ( $matches[1] == "" ) {133 $trigger_table = 2;134 $rs .= "<td";135 }136 if ( $matches[2] && $matches[2] > 1 ) $rs .= " colspan=\"$matches[2]\"";137 if ( $matches[3] && $matches[3] > 1 ) $rs .= " rowspan=\"$matches[3]\"";138 139 return $rs.">";140 141 140 } else if ( $trigger_table == 1 ) { 142 141 //Are in table, no cell - but not asked to open new: please close and parse again. ;)