Unified · Split
| @@ -8,15 +8,29 @@ module Docs · 7 unmodified lines | |||
| 8 | end | 8 | end |
| 9 | 9 | ||
| 10 | article = at_css('article[id^="post-"]') | 10 | article = at_css('article[id^="post-"]') |
| 11 | @doc = at_css('article[id^="post-"]') unless article.nil? | 11 | @doc = article unless article.nil? |
| 12 | 12 | ||
| 13 | css('hr', '.screen-reader-text', '.table-of-contents', | 13 | css( |
| 14 | '.anchor', '.toc-jump', '.source-code-links', '.user-notes', | 14 | 'hr', |
| 15 | '.show-more', '.hide-more').remove | 15 | '.screen-reader-text', |
| 16 | 16 | '.table-of-contents', | |
| 17 | header = at_css('h1') | 17 | '.anchor', |
| 18 | header.content = header.content.strip | 18 | '.toc-jump', |
| 19 | doc.prepend_child header | 19 | '.source-code-links', |
| 20 | '.user-notes', | ||
| 21 | '.show-more', | ||
| 22 | '.hide-more', | ||
| 23 | '.wp-block-wporg-sidebar-container', | ||
| 24 | 'section[data-nosnippet="true"]', | ||
| 25 | # 'section:contains("before being able to contribute a note or feedback")', | ||
| 26 | ).remove | ||
| 27 | |||
| 28 | if at_css('.entry-content') | ||
| 29 | header = at_css('h1') | ||
| 30 | header.remove_attribute('style') | ||
| 31 | @doc = at_css('.entry-content') | ||
| 32 | doc.prepend_child header | ||
| 33 | end | ||
| 20 | 34 | ||
| 21 | # Remove permalink | 35 | # Remove permalink |
| 22 | css('h2 > a, h3 > a').each do |node| | 36 | css('h2 > a, h3 > a').each do |node| |
| @@ -2,11 +2,13 @@ module Docs · 1 unmodified line | |||
| 2 | class Wordpress | 2 | class Wordpress |
| 3 | class EntriesFilter < Docs::EntriesFilter | 3 | class EntriesFilter < Docs::EntriesFilter |
| 4 | def get_name | 4 | def get_name |
| 5 | at_css('.breadcrumbs .trail-end').content | 5 | at_css('h1').content |
| 6 | end | 6 | end |
| 7 | 7 | ||
| 8 | def get_type | 8 | def get_type |
| 9 | if subpath.starts_with?('classes') | 9 | if subpath.starts_with?('classes') and subpath.count('/') == 3 |
| 10 | 'Methods' | ||
| 11 | elsif subpath.starts_with?('classes') | ||
| 10 | 'Classes' | 12 | 'Classes' |
| 11 | elsif subpath.starts_with?('hooks') | 13 | elsif subpath.starts_with?('hooks') |
| 12 | 'Hooks' | 14 | 'Hooks' |
| @@ -2,7 +2,7 @@ module Docs · 1 unmodified line | |||
| 2 | class Wordpress < UrlScraper | 2 | class Wordpress < UrlScraper |
| 3 | self.name = 'WordPress' | 3 | self.name = 'WordPress' |
| 4 | self.type = 'wordpress' | 4 | self.type = 'wordpress' |
| 5 | self.release = '6.1' | 5 | self.release = '6.7' |
| 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/ |
| @@ -17,7 +17,7 @@ module Docs · 8 unmodified lines | |||
| 17 | 17 | ||
| 18 | html_filters.push 'wordpress/entries', 'wordpress/clean_html' | 18 | html_filters.push 'wordpress/entries', 'wordpress/clean_html' |
| 19 | 19 | ||
| 20 | options[:container] = '#content-area' | 20 | options[:container] = 'main' |
| 21 | options[:trailing_slash] = false | 21 | options[:trailing_slash] = false |
| 22 | options[:only_patterns] = [ | 22 | options[:only_patterns] = [ |
| 23 | /\Afunctions\//, | 23 | /\Afunctions\//, |
| @@ -32,7 +32,7 @@ module Docs · 8 unmodified lines | |||
| 32 | ] | 32 | ] |
| 33 | 33 | ||
| 34 | options[:attribution] = <<-HTML | 34 | options[:attribution] = <<-HTML |
| 35 | © 2003–2022 WordPress Foundation<br> | 35 | © 2003–2024 WordPress Foundation<br> |
| 36 | Licensed under the GNU GPLv2+ License. | 36 | Licensed under the GNU GPLv2+ License. |
| 37 | HTML | 37 | HTML |
| 38 | 38 | ||