Coverage for khufu/code/code.py : 89%

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 code(
5 content="",
6 inline=True,
7 scroll=False):
8 """
9 *Generate a code section*
11 **Key Arguments**
13 - ``content`` -- the content of the code block
14 - ``inline`` -- inline or block?
15 - ``scroll`` -- give the block a scroll bar on y-axis?
18 **Return**
20 - ``code`` -- the code section
22 """
23 if scroll:
24 scroll = "pre-scrollable"
25 else:
26 scroll = ""
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()
34 return code