Hide keyboard shortcuts

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 * 

3 

4 

5def table( 

6 caption="", 

7 thead="", 

8 tbody="", 

9 striped=True, 

10 bordered=False, 

11 hover=True, 

12 condensed=False, 

13 span=False): 

14 """ 

15 *Generate a table - TBS style* 

16 

17 **Key Arguments** 

18 

19 - ``caption`` -- the table caption 

20 - ``thead`` -- the table head 

21 - ``tbody`` -- the table body 

22 - ``striped`` -- Adds zebra-striping to any odd table row 

23 - ``bordered`` -- Add borders and rounded corners to the table. 

24 - ``hover`` -- Enable a hover state on table rows within a `<tbody>` 

25 - ``condensed`` -- Makes tables more compact by cutting cell padding in half. 

26 

27 

28 **Return** 

29 

30 - ``table`` -- the table 

31 

32 """ 

33 if striped is True: 

34 striped = "table-striped" 

35 else: 

36 striped = "" 

37 

38 if caption is False: 

39 caption = "" 

40 

41 if bordered is True: 

42 bordered = "" 

43 else: 

44 bordered = "table-bordered" 

45 

46 if hover is True: 

47 hover = "table-hover" 

48 else: 

49 hover = "" 

50 

51 if span is False: 

52 span = "" 

53 else: 

54 span = "span%(span)s" % locals() 

55 

56 if condensed is True: 

57 condensed = "table-condensed" 

58 else: 

59 condensed = "" 

60 

61 table = """<table class="table %(striped)s %(bordered)s %(hover)s %(condensed)s %(span)s">%(thead)s%(tbody)s%(caption)s</table>""" % locals( 

62 ) 

63 return table