diff --git a/lib/docs/filters/wordpress/clean_html.rb b/lib/docs/filters/wordpress/clean_html.rb index a7aeb472..fba2c4c3 100644 --- a/lib/docs/filters/wordpress/clean_html.rb +++ b/lib/docs/filters/wordpress/clean_html.rb @@ -8,15 +8,29 @@ module Docs end article = at_css('article[id^="post-"]') - @doc = at_css('article[id^="post-"]') unless article.nil? - - css('hr', '.screen-reader-text', '.table-of-contents', - '.anchor', '.toc-jump', '.source-code-links', '.user-notes', - '.show-more', '.hide-more').remove - - header = at_css('h1') - header.content = header.content.strip - doc.prepend_child header + @doc = article unless article.nil? + + css( + 'hr', + '.screen-reader-text', + '.table-of-contents', + '.anchor', + '.toc-jump', + '.source-code-links', + '.user-notes', + '.show-more', + '.hide-more', + '.wp-block-wporg-sidebar-container', + 'section[data-nosnippet="true"]', + # 'section:contains("before being able to contribute a note or feedback")', + ).remove + + if at_css('.entry-content') + header = at_css('h1') + header.remove_attribute('style') + @doc = at_css('.entry-content') + doc.prepend_child header + end # Remove permalink css('h2 > a, h3 > a').each do |node| diff --git a/lib/docs/filters/wordpress/entries.rb b/lib/docs/filters/wordpress/entries.rb index ba539d67..8acca62a 100644 --- a/lib/docs/filters/wordpress/entries.rb +++ b/lib/docs/filters/wordpress/entries.rb @@ -2,11 +2,13 @@ module Docs class Wordpress class EntriesFilter < Docs::EntriesFilter def get_name - at_css('.breadcrumbs .trail-end').content + at_css('h1').content end def get_type - if subpath.starts_with?('classes') + if subpath.starts_with?('classes') and subpath.count('/') == 3 + 'Methods' + elsif subpath.starts_with?('classes') 'Classes' elsif subpath.starts_with?('hooks') 'Hooks' diff --git a/lib/docs/scrapers/wordpress.rb b/lib/docs/scrapers/wordpress.rb index b15a4fd0..beb23cee 100644 --- a/lib/docs/scrapers/wordpress.rb +++ b/lib/docs/scrapers/wordpress.rb @@ -2,7 +2,7 @@ module Docs class Wordpress < UrlScraper self.name = 'WordPress' self.type = 'wordpress' - self.release = '6.1' + self.release = '6.7' self.base_url = 'https://developer.wordpress.org/reference/' self.initial_paths = %w( functions/ @@ -17,7 +17,7 @@ module Docs html_filters.push 'wordpress/entries', 'wordpress/clean_html' - options[:container] = '#content-area' + options[:container] = 'main' options[:trailing_slash] = false options[:only_patterns] = [ /\Afunctions\//, @@ -32,7 +32,7 @@ module Docs ] options[:attribution] = <<-HTML - © 2003–2022 WordPress Foundation
+ © 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License. HTML