matthew-brett / bibstuff

Fork of http://code.google.com/p/bibstuff/ with edits and sphinx extension
Other
19 stars 2 forks source link

:groupby: for sphinx bib directives + improvement of __doc__ #7

Open yarikoptic opened 11 years ago

yarikoptic commented 11 years ago

This one does need some code polish and making it less ad-hoc but not sure if I would have time... seems to work though. It has potential to break things -- so would be nice if you could try/review.

But otherwise -- it should be very handy to automatically provide reasonably structured bibliographies. See e.g.

http://haxbylab.dartmouth.edu/publications.html

which was generated from a single bibmatching entry with groupby

yarikoptic commented 11 years ago

Hi @matthew-brett -- so what do you think about this PR?

matthew-brett commented 11 years ago

Oops - sorry - am more or less offline in Cuba. Can you get someone else to review? I will make sure you can merge...

yarikoptic commented 11 years ago

ok -- if there is any live expert in bibstuff ;)

when are you coming back to the hyber-land

On Tue, 16 Jul 2013, Matthew Brett wrote:

Oops - sorry - am more or less offline in Cuba. Can you get someone else

to review? I will make sure you can merge...

Yaroslav O. Halchenko, Ph.D. http://neuro.debian.net http://www.pymvpa.org http://www.fail2ban.org Senior Research Associate, Psychological and Brain Sciences Dept. Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755 Phone: +1 (603) 646-9834 Fax: +1 (603) 646-1419 WWW: http://www.linkedin.com/in/yarik

matthew-brett commented 11 years ago

Back on the 24th I hope...

matthew-brett commented 11 years ago

Sorry - reviewing offline and pasting into the web form - forgive the clunkiness.

On a meta level - should we be abandoning this code and moving it to the sphinx-natbib extension instead?

bibref.py around line 98: I don't think you can get level symbols from the Sphinx or doctest API.

This is the definition of the section levels that Python uses, where the first value in the tuple is the character and the second value is whether the section heading has an overline as well as an underline::

STATE_SEQ = (
    ('#', True),
    ('*', True),
    ('=', False),
    ('-', False),
    ('^', False),
    ('"', False),
    ('#', True))

So: the second-from-top level heading uses "=" with no overline.

Around line 307 (_group_entries): so - everything has to be sorted alphabetically? So, 'Talk' must always come before 'Poster'?

Found this code hard to read - any chance of unpacking it into loops rather than list comprehensions?

Around line 351 'groupped' mis-spelled.

A little confused by the check if 'plural' is a number; how would that happen?

In format_citations - raise error for non-list immediately rather than at the end?

Can you think of any tests? I see that I didn't do a good job of that.

matthew-brett commented 11 years ago

Yarik - any comments on my review?

yarikoptic commented 11 years ago

Hi @matthew-brett sorry for not replying -- your review was so good and thorough that I have decided that I would need to allocate some quality time for bibstuff to react to it properly... and never got it yet :-/ worse to it -- it was working for our needs splendidly so I did not have additional motivator yet... may be some time later this week. sorry about the delay... or if you have a moment I would only appreciate if you give you TLC to this PR by addressing your concerns and recommendations.