History

Update WordPress documentation (6.0)

Simon Legner committed 4 years ago

Commit 1f1e1441 parent 232896c2 files · +12 −4Browse files

Unified · Split

2 files
  1. lib/docs/filters/wordpress/clean_html.rb +11 −3
  2. lib/docs/scrapers/wordpress.rb +1 −1
lib/docs/filters/wordpress/clean_html.rb+11−3
@@ -14,24 +14,32 @@ module Docs · 13 unmodified lines
1414 '.anchor', '.toc-jump', '.source-code-links', '.user-notes',
1515 '.show-more', '.hide-more').remove
1616
17− br = /<br\s?\/?>/i
18−
1917 header = at_css('h1')
2018 header.content = header.content.strip
2119 doc.prepend_child header
2220
21+ # Remove permalink
22+ css('h2 > a, h3 > a').each do |node|
23+ node.parent.remove_attribute('class')
24+ node.parent.remove_attribute('tabindex')
25+ node.parent.content = node.content
26+ end
27+
2328 # Add PHP code highlighting
2429 css('pre').each do |node|
2530 node['data-language'] = 'php'
2631 end
2732
2833 css('.source-code-container').each do |node|
34+ node.remove_class('source-code-container')
2935 node.name = 'pre'
30− node.inner_html = node.inner_html.gsub(br, "\n")
36+ node.inner_html = node.inner_html.gsub(/<br\s?\/?>/i, "\n")
3137 node.content = node.content.strip
3238 node['data-language'] = 'php'
3339 end
3440
41+ css('section').remove_attribute('class')
42+
3543 doc
3644 end
3745 end
lib/docs/scrapers/wordpress.rb+1−1
@@ -2,7 +2,7 @@ module Docs · 1 unmodified line
22 class Wordpress < UrlScraper
33 self.name = 'WordPress'
44 self.type = 'wordpress'
5− self.release = '5.9'
5+ self.release = '6.0'
66 self.base_url = 'https://developer.wordpress.org/reference/'
77 self.initial_paths = %w(
88 functions/