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
17 17
18 if slug.start_with?('Global_attr')18 if slug.start_with?('Global_attr')
19 'Attributes'19 '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/'))
21 'Obsolete'21 'Obsolete'
22 elsif slug.start_with?('Element/')22 elsif slug.start_with?('Element/')
23 'Elements'23 'Elements'
lib/docs/filters/mdn/clean_html.rb+3−2
@@ -39,10 +39,11 @@ module Docs · 38 unmodified lines
39 39
40 css('h2 > a[name]', 'h3 > a[name]').each do |node|40 css('h2 > a[name]', 'h3 > a[name]').each do |node|
41 node.parent['id'] = node['name']41 node.parent['id'] = node['name']
42 node.before(node.content).remove42 node.before(node.children).remove
43 end43 end
44 css('h2 > a, h3 > a').each do |node|44 css('h2 > a, h3 > a').each do |node|
45 node.before(node.content).remove45 # 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
46 end47 end
47 48
48 css('.notecard > h4').each do |node|49 css('.notecard > h4').each do |node|
lib/docs/scrapers/mdn/html.rb+4−11
@@ -5,20 +5,10 @@ module Docs · 4 unmodified lines
5 self.name = 'HTML'5 self.name = 'HTML'
6 self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/HTML'6 self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/HTML'
7 7
8 html_filters.push 'html/clean_html', 'html/entries', 'title'8 html_filters.push 'html/clean_html', 'html/entries'
9 9
10 options[:root_title] = 'HTML'10 options[:root_title] = 'HTML'
11 11
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
22 options[:skip] = %w(12 options[:skip] = %w(
23 /index13 /index
24 /Element/shadow14 /Element/shadow
@@ -38,5 +28,8 @@ module Docs · 13 unmodified lines
38 url.sub! 'https://developer.mozilla.org/en-US/docs/HTML/', "#{Html.base_url}/" unless url.include?('Content_categories')28 url.sub! 'https://developer.mozilla.org/en-US/docs/HTML/', "#{Html.base_url}/" unless url.include?('Content_categories')
39 url29 url
40 end30 end
31
32 # self.release = '2021-04-29'
33
41 end34 end
42end35end