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