From 78168366cf67c0fc3dbff9e6c64425fbc74a5a1e Mon Sep 17 00:00:00 2001 From: Jasper van Merle Date: Mon, 12 Aug 2019 00:32:37 +0200 Subject: [PATCH] wordpress: finish scraper and filters --- .../templates/pages/about_tmpl.coffee | 6 ++++++ lib/docs/filters/wordpress/clean_html.rb | 9 ++++++++- lib/docs/filters/wordpress/entries.rb | 12 +----------- lib/docs/scrapers/wordpress.rb | 10 +++++----- public/icons/docs/wordpress/16.png | Bin 958 -> 1513 bytes public/icons/docs/wordpress/16@2x.png | Bin 3284 -> 1703 bytes 6 files changed, 20 insertions(+), 17 deletions(-) diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index 81e1e5b7..37d14eea 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -728,6 +728,12 @@ credits = [ 'CC BY', 'https://creativecommons.org/licenses/by/4.0/' ], [ + 'Wordpress', + '2003-2019 WordPress Foundation', + 'GPLv2+', + 'https://wordpress.org/about/license/' + ], + [ 'Yarn', '2016-present Yarn Contributors', 'BSD', diff --git a/lib/docs/filters/wordpress/clean_html.rb b/lib/docs/filters/wordpress/clean_html.rb index 42ca5f29..32cf3b3f 100644 --- a/lib/docs/filters/wordpress/clean_html.rb +++ b/lib/docs/filters/wordpress/clean_html.rb @@ -7,12 +7,19 @@ module Docs return doc end + article = at_css('article[id^="post-"]') + @doc = at_css('article[id^="post-"]') unless article.nil? + css('hr', '.screen-reader-text', '.table-of-contents', '.anchor', '.toc-jump', '.source-code-links', '.user-notes', '.show-more', '.hide-more').remove br = //i + header = at_css('h1') + header.content = header.content.strip + doc.prepend_child header + # Add PHP code highlighting css('pre').each do |node| node['data-language'] = 'php' @@ -29,4 +36,4 @@ module Docs end end end -end \ No newline at end of file +end diff --git a/lib/docs/filters/wordpress/entries.rb b/lib/docs/filters/wordpress/entries.rb index bfcd10b3..ba539d67 100644 --- a/lib/docs/filters/wordpress/entries.rb +++ b/lib/docs/filters/wordpress/entries.rb @@ -1,12 +1,6 @@ module Docs class Wordpress class EntriesFilter < Docs::EntriesFilter - def breadcrumbs - @breadcrumbs ||= css('.breadcrumbs .trail-inner a') - .map(&:content) - .map(&:strip) - end - def get_name at_css('.breadcrumbs .trail-end').content end @@ -18,12 +12,8 @@ module Docs 'Hooks' elsif subpath.starts_with?('functions') 'Functions' - elsif breadcrumbs.size > 1 - breadcrumbs.drop(1).join(': ') - else - at_css('.breadcrumbs .trail-end').content end end end end -end \ No newline at end of file +end diff --git a/lib/docs/scrapers/wordpress.rb b/lib/docs/scrapers/wordpress.rb index 472013ac..58e42cb8 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 = '4.9.4' + self.release = '5.2.2' self.base_url = 'https://developer.wordpress.org/reference/' self.initial_paths = %w( functions/ @@ -15,10 +15,10 @@ module Docs code: 'https://github.com/WordPress/WordPress' } - html_filters.push 'wordpress/clean_html', 'wordpress/entries' + html_filters.push 'wordpress/entries', 'wordpress/clean_html' options[:container] = '#content-area' - options[:trailing_slash] = true + options[:trailing_slash] = false options[:only_patterns] = [ /\Afunctions\//, /\Ahooks\//, @@ -32,8 +32,8 @@ module Docs ] options[:attribution] = <<-HTML - © 2003–2018 WordPress Foundation
+ © 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License. HTML end -end \ No newline at end of file +end diff --git a/public/icons/docs/wordpress/16.png b/public/icons/docs/wordpress/16.png index 13f3fa64dd7aee3835861516bd4a5e51de297ac7..0b3dc1cd28a48509d8df1e745359bc9fad981b7c 100644 GIT binary patch literal 1513 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJOS+@4BLl<6e(pbstU$g(vPY0F z14ES>14Ba#1H&(%P{RubhEf9thF1v;3|2E37{m+a>JBa>64!Xr+uTYzM8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VF=<43ts{dxdr*3LXOR!4f zk)VXpSxJo<%3gv%roY~wRoCOuc`yyrG6TE2uG&5lnn!dYgBG(9x-u;|K?BcB9Eze~ z-zEzk27ixODytd{2j!@%?tXapX6n#_PA!&aqL1#R^vlnV;h zS7;HLPa`y!gurubOJD}kM^YkaHR<7rB)qik;y9uvZuG>2ef3CU~@o2?u0ESrZ>ufu_@ zt$wB<+9hV-qr3n4{ob3IGy9q{@x^82R*UMP#dCm0SB0Ue7&R0yn_R*d@4c2e(bu0P z&3}(f%dgEu&y19sJNEU}*vV~{KtTqkrA6qC>rrE=gOrn5OQOSW3LO9TW`uD`bCwC! zSzyETQ}=c>oc&H6rh`tK_ucju-A>2LHb(LUo`ioHonE}{3%l7c1uuMf@%ZHj&xeWi z4xya&3&B|7-0iAxbsiB7CRZVyu&5(jQ7rkmka{+mo*cTC_6<)`h_z&jkoix50RVA1 VT=~ZhHl+Xn002ovPDHLkV1hBW(}Ms2 diff --git a/public/icons/docs/wordpress/16@2x.png b/public/icons/docs/wordpress/16@2x.png index dd7147c74e1ad91ffb33d0f9ed0c4c6fd73ad031..9de430fec4074445ff3c114ebcd8166f51341c7e 100644 GIT binary patch delta 1687 zcmV;I259-z8K(`9B!2{FK}|sb0I`n?{9y$E001CkNK#Dz0D2|>0Dy!50Qvv`0D$NK z0Cg|`0P0`>06Lfe02gqax=}m;000JJOGiWi{{a60|De66lK=n!32#P5a{vGU2mk;8 z2mt<|zN-KL00(qQO+^Re2n+xi22I)unE(I)33hNnX8-^IFn<6505AZ~?u=Ie00n_b zL_t(o!^PKYjFwjs2k_s#tSl8QMky4QOGBxmptTUBT4)T?wUuI2A~A*-Yho0mF}fyeM$?7<;Cnd%cU9SiYl^x;9=h6gZuu0Z}HfW=oYS4x3t_#m#u7JM%vhDs?D z(m@|ynA?tLa0epdpQV&}cso|&SJ;Td5ne z26xmT#x<}vao`qwCn9de8*nRDCC|@QCSnQt@o+@kp(g6bup5VF%$noSf&Dd$Tbyse zoe{CAlz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