Index: trunk/phase3/includes/Linker.php |
— | — | @@ -270,15 +270,16 @@ |
271 | 271 | * it doesn't have to do a database query. It's also valid for interwiki titles and special |
272 | 272 | * pages. |
273 | 273 | * |
274 | | - * @param object Title of target page |
275 | | - * @param string Text to replace the title |
276 | | - * @param string Link target |
277 | | - * @param string Text after link |
278 | | - * @param string Text before link text |
279 | | - * @param string Extra attributes to the a-element |
| 274 | + * @param object $nt Title of target page |
| 275 | + * @param string $text Text to replace the title |
| 276 | + * @param string $query Link target |
| 277 | + * @param string $trail Text after link |
| 278 | + * @param string $prefix Text before link text |
| 279 | + * @param string $aprops Extra attributes to the a-element |
| 280 | + * @param string $style Style to apply - if empty, use getInternalLinkAttributesObj instead |
280 | 281 | * @return the a-element |
281 | 282 | */ |
282 | | - function makeKnownLinkObj( $nt, $text = '', $query = '', $trail = '', $prefix = '' , $aprops = '' ) { |
| 283 | + function makeKnownLinkObj( $nt, $text = '', $query = '', $trail = '', $prefix = '' , $aprops = '', $style = '' ) { |
283 | 284 | |
284 | 285 | $fname = 'Linker::makeKnownLinkObj'; |
285 | 286 | wfProfileIn( $fname ); |
— | — | @@ -289,7 +290,7 @@ |
290 | 291 | } |
291 | 292 | |
292 | 293 | $u = $nt->escapeLocalURL( $query ); |
293 | | - if ( '' != $nt->getFragment() ) { |
| 294 | + if ( $nt->getFragment() != '' ) { |
294 | 295 | if( $nt->getPrefixedDbkey() == '' ) { |
295 | 296 | $u = ''; |
296 | 297 | if ( '' == $text ) { |
— | — | @@ -303,10 +304,12 @@ |
304 | 305 | ); |
305 | 306 | $u .= '#' . str_replace(array_keys($replacearray),array_values($replacearray),$anchor); |
306 | 307 | } |
307 | | - if ( '' == $text ) { |
| 308 | + if ( $text == '' ) { |
308 | 309 | $text = htmlspecialchars( $nt->getPrefixedText() ); |
309 | 310 | } |
310 | | - $style = $this->getInternalLinkAttributesObj( $nt, $text ); |
| 311 | + if ( $style == '' ) { |
| 312 | + $style = $this->getInternalLinkAttributesObj( $nt, $text ); |
| 313 | + } |
311 | 314 | |
312 | 315 | if ( $aprops !== '' ) $aprops = ' ' . $aprops; |
313 | 316 | |
— | — | @@ -902,12 +905,17 @@ |
903 | 906 | |
904 | 907 | } |
905 | 908 | |
906 | | - /** @todo document */ |
907 | | - function editSectionLink( $nt, $section ) { |
| 909 | + /** |
| 910 | + * @param Title $title |
| 911 | + * @param integer $section |
| 912 | + * @param string $hint Link title, or default if omitted or empty |
| 913 | + */ |
| 914 | + function editSectionLink( $nt, $section, $hint='' ) { |
908 | 915 | global $wgContLang; |
909 | 916 | |
910 | 917 | $editurl = '§ion='.$section; |
911 | | - $url = $this->makeKnownLinkObj( $nt, wfMsg('editsection'), 'action=edit'.$editurl ); |
| 918 | + $hint = ( $hint=='' ) ? '' : ' title="' . wfMsgHtml( 'editsectionhint', htmlspecialchars( $hint ) ) . '"'; |
| 919 | + $url = $this->makeKnownLinkObj( $nt, wfMsg('editsection'), 'action=edit'.$editurl, '', '', '', $hint ); |
912 | 920 | |
913 | 921 | if( $wgContLang->isRTL() ) { |
914 | 922 | $farside = 'left'; |
Index: trunk/phase3/includes/Parser.php |
— | — | @@ -3020,6 +3020,8 @@ |
3021 | 3021 | # strip out HTML |
3022 | 3022 | $canonized_headline = preg_replace( '/<.*?' . '>/','',$canonized_headline ); |
3023 | 3023 | $tocline = trim( $canonized_headline ); |
| 3024 | + # Save headline for section edit hint before it's escaped |
| 3025 | + $headline_hint = trim( $canonized_headline ); |
3024 | 3026 | $canonized_headline = Sanitizer::escapeId( $tocline ); |
3025 | 3027 | $refers[$headlineCount] = $canonized_headline; |
3026 | 3028 | |
— | — | @@ -3048,7 +3050,7 @@ |
3049 | 3051 | if( $istemplate ) |
3050 | 3052 | $head[$headlineCount] .= $sk->editSectionLinkForOther($templatetitle, $templatesection); |
3051 | 3053 | else |
3052 | | - $head[$headlineCount] .= $sk->editSectionLink($this->mTitle, $sectionCount+1); |
| 3054 | + $head[$headlineCount] .= $sk->editSectionLink($this->mTitle, $sectionCount+1, $headline_hint); |
3053 | 3055 | } |
3054 | 3056 | |
3055 | 3057 | # give headline the correct <h#> tag |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -676,6 +676,7 @@ |
677 | 677 | * (bug 5141) Gracefully handle the new account link when createaccount off |
678 | 678 | * (bug 5150 and related) Fix missing ID attribute in HTML namespace selector |
679 | 679 | * (bug 5152) Proper HTML escaping on subpage breadcrumbs |
| 680 | +* (bug 4855) Section edit links now have the section name in the title attribute. |
680 | 681 | |
681 | 682 | |
682 | 683 | === Caveats === |
Index: trunk/phase3/languages/Messages.php |
— | — | @@ -239,6 +239,7 @@ |
240 | 240 | 'newmessageslink' => 'new messages', |
241 | 241 | 'newmessagesdifflink' => 'diff to penultimate revision', |
242 | 242 | 'editsection'=>'edit', |
| 243 | +'editsectionhint' => 'Edit section: $1', |
243 | 244 | 'toc' => 'Contents', |
244 | 245 | 'showtoc' => 'show', |
245 | 246 | 'hidetoc' => 'hide', |