Coverage for khufu/navigation/nav_list.py : 79%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1# encoding: utf-8
2from . import *
4def nav_list(
5 itemList=[],
6 pull=False,
7 onPhone=True,
8 onTablet=True,
9 onDesktop=True,
10):
11 """ *Create an html list of navigation items from the required python list*
13 **Key Arguments**
15 - ``itemList`` -- items to be included in the navigation list
16 - ``pull`` -- float the nav-list [ False | 'right' | 'left' ]
17 - ``onPhone`` -- does this container get displayed on a phone sized screen
18 - ``onTablet`` -- does this container get displayed on a tablet sized screen
19 - ``onDesktop`` -- does this container get displayed on a desktop sized screen
22 **Return**
24 - navList """
27 if pull:
28 pull = """pull-%(pull)s""" % locals()
29 else:
30 pull = ''
31 if onPhone:
32 onPhone = ''
33 else:
34 onPhone = 'hidden-phone'
35 if onTablet:
36 onTablet = ''
37 else:
38 onTablet = 'hidden-tablet'
39 if onDesktop:
40 onDesktop = ''
41 else:
42 onDesktop = 'hidden-desktop'
44 navList = """<ul class="nav %(pull)s %(onPhone)s %(onTablet)s %(onDesktop)s">""" % locals(
45 )
47 for item in itemList:
48 navList = """%(navList)s
49 <li>
50 %(item)s
51 </li>""" % locals()
52 navList = """%(navList)s</ul>""" % locals()
53 return navList