History

Update HTML documentation

Simon Legner committed 5 years ago

Commit effe87e1 parent b581eb23 files · +8 −14Browse files

Unified · Split

3 files
  1. lib/docs/filters/html/entries.rb +1 −1
  2. lib/docs/filters/mdn/clean_html.rb +3 −2
  3. lib/docs/scrapers/mdn/html.rb +4 −11
lib/docs/filters/html/entries.rb+1−1
@@ -17,7 +17,7 @@ module Docs · 16 unmodified lines
1717
1818 if slug.start_with?('Global_attr')
1919 'Attributes'
20− elsif at_css('.obsoleteHeader', '.deprecatedHeader', '.nonStandardHeader') || OBSOLETE.include?(slug.remove('Element/'))
20+ elsif at_css('#deprecated', '#non-standard', '#obsolete') || OBSOLETE.include?(slug.remove('Element/'))
2121 'Obsolete'
2222 elsif slug.start_with?('Element/')
2323 'Elements'
lib/docs/filters/mdn/clean_html.rb+3−2
@@ -39,10 +39,11 @@ module Docs · 38 unmodified lines
3939
4040 css('h2 > a[name]', 'h3 > a[name]').each do |node|
4141 node.parent['id'] = node['name']
42− node.before(node.content).remove
42+ node.before(node.children).remove
4343 end
4444 css('h2 > a, h3 > a').each do |node|
45− node.before(node.content).remove
45+ # children instead of content for "Using the download attribute to save a <canvas> as a PNG" from https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a
46+ node.before(node.children).remove
4647 end
4748
4849 css('.notecard > h4').each do |node|
lib/docs/scrapers/mdn/html.rb+4−11
@@ -5,20 +5,10 @@ module Docs · 4 unmodified lines
55 self.name = 'HTML'
66 self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/HTML'
77
8− html_filters.push 'html/clean_html', 'html/entries', 'title'
8+ html_filters.push 'html/clean_html', 'html/entries'
99
1010 options[:root_title] = 'HTML'
1111
12− options[:title] = ->(filter) do
13− if filter.slug == 'Element/Heading_Elements'
14− 'Heading Elements'
15− elsif filter.slug.start_with?('Element/')
16− "<#{filter.default_title}>"
17− else
18− filter.default_title
19− end
20− end
21−
2212 options[:skip] = %w(
2313 /index
2414 /Element/shadow
@@ -38,5 +28,8 @@ module Docs · 13 unmodified lines
3828 url.sub! 'https://developer.mozilla.org/en-US/docs/HTML/', "#{Html.base_url}/" unless url.include?('Content_categories')
3929 url
4030 end
31+
32+ # self.release = '2021-04-29'
33+
4134 end
4235 end