| @@ -15,8 +15,12 @@ module Docs · 14 unmodified lines |
| 15 | 15 | 'The !optional Flag' => '!optional' |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | | − def include_default_entry? |
| 19 | | − false |
| 18 | + def get_name |
| 19 | + 'Functions' |
| 20 | + end |
| 21 | + |
| 22 | + def get_type |
| 23 | + 'Functions' |
| 20 | 24 | end |
| 21 | 25 | |
| 22 | 26 | def additional_entries |
| @@ -27,9 +31,11 @@ module Docs · 4 unmodified lines |
| 27 | 31 | entries = [] |
| 28 | 32 | type = '' |
| 29 | 33 | |
| 30 | | − css('> [id]').each do |node| |
| 34 | + css('*').each do |node| |
| 31 | 35 | if node.name == 'h2' |
| 32 | 36 | type = node.content.strip |
| 37 | + type.remove! %r{\s#.*} |
| 38 | + node['id'] = type.parameterize |
| 33 | 39 | |
| 34 | 40 | if type == 'Function Directives' |
| 35 | 41 | entries << ['@function', node['id'], '@-Rules and Directives'] |
| @@ -42,23 +48,26 @@ module Docs · 6 unmodified lines |
| 42 | 48 | end |
| 43 | 49 | |
| 44 | 50 | next |
| 45 | | − end |
| 51 | + elsif node.name == 'h3' || node.name == 'h4' |
| 52 | + next unless TYPES.include?(type) |
| 46 | 53 | |
| 47 | | − next unless TYPES.include?(type) |
| 54 | + name = node.content.strip |
| 55 | + name.remove! %r{\A.+?: } |
| 56 | + name.remove! %r{\s#.*} |
| 48 | 57 | |
| 49 | | − name = node.content.strip |
| 50 | | − name.remove! %r{\A.+?: } |
| 58 | + node['id'] = name.parameterize |
| 51 | 59 | |
| 52 | | − next if SKIP_NAMES.include?(name) |
| 60 | + next if SKIP_NAMES.include?(name) |
| 53 | 61 | |
| 54 | | − name = REPLACE_NAMES[name] if REPLACE_NAMES[name] |
| 55 | | − name.gsub!(/ [A-Z]/) { |str| str.downcase! } |
| 62 | + name = REPLACE_NAMES[name] if REPLACE_NAMES[name] |
| 63 | + name.gsub!(/ [A-Z]/) { |str| str.downcase! } |
| 56 | 64 | |
| 57 | | − if type == '@-Rules and Directives' |
| 58 | | − next unless name =~ /\A@[\w\-]+\z/ || name == '!optional' |
| 59 | | − end |
| 65 | + if type == '@-Rules and Directives' |
| 66 | + next unless name =~ /\A@[\w\-]+\z/ || name == '!optional' |
| 67 | + end |
| 60 | 68 | |
| 61 | | − entries << [name, node['id'], type] |
| 69 | + entries << [name, node['id'], type] |
| 70 | + end |
| 62 | 71 | end |
| 63 | 72 | |
| 64 | 73 | entries |
| @@ -66,7 +75,7 @@ module Docs · 1 unmodified line |
| 66 | 75 | |
| 67 | 76 | def function_entries |
| 68 | 77 | css('.method_details > .signature').inject [] do |entries, node| |
| 69 | | − name = node.at_css('strong').content.strip |
| 78 | + name = node.content.strip.remove(%r{\(.*}) |
| 70 | 79 | |
| 71 | 80 | unless name == entries.last.try(:first) |
| 72 | 81 | entries << [name, node['id'], 'Functions'] |