Update WordPress documentation (6.0)

This commit is contained in:
Simon Legner 2022-05-25 21:17:18 +02:00
parent 232896c010
commit 1f1e144693
2 changed files with 12 additions and 4 deletions

View file

@ -14,24 +14,32 @@ module Docs
'.anchor', '.toc-jump', '.source-code-links', '.user-notes',
'.show-more', '.hide-more').remove
br = /<br\s?\/?>/i
header = at_css('h1')
header.content = header.content.strip
doc.prepend_child header
# Remove permalink
css('h2 > a, h3 > a').each do |node|
node.parent.remove_attribute('class')
node.parent.remove_attribute('tabindex')
node.parent.content = node.content
end
# Add PHP code highlighting
css('pre').each do |node|
node['data-language'] = 'php'
end
css('.source-code-container').each do |node|
node.remove_class('source-code-container')
node.name = 'pre'
node.inner_html = node.inner_html.gsub(br, "\n")
node.inner_html = node.inner_html.gsub(/<br\s?\/?>/i, "\n")
node.content = node.content.strip
node['data-language'] = 'php'
end
css('section').remove_attribute('class')
doc
end
end

View file

@ -2,7 +2,7 @@ module Docs
class Wordpress < UrlScraper
self.name = 'WordPress'
self.type = 'wordpress'
self.release = '5.9'
self.release = '6.0'
self.base_url = 'https://developer.wordpress.org/reference/'
self.initial_paths = %w(
functions/