Skip to content

Commit 7e8c19d

Browse files
committed
Update WordPress documentation (6.7)
1 parent b741457 commit 7e8c19d

File tree

3 files changed

+30
-14
lines changed

3 files changed

+30
-14
lines changed

lib/docs/filters/wordpress/clean_html.rb

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,29 @@ def call
88
end
99

1010
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
2034

2135
# Remove permalink
2236
css('h2 > a, h3 > a').each do |node|

lib/docs/filters/wordpress/entries.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ module Docs
22
class Wordpress
33
class EntriesFilter < Docs::EntriesFilter
44
def get_name
5-
at_css('.breadcrumbs .trail-end').content
5+
at_css('h1').content
66
end
77

88
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')
1012
'Classes'
1113
elsif subpath.starts_with?('hooks')
1214
'Hooks'

lib/docs/scrapers/wordpress.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module Docs
22
class Wordpress < UrlScraper
33
self.name = 'WordPress'
44
self.type = 'wordpress'
5-
self.release = '6.1'
5+
self.release = '6.7'
66
self.base_url = 'https://developer.wordpress.org/reference/'
77
self.initial_paths = %w(
88
functions/
@@ -17,7 +17,7 @@ class Wordpress < UrlScraper
1717

1818
html_filters.push 'wordpress/entries', 'wordpress/clean_html'
1919

20-
options[:container] = '#content-area'
20+
options[:container] = 'main'
2121
options[:trailing_slash] = false
2222
options[:only_patterns] = [
2323
/\Afunctions\//,
@@ -32,7 +32,7 @@ class Wordpress < UrlScraper
3232
]
3333

3434
options[:attribution] = <<-HTML
35-
&copy; 2003&ndash;2022 WordPress Foundation<br>
35+
&copy; 2003&ndash;2024 WordPress Foundation<br>
3636
Licensed under the GNU GPLv2+ License.
3737
HTML
3838

0 commit comments

Comments
 (0)