Fixes #137.
Showing the changes to lib/docs/filters/python (1 of 2 files). Show all
Unified · Split
| @@ -16,7 +16,10 @@ module Docs · 15 unmodified lines | ||
| 16 | 16 | def get_name |
| 17 | 17 | name = at_css('h1').content |
| 18 | 18 | name.remove! %r{\A[\d\.]+ } # remove list number |
| 19 | + name.remove! "\u{00B6}" # remove pilcrow sign | |
| 19 | 20 | name.remove! %r{ [\u{2013}\u{2014}].+\z} # remove text after em/en dash |
| 21 | + name.remove! 'Built-in' | |
| 22 | + name.strip! | |
| 20 | 23 | name |
| 21 | 24 | end |
| 22 | 25 | |
| @@ -42,11 +45,11 @@ module Docs · 19 unmodified lines | ||
| 42 | 45 | end |
| 43 | 46 | |
| 44 | 47 | def include_default_entry? |
| 45 | − name !~ /[A-Z]/ && !skip? # skip non-module names | |
| 48 | + !at_css('.body > .section:only-child > .toctree-wrapper:last-child') && !type.in?(%w(Language Superseded)) | |
| 46 | 49 | end |
| 47 | 50 | |
| 48 | 51 | def additional_entries |
| 49 | − return [] if root_page? || skip? || name == 'errno' | |
| 52 | + return [] if root_page? || !include_default_entry? || name == 'errno' | |
| 50 | 53 | clean_id_attributes |
| 51 | 54 | entries = [] |
| 52 | 55 | |
| @@ -67,10 +70,6 @@ module Docs · 14 unmodified lines | ||
| 67 | 70 | entries |
| 68 | 71 | end |
| 69 | 72 | |
| 70 | − def skip? | |
| 71 | − type == 'Language' | |
| 72 | − end | |
| 73 | − | |
| 74 | 73 | def clean_id_attributes |
| 75 | 74 | css('.section > .target[id]').each do |node| |
| 76 | 75 | if dt = node.at_css('+ dl > dt') |