diff options
author | Mark <mc.prins@gmail.com> | 2014-01-08 11:56:06 +0100 |
---|---|---|
committer | Mark Prins <mprins@users.sf.net> | 2014-12-18 10:17:54 +0100 |
commit | 3940c519db432ec22e8c587504d86191631f9bfb (patch) | |
tree | 105ebc53a9596f76685233590f9a4d2e77b2bfcd /inc/template.php | |
parent | 6c3ad847534a1be651359d39a4d4d8456aff4441 (diff) | |
download | rpg-3940c519db432ec22e8c587504d86191631f9bfb.tar.gz rpg-3940c519db432ec22e8c587504d86191631f9bfb.tar.bz2 |
use nav+ul element for "you are here"
As described in the common idioms of the HTML5 spec, mark up navigation as a list inside a `nav` element for better semantics and accessibility.
see:
* http://www.w3.org/html/wg/drafts/html/master/common-idioms.html#rel-up
* http://lists.w3.org/Archives/Public/public-html/2013Nov/thread.html#msg6
* https://dl.dropboxusercontent.com/u/377471/breadcrumb.html
for discussion and background.
Diffstat (limited to 'inc/template.php')
-rw-r--r-- | inc/template.php | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/inc/template.php b/inc/template.php index 3bccb0bd8..1fad18271 100644 --- a/inc/template.php +++ b/inc/template.php @@ -893,12 +893,12 @@ function tpl_breadcrumbs($sep = '•') { * @author Nigel McNie <oracle.shinoda@gmail.com> * @author Sean Coates <sean@caedmon.net> * @author <fredrik@averpil.com> - * @todo May behave strangely in RTL languages + * @author Mark C. Prins <mprins@users.sf.net> * * @param string $sep Separator between entries * @return bool */ -function tpl_youarehere($sep = ' » ') { +function tpl_youarehere($sep = ' → ') { global $conf; global $ID; global $lang; @@ -909,12 +909,15 @@ function tpl_youarehere($sep = ' » ') { $parts = explode(':', $ID); $count = count($parts); - echo '<span class="bchead">'.$lang['youarehere'].' </span>'; - + echo '<nav><h2 class="bchead">'.$lang['youarehere'].': </h2>'; + echo '<ul class="navlist">'; // always print the startpage - echo '<span class="home">'; - tpl_pagelink(':'.$conf['start']); - echo '</span>'; + if ($count > 1) { + echo '<li class="home">'.html_wikilink(':'.$conf['start']).$sep.'</li>'; + } else { + echo '<li class="home">'.$conf['start'].'</li>'; + } + // print intermediate namespace links $part = ''; @@ -923,18 +926,28 @@ function tpl_youarehere($sep = ' » ') { $page = $part; if($page == $conf['start']) continue; // Skip startpage - // output - echo $sep; - tpl_pagelink($page); + echo '<li>'.html_wikilink($page); + if ($i < $count - 2) { + echo $sep.'</li>'; + } else { + echo '</li>'; + } } // print current page, skipping start page, skipping for namespace index resolve_pageid('', $page, $exists); - if(isset($page) && $page == $part.$parts[$i]) return true; + if(isset($page) && $page == $part.$parts[$i]) { + echo '</li></ul></nav>'; + return true; + } + $page = $part.$parts[$i]; - if($page == $conf['start']) return true; - echo $sep; - tpl_pagelink($page); + if($page == $conf['start']) { + echo '</li></ul></nav>'; + return true; + } + + echo $sep.'</li><li class="curid">'.noNSorNS($page).'</li></ul></nav>'; return true; } |