Unified · Split
| @@ -8,15 +8,29 @@ module Docs · 7 unmodified lines | ||
| 8 | 8 | end |
| 9 | 9 | |
| 10 | 10 | article = at_css('article[id^="post-"]') |
| 11 | − @doc = at_css('article[id^="post-"]') unless article.nil? | |
| 12 | − | |
| 13 | − css('hr', '.screen-reader-text', '.table-of-contents', | |
| 14 | − '.anchor', '.toc-jump', '.source-code-links', '.user-notes', | |
| 15 | − '.show-more', '.hide-more').remove | |
| 16 | − | |
| 17 | − header = at_css('h1') | |
| 18 | − header.content = header.content.strip | |
| 19 | − doc.prepend_child header | |
| 11 | + @doc = article unless article.nil? | |
| 12 | + | |
| 13 | + css( | |
| 14 | + 'hr', | |
| 15 | + '.screen-reader-text', | |
| 16 | + '.table-of-contents', | |
| 17 | + '.anchor', | |
| 18 | + '.toc-jump', | |
| 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 | 35 | # Remove permalink |
| 22 | 36 | css('h2 > a, h3 > a').each do |node| |
| @@ -2,11 +2,13 @@ module Docs · 1 unmodified line | ||
| 2 | 2 | class Wordpress |
| 3 | 3 | class EntriesFilter < Docs::EntriesFilter |
| 4 | 4 | def get_name |
| 5 | − at_css('.breadcrumbs .trail-end').content | |
| 5 | + at_css('h1').content | |
| 6 | 6 | end |
| 7 | 7 | |
| 8 | 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 | 12 | 'Classes' |
| 11 | 13 | elsif subpath.starts_with?('hooks') |
| 12 | 14 | 'Hooks' |
| @@ -2,7 +2,7 @@ module Docs · 1 unmodified line | ||
| 2 | 2 | class Wordpress < UrlScraper |
| 3 | 3 | self.name = 'WordPress' |
| 4 | 4 | self.type = 'wordpress' |
| 5 | − self.release = '6.1' | |
| 5 | + self.release = '6.7' | |
| 6 | 6 | self.base_url = 'https://developer.wordpress.org/reference/' |
| 7 | 7 | self.initial_paths = %w( |
| 8 | 8 | functions/ |
| @@ -17,7 +17,7 @@ module Docs · 8 unmodified lines | ||
| 17 | 17 | |
| 18 | 18 | html_filters.push 'wordpress/entries', 'wordpress/clean_html' |
| 19 | 19 | |
| 20 | − options[:container] = '#content-area' | |
| 20 | + options[:container] = 'main' | |
| 21 | 21 | options[:trailing_slash] = false |
| 22 | 22 | options[:only_patterns] = [ |
| 23 | 23 | /\Afunctions\//, |
| @@ -32,7 +32,7 @@ module Docs · 8 unmodified lines | ||
| 32 | 32 | ] |
| 33 | 33 | |
| 34 | 34 | options[:attribution] = <<-HTML |
| 35 | − © 2003–2022 WordPress Foundation<br> | |
| 35 | + © 2003–2024 WordPress Foundation<br> | |
| 36 | 36 | Licensed under the GNU GPLv2+ License. |
| 37 | 37 | HTML |
| 38 | 38 | |