sampledoc: mark out prompts in ipython sessions?

Howdy,

this fixes the ipython console sphinx extension to mark up output
prompts as well. Mind if I put it in?

Thanks,

f

maqroll[sphinxext]> diff -u ipython_console_highlighting.py
~/research/papers/nitime/sphinxext/ipython_console_highlighting.py
--- ipython_console_highlighting.py 2009-08-26 00:03:06.000000000 -0700
+++ /home/fperez/research/papers/nitime/sphinxext/ipython_console_highlighting.py 2009-09-11
18:03:19.000000000 -0700
@@ -77,8 +77,11 @@
                                    [(0, Generic.Prompt,
continue_prompt.group())]))
                 curcode += line[continue_prompt.end():]
             elif output_prompt is not None:
+ # Use the 'error' token for output. We should probably make
+ # our own token, but error is typicaly in a bright color like
+ # red, so it works fine for our Output prompts.
                 insertions.append((len(curcode),
- [(0, Generic.Output,
output_prompt.group())]))
+ [(0, Generic.Error,
output_prompt.group())]))
                 curcode += line[output_prompt.end():]
             else:
                 if curcode:

Looks fine to me. We were offering to commit this to matplotlib, or should I?

Mike

Fernando Perez wrote:

···

Howdy,

this fixes the ipython console sphinx extension to mark up output
prompts as well. Mind if I put it in?

Thanks,

f

maqroll[sphinxext]> diff -u ipython_console_highlighting.py
~/research/papers/nitime/sphinxext/ipython_console_highlighting.py
--- ipython_console_highlighting.py 2009-08-26 00:03:06.000000000 -0700
+++ /home/fperez/research/papers/nitime/sphinxext/ipython_console_highlighting.py 2009-09-11
18:03:19.000000000 -0700
@@ -77,8 +77,11 @@
                                    [(0, Generic.Prompt,
continue_prompt.group())]))
                 curcode += line[continue_prompt.end():]
             elif output_prompt is not None:
+ # Use the 'error' token for output. We should probably make
+ # our own token, but error is typicaly in a bright color like
+ # red, so it works fine for our Output prompts.
                 insertions.append((len(curcode),
- [(0, Generic.Output,
output_prompt.group())]))
+ [(0, Generic.Error,
output_prompt.group())]))
                 curcode += line[output_prompt.end():]
             else:
                 if curcode:

------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
  
--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

You should let Fernando, so he can survive the annual purge of
developers no longer committing :slight_smile:

···

On Thu, Sep 17, 2009 at 9:30 AM, Michael Droettboom <mdroe@...31...> wrote:

Looks fine to me. We were offering to commit this to matplotlib, or
should I?

2009/9/17 John Hunter <jdh2358@...149...>:

···

On Thu, Sep 17, 2009 at 9:30 AM, Michael Droettboom <mdroe@...31...> wrote:

Looks fine to me. We were offering to commit this to matplotlib, or
should I?

You should let Fernando, so he can survive the annual purge of
developers no longer committing :slight_smile:

Thanks :slight_smile: I'll take care of it later then, I'll try to fix a warning
we're seeing as well because it lacks a setup.py.

Cheers,

f

Done. I also committed the update to sampledoc, with a note in the
log to eventually remove it once it's 'enough' in the wild in mpl.

Cheers,

f

···

On Thu, Sep 17, 2009 at 11:02 AM, Fernando Perez <fperez.net@...149...> wrote:

Thanks :slight_smile: I'll take care of it later then, I'll try to fix a warning
we're seeing as well because it lacks a setup.py.