Use HTML5 rel attributes for some links
authorAryeh Gregor <simetrical@users.mediawiki.org>
Thu, 22 Jan 2009 00:11:23 +0000 (00:11 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Thu, 22 Jan 2009 00:11:23 +0000 (00:11 +0000)
http://dev.w3.org/html5/spec/#linkTypes

Probably doesn't do much, but looks cool.  :)

RELEASE-NOTES
includes/Pager.php
includes/Skin.php
includes/SkinTemplate.php

index f64b708..0f01061 100644 (file)
@@ -51,6 +51,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 11644) Add $wgMaxRedirects variable to control how many redirects are recursed
   through until the "destination" page is reached.
 * Add $wgInvalidRedirectTargets variable to prevent redirects to certain special pages.
+* Use HTML5 rel attributes for some links, where appropriate
   
 === Bug fixes in 1.15 ===
 * (bug 16968) Special:Upload no longer throws useless warnings.
index 8ec32ff..22cac27 100644 (file)
@@ -304,20 +304,18 @@ abstract class IndexPager implements Pager {
                if ( $query === null ) {
                        return $text;
                }
-               if( $type == 'prev' || $type == 'next' ) {
-                       $attrs = "rel=\"$type\"";
-               } elseif( $type == 'first' ) {
-                       $attrs = "rel=\"start\"";
-               } else {
-                       # HTML 4 has no rel="end" . . .
-                       $attrs = '';
+
+               $attrs = array();
+               if( in_array( $type, array( 'first', 'prev', 'next', 'last' ) ) ) {
+                       # HTML5 rel attributes
+                       $attrs['rel'] = $type;
                }
 
                if( $type ) {
-                       $attrs .= " class=\"mw-{$type}link\"" ;
+                       $attrs['class'] = "mw-{$type}link";
                }
-               return $this->getSkin()->makeKnownLinkObj( $this->getTitle(), $text,
-                       wfArrayToCGI( $query, $this->getDefaultQuery() ), '', '', $attrs );
+               return $this->getSkin()->link( $this->getTitle(), $text,
+                       $attrs, $query + $this->getDefaultQuery(), 'known' );
        }
 
        /**
index 3edcd92..9d7584b 100644 (file)
@@ -1566,8 +1566,8 @@ END;
        function historyLink() {
                global $wgTitle;
 
-               return $this->makeKnownLinkObj( $wgTitle,
-                 wfMsg( 'history' ), 'action=history' );
+               return $this->link( $wgTitle, wfMsg( 'history' ),
+                       array( 'rel' => 'archives' ), array( 'action' => 'history' ) );
        }
 
        function whatLinksHere() {
index b774392..1785fa0 100644 (file)
@@ -710,7 +710,8 @@ class SkinTemplate extends Skin {
                                $content_actions['history'] = array(
                                        'class' => ($action == 'history') ? 'selected' : false,
                                        'text' => wfMsg('history_short'),
-                                       'href' => $this->mTitle->getLocalUrl( 'action=history')
+                                       'href' => $this->mTitle->getLocalUrl( 'action=history' ),
+                                       'rel' => 'archives',
                                );
 
                                if( $wgUser->isAllowed('delete') ) {