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
14 '.anchor', '.toc-jump', '.source-code-links', '.user-notes',14 '.anchor', '.toc-jump', '.source-code-links', '.user-notes',
15 '.show-more', '.hide-more').remove15 '.show-more', '.hide-more').remove
16 16
17 br = /<br\s?\/?>/i
18
19 header = at_css('h1')17 header = at_css('h1')
20 header.content = header.content.strip18 header.content = header.content.strip
21 doc.prepend_child header19 doc.prepend_child header
22 20
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
23 # Add PHP code highlighting28 # Add PHP code highlighting
24 css('pre').each do |node|29 css('pre').each do |node|
25 node['data-language'] = 'php'30 node['data-language'] = 'php'
26 end31 end
27 32
28 css('.source-code-container').each do |node|33 css('.source-code-container').each do |node|
34 node.remove_class('source-code-container')
29 node.name = 'pre'35 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")
31 node.content = node.content.strip37 node.content = node.content.strip
32 node['data-language'] = 'php'38 node['data-language'] = 'php'
33 end39 end
34 40
41 css('section').remove_attribute('class')
42
35 doc43 doc
36 end44 end
37 end45 end
lib/docs/scrapers/wordpress.rb+1−1
@@ -2,7 +2,7 @@ module Docs · 1 unmodified line
2 class Wordpress < UrlScraper2 class Wordpress < UrlScraper
3 self.name = 'WordPress'3 self.name = 'WordPress'
4 self.type = 'wordpress'4 self.type = 'wordpress'
5 self.release = '5.9'5 self.release = '6.0'
6 self.base_url = 'https://developer.wordpress.org/reference/'6 self.base_url = 'https://developer.wordpress.org/reference/'
7 self.initial_paths = %w(7 self.initial_paths = %w(
8 functions/8 functions/