"View code" links

18 views
Skip to first unread message

Nathaniel Smith

unread,
Jul 6, 2012, 7:08:25 AM7/6/12
to pystat...@googlegroups.com
FYI I fixed some bugs in your "View code" docs javascript when I stole
it: https://github.com/charlton/charlton/blob/master/doc/_static/show-code.js

For an example of the problem, see the third "View code" link here:
http://statsmodels.sourceforge.net/formula/examples/generated/example_interactions.html

-n

josef...@gmail.com

unread,
Jul 6, 2012, 7:16:05 AM7/6/12
to pystat...@googlegroups.com
Thanks,

Is this ours (Skippers')? or sphinx or ipython directive ?

Josef


>
> -n

Nathaniel Smith

unread,
Jul 6, 2012, 7:32:00 AM7/6/12
to pystat...@googlegroups.com
Dunno but I think Skipper probably wrote it:
https://github.com/statsmodels/statsmodels/pull/169

It's kind of a hack, it would be much better to do from the ipython
directive directly, but eh, it does pretty much work.

-N

Skipper Seabold

unread,
Jul 6, 2012, 7:55:21 AM7/6/12
to pystat...@googlegroups.com
It is a hack but I can only spend so much time with the ipython directive at one time. It wouldn't be that difficult to pull out the code, but IIRC it gets processed too late in the sphinx build process to generate linkable documents. At least that was my understanding at the time. I think. Feel free to give it a try though.

Skipper

Skipper Seabold

unread,
Jul 6, 2012, 12:36:04 PM7/6/12
to pystat...@googlegroups.com
On Fri, Jul 6, 2012 at 7:08 AM, Nathaniel Smith <n...@pobox.com> wrote:

On a machine I can look at this now. Thanks for catching this. Is the regex in cleanQuotes all that you changed?

Skipper

Nathaniel Smith

unread,
Jul 6, 2012, 12:49:06 PM7/6/12
to pystat...@googlegroups.com
The main fix is to the ...: regex in scrapeText, though the changes to
the regex cleanQuotes should be useful so it won't be backslashing
pipes and collapsing the distinction between " and ' (which can break
code).

-n

Skipper Seabold

unread,
Jul 6, 2012, 12:58:03 PM7/6/12
to pystat...@googlegroups.com

I see this now. Makes sense. Thanks.

FYI, if you are using the ipython_directive, I recommend using ours instead of IPython's for now. I haven't pushed a few recent fixes upstream yet.

Skipper

Skipper Seabold

unread,
Jul 6, 2012, 1:01:19 PM7/6/12
to pystat...@googlegroups.com

PS. If you find yourself with an itch to scratch, this code could probably stand another set of eyes. I mainly only fixed what was there when it got broken by an IPython release.

I think the plotting in particular could be improved. I've been working with it a bit lately, and I'm not that happy with it. It works but seems fragile, and you have to do all the plotting interactively. I've never much looked at this part of it though.

Skipper

 

Nathaniel Smith

unread,
Jul 8, 2012, 2:09:55 PM7/8/12
to pystat...@googlegroups.com
Actually the version you just looked at had completely broken
cleanQuotes stuff. I've just pushed a fix
https://github.com/charlton/charlton/blob/master/doc/_static/show-code.js
that redoes it totally, and it now seems to be successfully handling
code "with 'nested' quotes".

-n
Reply all
Reply to author
Forward
0 new messages