I was able to realize the desired result by modifying some lines in
sphinx/highlighting.py:

    try:
        if self.dest == 'html':
            # Add '>>> ' and '... ' as appropriate if really want
interactive mode.
            source_copy = ''
            line_count = 0
            for line in source.splitlines():
                if line.startswith('>>> '):
                    if line_count == 0:
                        # Cell begins in interactive mode, and may
contain
                        # output statements that we do not want to
classify
                        # as code. Therefore, copy the source and exit
loop
                        source_copy = source
                        break
                else:
                    # Check to see if we are indented
                    line_len = len(line)
                    source_len = len(line.lstrip())
                    if line_len != source_len:
                        source_copy = source_copy + '... '
                    else:
                        source_copy = source_copy + '>>> '
                source_copy = source_copy + line + '\n'
                line_count += 1
            source = source_copy
            return highlight(source, lexer, self.fmter[bool(linenos)])
        else:
            hlsource = highlight(source, lexer,
self.fmter[bool(linenos)])
            return hlsource.translate(tex_hl_escape_map)
    except ErrorToken:
        # this is most probably not the selected language,
        # so let it pass unhighlighted
        return self.unhighlighted(source)


It would be great to be able to safely override this, but I do not see
how. I noticed SAGE also modifies their highlighting.py file, too....

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to