| @@ -5,9 +5,9 @@ module Docs · 4 unmodified lines |
| 5 | 5 | if dt = at_css('dt') |
| 6 | 6 | name = dt_to_name(dt) |
| 7 | 7 | else |
| 8 | | − name = at_css('h1').content.strip |
| 8 | + name = at_xpath('//h1/text()').text.strip |
| 9 | 9 | end |
| 10 | | − name.remove! "\u{00B6}" |
| 10 | + name.remove! %r{#\Z} |
| 11 | 11 | name |
| 12 | 12 | end |
| 13 | 13 | |
| @@ -18,8 +18,12 @@ module Docs · 4 unmodified lines |
| 18 | 18 | elsif slug.start_with?('dev') |
| 19 | 19 | return 'Development' |
| 20 | 20 | end |
| 21 | | − li_a = css('nav li.active > a') |
| 22 | | − return li_a.last.content if li_a && li_a.last |
| 21 | + if css('nav li.toctree-l2.active .toctree-l3').length > 7 |
| 22 | + li_a = css('nav li.toctree-l2.active > a') |
| 23 | + else |
| 24 | + li_a = css('nav li.toctree-l1.active > a') |
| 25 | + end |
| 26 | + return li_a.last.xpath('./text()').text.remove('( )').strip if li_a && li_a.last |
| 23 | 27 | end |
| 24 | 28 | |
| 25 | 29 | nav_items = css('.nav.nav-pills.pull-left > li') |
| @@ -29,8 +33,8 @@ module Docs · 3 unmodified lines |
| 29 | 33 | elsif nav_items[4] && nav_items[4].content !~ /Manual|Reference/ |
| 30 | 34 | type = nav_items[4].content |
| 31 | 35 | else |
| 32 | | − type = at_css('h1').content.strip |
| 33 | | − type.remove! "\u{00B6}" |
| 36 | + type = at_xpath('//h1/text()').text.strip |
| 37 | + type.remove! %r{#\Z} |
| 34 | 38 | |
| 35 | 39 | # Handle some edge cases that aren't properly categorized in the docs |
| 36 | 40 | if type.start_with?('numpy.polynomial.') || type.start_with?('numpy.poly1d.') |
| @@ -90,7 +94,7 @@ module Docs · 53 unmodified lines |
| 90 | 94 | name.remove! %r{[\=\[].*} |
| 91 | 95 | name.remove! %r{\A(class(method)?|exception) } |
| 92 | 96 | name.remove! %r{\s—.*} |
| 93 | | − name.remove! '¶' |
| 97 | + name.remove! %r{#\Z} |
| 94 | 98 | end |
| 95 | 99 | end |
| 96 | 100 | end |