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 builtins import range 

3from . import * 

4 

5 

6def p( 

7 content="", 

8 lead=False, 

9 textAlign=False, 

10 color=False, 

11 navBar=False, 

12 onPhone=True, 

13 onTablet=True, 

14 onDesktop=True, 

15 htmlId=False, 

16 htmlClass=False): 

17 """ 

18 *Get a Paragraph element* 

19 

20 **Key Arguments** 

21 

22 - ``content`` -- content of the paragraph 

23 - ``lead`` -- is this a lead paragraph? 

24 - ``textAlign`` -- how to align paragraph text [ left | center | right ] 

25 - ``color`` -- colored text for emphasis [ muted | warning | info | error | success ] 

26 - ``navBar`` -- is this `<p>` for a navbar? 

27 - ``onPhone`` -- does this container get displayed on a phone sized screen 

28 - ``onTablet`` -- does this container get displayed on a tablet sized screen 

29 - ``onDesktop`` -- does this container get displayed on a desktop sized screen 

30 

31 

32 **Return** 

33 

34 - ``p`` -- the html paragraph element 

35 

36 """ 

37 falseList = [lead, textAlign, ] 

38 for i in range(len(falseList)): 

39 if not falseList[i]: 

40 falseList[i] = "" 

41 [lead, textAlign, ] = falseList 

42 

43 if htmlId is not False: 

44 htmlId = """id="%(htmlId)s" """ % locals() 

45 else: 

46 htmlId = "" 

47 

48 if htmlClass is False: 

49 htmlClass = "" 

50 

51 if textAlign: 

52 textAlign = "text-%(textAlign)s" % locals() 

53 else: 

54 textAlign = "" 

55 

56 if lead is True: 

57 lead = "lead" 

58 

59 if color is False: 

60 color = "" 

61 elif color == "muted": 

62 color = "muted" 

63 else: 

64 color = """text-%(color)s""" % locals() 

65 

66 if navBar is True: 

67 navBar = "navbar-text" 

68 else: 

69 navBar = "" 

70 

71 if onPhone: 

72 onPhone = "" 

73 else: 

74 onPhone = "hidden-phone" 

75 if onTablet: 

76 onTablet = "" 

77 else: 

78 onTablet = "hidden-tablet" 

79 if onDesktop: 

80 onDesktop = "" 

81 else: 

82 onDesktop = "hidden-desktop" 

83 

84 p = """ 

85 <p class="%(lead)s %(onPhone)s %(onTablet)s %(onDesktop)s %(textAlign)s %(color)s %(navBar)s %(htmlClass)s" %(htmlId)s>%(content)s</p> 

86 """ % locals() 

87 

88 return p