From 8507118e2cf7203f800d972d2387d3ccc47e7988 Mon Sep 17 00:00:00 2001 From: Enoc Date: Thu, 10 Feb 2022 19:15:59 -0600 Subject: [PATCH] Update Jasmine documentation (4.0.0) --- assets/stylesheets/application.css.scss | 1 + assets/stylesheets/pages/_jasmine.scss | 4 ++++ lib/docs/filters/jasmine/clean_html.rb | 22 ++++++++++------------ lib/docs/filters/jasmine/entries.rb | 17 +++++------------ lib/docs/scrapers/jasmine.rb | 6 +++--- 5 files changed, 23 insertions(+), 27 deletions(-) create mode 100644 assets/stylesheets/pages/_jasmine.scss diff --git a/assets/stylesheets/application.css.scss b/assets/stylesheets/application.css.scss index 93c74b5d..05967c18 100644 --- a/assets/stylesheets/application.css.scss +++ b/assets/stylesheets/application.css.scss @@ -66,6 +66,7 @@ 'pages/gtk', 'pages/haproxy', 'pages/haskell', + 'pages/jasmine', 'pages/jekyll', 'pages/jq', 'pages/jquery', diff --git a/assets/stylesheets/pages/_jasmine.scss b/assets/stylesheets/pages/_jasmine.scss new file mode 100644 index 00000000..4a4b8d46 --- /dev/null +++ b/assets/stylesheets/pages/_jasmine.scss @@ -0,0 +1,4 @@ +._jasmine { + .subsection-title, h2 { @extend %block-heading; } + h4 { @extend %block-label, %label-blue; } +} diff --git a/lib/docs/filters/jasmine/clean_html.rb b/lib/docs/filters/jasmine/clean_html.rb index ea58f127..7255a9c1 100644 --- a/lib/docs/filters/jasmine/clean_html.rb +++ b/lib/docs/filters/jasmine/clean_html.rb @@ -2,21 +2,19 @@ module Docs class Jasmine class CleanHtmlFilter < Filter def call - @doc = at_css('.docs') + @doc = at_css('.docs') unless root_page? - at_css('h1').content = 'Jasmine' if root_page? + # css('header', 'article', 'section:not([class])', 'div.description').each do |node| + # node.before(node.children).remove + # end - css('header', 'article', 'section:not([class])', 'div.description').each do |node| - node.before(node.children).remove - end - - css('h3.subsection-title').each do |node| - node.name = 'h2' - end + # css('h3.subsection-title').each do |node| + # node.name = 'h2' + # end - css('h4.name').each do |node| - node.name = 'h3' - end + # css('h4.name').each do |node| + # node.name = 'h3' + # end css('pre').each do |node| node.content = node.content diff --git a/lib/docs/filters/jasmine/entries.rb b/lib/docs/filters/jasmine/entries.rb index 4bb6a59e..eb3b08f9 100644 --- a/lib/docs/filters/jasmine/entries.rb +++ b/lib/docs/filters/jasmine/entries.rb @@ -2,24 +2,17 @@ module Docs class Jasmine class EntriesFilter < Docs::EntriesFilter def get_name - name = at_css('h1').content.strip - name.remove! %r{\A\w+:\s} - name + at_css('h1').content.strip end def get_type - at_css('h1').content.strip + name end def additional_entries - css('h3[id]').each_with_object [] do |node, entries| - name = node.content.strip - next if name.start_with?('new ') - static = name.sub! '(static) ', '' - name.sub! %r{\(.*\)}, '()' - name.remove! %r{\s.*} - name.prepend "#{self.name}#{static ? '.' : '#'}" unless slug == 'global' - entries << [name, node['id']] + css('h4[id]').each_with_object [] do |node, entries| + name = node['id'] + entries << [name.sub(/\./, ''), name] end end end diff --git a/lib/docs/scrapers/jasmine.rb b/lib/docs/scrapers/jasmine.rb index bdcb3626..753e6134 100644 --- a/lib/docs/scrapers/jasmine.rb +++ b/lib/docs/scrapers/jasmine.rb @@ -1,8 +1,8 @@ module Docs class Jasmine < UrlScraper - self.type = 'simple' - self.release = '3.7.1' - self.base_url = 'https://jasmine.github.io/api/3.7/' + self.type = 'jasmine' + self.release = '4.0.0' + self.base_url = 'https://jasmine.github.io/api/4.0/' self.root_path = 'index.html' self.links = { home: 'https://jasmine.github.io/',