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
2727 end
2828
2929 def include_default_entry?
30− !%w(Attributes Element/Heading_Elements).include?(slug)
30+ !%w(Attributes Link_types Element/Heading_Elements).include?(slug)
3131 end
3232
3333 def additional_entries
@@ -39,6 +39,13 @@ module Docs · 5 unmodified lines
3939 id = node.parent['id'] = name.parameterize
4040 [name, id, 'Attributes']
4141 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
4249 else
4350 []
4451 end
lib/docs/scrapers/mdn/html.rb+3−1
@@ -3,7 +3,7 @@ module Docs · 2 unmodified lines
33 self.name = 'HTML'
44 self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/HTML'
55 self.root_path = '/Element'
6− self.initial_paths = %w(/Attributes)
6+ self.initial_paths = %w(/Attributes /Link_types)
77
88 html_filters.push 'html/clean_html', 'html/entries', 'title'
99
@@ -14,6 +14,8 @@ module Docs · 4 unmodified lines
1414 'Heading Elements'
1515 elsif filter.slug == 'Attributes'
1616 'Attributes'
17+ elsif filter.slug == 'Link_types'
18+ 'Link types'
1719 else
1820 "<#{filter.default_title}>"
1921 end