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 

4def code( 

5 content="", 

6 inline=True, 

7 scroll=False): 

8 """ 

9 *Generate a code section* 

10 

11 **Key Arguments** 

12 

13 - ``content`` -- the content of the code block 

14 - ``inline`` -- inline or block? 

15 - ``scroll`` -- give the block a scroll bar on y-axis? 

16  

17 

18 **Return** 

19 

20 - ``code`` -- the code section 

21  

22 """ 

23 if scroll: 

24 scroll = "pre-scrollable" 

25 else: 

26 scroll = "" 

27 

28 if inline: 

29 code = """<code>%(content)s</code>""" % locals() 

30 else: 

31 code = """ 

32 <pre class="%(scroll)s"><code>%(content)s</code></pre>""" % locals() 

33 

34 return code