diff --git a/lib/docs/filters/sinon/clean_html.rb b/lib/docs/filters/sinon/clean_html.rb index 0c301206..b7ea8e55 100644 --- a/lib/docs/filters/sinon/clean_html.rb +++ b/lib/docs/filters/sinon/clean_html.rb @@ -20,7 +20,13 @@ module Docs node['data-language'] = 'javascript' end + css('#banner-message').remove + + # Removes duplicate title + css('#json-p').remove + doc + end end end diff --git a/lib/docs/scrapers/sinon.rb b/lib/docs/scrapers/sinon.rb index 632348dc..1d06c582 100644 --- a/lib/docs/scrapers/sinon.rb +++ b/lib/docs/scrapers/sinon.rb @@ -14,12 +14,31 @@ module Docs options[:container] = '.content .container' options[:attribution] = <<-HTML - © 2010–2018 Christian Johansen
+ © 2010–2020 Christian Johansen
Licensed under the BSD License. HTML + # Links in page point to '../page' what makes devdocs points to non-existent links + options[:fix_urls] = -> (url) do + if !(url =~ /releases\/v\d*/) + url.gsub!(/.*releases\//, "") + end + + url + end + + version '9' do + self.release = '9.2.2' + self.base_url = "https://sinonjs.org/releases/v#{release}/" + end + + version '8' do + self.release = '8.1.1' + self.base_url = "https://sinonjs.org/releases/v#{release}/" + end + version '7' do - self.release = '7.1.1' + self.release = '7.5.0' self.base_url = "https://sinonjs.org/releases/v#{release}/" end @@ -54,8 +73,9 @@ module Docs end def get_latest_version(opts) - body = fetch('https://sinonjs.org/', opts) - body.scan(/\/releases\/v([0-9.]+)/)[0][0] + tags = get_github_tags('sinonjs', 'sinon', opts) + tags[0]['name'][1..-1] end + end end