def _prompt_session(ver, in1, in2=None): if in2: prefix, input = in1, in2 else: prefix, input = None, in1 output = cagedprompt.prompt_session(input, prefix) cog.outl("<div class='version-marker'>%s</div>" % ver) pre_lines(output.strip().split("\n"), "language-python language-python-%d" % ver)
def prompt_session(input, command=False, prelude="", klass=None): output = "" if command: output += "$ python\n" output += cagedprompt.prompt_session(input, banner=command, prelude=prelude) lang = "python pycon" if klass is not None: lang += " " + klass include_code(output, lang=lang, number=False)
def prompt_session(input, command=False, prelude=""): output = "" if command: output += "$ python\n" repl_out = cagedprompt.prompt_session(input, banner=command, prelude=prelude) # REPL sessions have lone triple-dot lines. Suppress them. repl_out = "\n".join('' if l == '... ' else l for l in repl_out.splitlines()) output += repl_out include_code(output, lang="python", number=False, classes="console")
def prompt_session(input, command=False, prelude=""): output = "" if command: output += "$ python\n" output += cagedprompt.prompt_session(input, banner=command, prelude=prelude) include_code(output, lang="pycon", number=False, show_text=True)