History

Update WordPress documentation (6.7)

Simon Legner committed 1 year ago

Commit 7e8c19d1 parent b7414573 files · +30 −14Browse files

Unified · Split

3 files
  1. lib/docs/filters/wordpress/clean_html.rb +23 −9
  2. lib/docs/filters/wordpress/entries.rb +4 −2
  3. lib/docs/scrapers/wordpress.rb +3 −3
lib/docs/filters/wordpress/clean_html.rb+23−9
@@ -8,15 +8,29 @@ module Docs · 7 unmodified lines
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+4−2
@@ -2,11 +2,13 @@ module Docs · 1 unmodified line
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+3−3
@@ -2,7 +2,7 @@ module Docs · 1 unmodified line
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 @@ module Docs · 8 unmodified lines
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 @@ module Docs · 8 unmodified lines
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