def code_block(self, code, language, indent=0):
        """Example::

            .. code-block:: python

                from __future__ import print_function
                import math

                print(math.sqrt(10.0))
        """
        if language not in [None, "console", "python", "ruby", "c"]:
            raise
        prefix = "\t" * indent
        code_prefix = "\t" * (indent + 1)
        lines = list()
        lines.append(prefix + ".. code-block:: %s" % language)
        lines.append(prefix)
        for line in code.split("\n"):
            lines.append(code_prefix + line.strip())
        return "\n".join(lines)
def code_block ( self , code , language , indent = 0 ) : if language not in [ None , "console" , "python" , "ruby" , "c" ] : raise prefix = "\t" * indent code_prefix = "\t" * ( indent + 1 ) lines = list ( ) lines . append ( prefix + ".. code-block:: %s" % language ) lines . append ( prefix ) for line in code . split ( "\n" ) : lines . append ( code_prefix + line . strip ( ) ) return "\n" . join ( lines )
Example::

            .. code-block:: python

                from __future__ import print_function
                import math

                print(math.sqrt(10.0))