History

Index HTML link types

Thibaut committed 12 years ago

Commit d1920bc1 parent fd203212 files · +11 −2Browse files

Unified · Split

2 files
  1. lib/docs/filters/html/entries.rb +8 −1
  2. lib/docs/scrapers/mdn/html.rb +3 −1
lib/docs/filters/html/entries.rb+8−1
@@ -27,7 +27,7 @@ module Docs · 26 unmodified lines
27 end27 end
28 28
29 def include_default_entry?29 def include_default_entry?
30 !%w(Attributes Element/Heading_Elements).include?(slug)30 !%w(Attributes Link_types Element/Heading_Elements).include?(slug)
31 end31 end
32 32
33 def additional_entries33 def additional_entries
@@ -39,6 +39,13 @@ module Docs · 5 unmodified lines
39 id = node.parent['id'] = name.parameterize39 id = node.parent['id'] = name.parameterize
40 [name, id, 'Attributes']40 [name, id, 'Attributes']
41 end41 end
42 elsif slug == 'Link_types'
43 css('.standard-table td:first-child > code').map do |node|
44 name = node.content.strip
45 id = node.parent.parent['id'] = name.parameterize
46 name.prepend 'rel: '
47 [name, id, 'Attributes']
48 end
42 else49 else
43 []50 []
44 end51 end
lib/docs/scrapers/mdn/html.rb+3−1
@@ -3,7 +3,7 @@ module Docs · 2 unmodified lines
3 self.name = 'HTML'3 self.name = 'HTML'
4 self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/HTML'4 self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/HTML'
5 self.root_path = '/Element'5 self.root_path = '/Element'
6 self.initial_paths = %w(/Attributes)6 self.initial_paths = %w(/Attributes /Link_types)
7 7
8 html_filters.push 'html/clean_html', 'html/entries', 'title'8 html_filters.push 'html/clean_html', 'html/entries', 'title'
9 9
@@ -14,6 +14,8 @@ module Docs · 4 unmodified lines
14 'Heading Elements'14 'Heading Elements'
15 elsif filter.slug == 'Attributes'15 elsif filter.slug == 'Attributes'
16 'Attributes'16 'Attributes'
17 elsif filter.slug == 'Link_types'
18 'Link types'
17 else19 else
18 "<#{filter.default_title}>"20 "<#{filter.default_title}>"
19 end21 end