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
8 end8 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').remove15 '.screen-reader-text',
16 16 '.table-of-contents',
17 header = at_css('h1')17 '.anchor',
18 header.content = header.content.strip18 '.toc-jump',
19 doc.prepend_child header19 '.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 permalink35 # Remove permalink
22 css('h2 > a, h3 > a').each do |node|36 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
2 class Wordpress2 class Wordpress
3 class EntriesFilter < Docs::EntriesFilter3 class EntriesFilter < Docs::EntriesFilter
4 def get_name4 def get_name
5 at_css('.breadcrumbs .trail-end').content5 at_css('h1').content
6 end6 end
7 7
8 def get_type8 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'
lib/docs/scrapers/wordpress.rb+3−3
@@ -2,7 +2,7 @@ module Docs · 1 unmodified line
2 class Wordpress < UrlScraper2 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] = false21 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] = <<-HTML34 options[:attribution] = <<-HTML
35 &copy; 2003&ndash;2022 WordPress Foundation<br>35 &copy; 2003&ndash;2024 WordPress Foundation<br>
36 Licensed under the GNU GPLv2+ License.36 Licensed under the GNU GPLv2+ License.
37 HTML37 HTML
38 38