| Index: trunk/phase3/includes/parser/DateFormatter.php |
| — | — | @@ -155,12 +155,22 @@ |
| 156 | 156 | $bits[$key{$p}] = $matches[$p+1]; |
| 157 | 157 | } |
| 158 | 158 | } |
| 159 | | - |
| | 159 | + |
| | 160 | + return $this->formatDate( $bits ); |
| | 161 | + } |
| | 162 | + |
| | 163 | + function formatDate( $bits ) { |
| 160 | 164 | $format = $this->targets[$this->mTarget]; |
| 161 | 165 | |
| 162 | 166 | # Construct new date |
| 163 | 167 | $text = ''; |
| 164 | 168 | $fail = false; |
| | 169 | + |
| | 170 | + // Pre-generate y/Y stuff because we need the year for the <span> title. |
| | 171 | + if ( !isset( $bits['y'] ) ) |
| | 172 | + $bits['y'] = $this->makeIsoYear( $bits['Y'] ); |
| | 173 | + if ( !isset( $bits['Y'] ) ) |
| | 174 | + $bits['Y'] = $this->makeNormalYear( $bits['y'] ); |
| 165 | 175 | |
| 166 | 176 | for ( $p=0; $p < strlen( $format ); $p++ ) { |
| 167 | 177 | $char = $format{$p}; |
| — | — | @@ -185,11 +195,7 @@ |
| 186 | 196 | } |
| 187 | 197 | break; |
| 188 | 198 | case 'y': # ISO year |
| 189 | | - if ( !isset( $bits['y'] ) ) { |
| 190 | | - $text .= $this->makeIsoYear( $bits['Y'] ); |
| 191 | | - } else { |
| 192 | | - $text .= $bits['y']; |
| 193 | | - } |
| | 199 | + $text .= $bits['y']; |
| 194 | 200 | break; |
| 195 | 201 | case 'j': # ordinary day of month |
| 196 | 202 | if ( !isset($bits['j']) ) { |
| — | — | @@ -212,11 +218,7 @@ |
| 213 | 219 | } |
| 214 | 220 | break; |
| 215 | 221 | case 'Y': # ordinary (optional BC) year |
| 216 | | - if ( !isset( $bits['Y'] ) ) { |
| 217 | | - $text .= $this->makeNormalYear( $bits['y'] ); |
| 218 | | - } else { |
| 219 | | - $text .= $bits['Y']; |
| 220 | | - } |
| | 222 | + $text .= $bits['Y']; |
| 221 | 223 | break; |
| 222 | 224 | default: |
| 223 | 225 | $text .= $char; |
| — | — | @@ -225,6 +227,13 @@ |
| 226 | 228 | if ( $fail ) { |
| 227 | 229 | $text = $matches[0]; |
| 228 | 230 | } |
| | 231 | + |
| | 232 | + $isoDate = $bits['y'].$bits['m'].$bits['d']; |
| | 233 | + |
| | 234 | + // Output is not strictly HTML (it's wikitext), but <span> is whitelisted. |
| | 235 | + $text = Xml::tags( 'span', |
| | 236 | + array( 'class' => 'mw-formatted-date', 'title' => $isoDate ), $text ); |
| | 237 | + |
| 229 | 238 | return $text; |
| 230 | 239 | } |
| 231 | 240 | |
| Index: trunk/phase3/RELEASE-NOTES |
| — | — | @@ -136,6 +136,8 @@ |
| 137 | 137 | name of the last user to edit the page |
| 138 | 138 | * LinkerMakeExternalLink now has an $attribs parameter for link attributes and |
| 139 | 139 | a $linkType parameter for the type of external link being made |
| | 140 | +* (bug 17785) Dynamic dates surrounded with a <span> tag, fixing sortable tables with |
| | 141 | + dynamic dates. |
| 140 | 142 | |
| 141 | 143 | === Bug fixes in 1.15 === |
| 142 | 144 | * (bug 16968) Special:Upload no longer throws useless warnings. |