[devdocsgjs/main: 27/76] Update WordPress documentation (6.0)




commit 1f1e1446932632ba359b6f159ecddda477e50b9a
Author: Simon Legner <Simon Legner gmail com>
Date:   Wed May 25 21:17:18 2022 +0200

    Update WordPress documentation (6.0)

 lib/docs/filters/wordpress/clean_html.rb | 14 +++++++++++---
 lib/docs/scrapers/wordpress.rb           |  2 +-
 2 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/lib/docs/filters/wordpress/clean_html.rb b/lib/docs/filters/wordpress/clean_html.rb
index 32cf3b3f..a7aeb472 100644
--- a/lib/docs/filters/wordpress/clean_html.rb
+++ b/lib/docs/filters/wordpress/clean_html.rb
@@ -14,24 +14,32 @@ module Docs
             '.anchor', '.toc-jump', '.source-code-links', '.user-notes',
             '.show-more', '.hide-more').remove
 
-        br = /<br\s?\/?>/i
-
         header = at_css('h1')
         header.content = header.content.strip
         doc.prepend_child header
 
+        # Remove permalink
+        css('h2 > a, h3 > a').each do |node|
+          node.parent.remove_attribute('class')
+          node.parent.remove_attribute('tabindex')
+          node.parent.content = node.content
+        end
+
         # Add PHP code highlighting
         css('pre').each do |node|
           node['data-language'] = 'php'
         end
 
         css('.source-code-container').each do |node|
+          node.remove_class('source-code-container')
           node.name = 'pre'
-          node.inner_html = node.inner_html.gsub(br, "\n")
+          node.inner_html = node.inner_html.gsub(/<br\s?\/?>/i, "\n")
           node.content = node.content.strip
           node['data-language'] = 'php'
         end
 
+        css('section').remove_attribute('class')
+
         doc
       end
     end
diff --git a/lib/docs/scrapers/wordpress.rb b/lib/docs/scrapers/wordpress.rb
index 922e6c7d..ffb95a53 100644
--- a/lib/docs/scrapers/wordpress.rb
+++ b/lib/docs/scrapers/wordpress.rb
@@ -2,7 +2,7 @@ module Docs
   class Wordpress < UrlScraper
     self.name = 'WordPress'
     self.type = 'wordpress'
-    self.release = '5.9'
+    self.release = '6.0'
     self.base_url = 'https://developer.wordpress.org/reference/'
     self.initial_paths = %w(
       functions/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]