[devdocsgjs/main: 1480/1867] Update Vue.js documentation (2.6.12 and 3.0.5)
- From: Andy Holmes <andyholmes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devdocsgjs/main: 1480/1867] Update Vue.js documentation (2.6.12 and 3.0.5)
- Date: Fri, 19 Nov 2021 23:48:05 +0000 (UTC)
commit c49736bad6e762182bad60e07afdf5cafb526a94
Author: Simon Legner <Simon Legner gmail com>
Date: Sat Jan 30 02:08:52 2021 +0100
Update Vue.js documentation (2.6.12 and 3.0.5)
assets/stylesheets/pages/_vue.scss | 5 ++++
lib/docs/filters/vue/clean_html.rb | 9 ++++++-
lib/docs/filters/vue/entries_v3.rb | 55 ++++++++++++++++++++++++++++++++++++++
lib/docs/scrapers/vue.rb | 16 ++++++++---
4 files changed, 80 insertions(+), 5 deletions(-)
---
diff --git a/assets/stylesheets/pages/_vue.scss b/assets/stylesheets/pages/_vue.scss
index a7440214..24b77e66 100644
--- a/assets/stylesheets/pages/_vue.scss
+++ b/assets/stylesheets/pages/_vue.scss
@@ -2,4 +2,9 @@
@extend %simple;
p.tip { @extend %note; }
+ .custom-block {
+ @extend %note;
+ &.tip { @extend %note-green; }
+ &.info { @extend %note-blue; }
+ }
}
diff --git a/lib/docs/filters/vue/clean_html.rb b/lib/docs/filters/vue/clean_html.rb
index 51c735ff..affde245 100644
--- a/lib/docs/filters/vue/clean_html.rb
+++ b/lib/docs/filters/vue/clean_html.rb
@@ -2,12 +2,17 @@ module Docs
class Vue
class CleanHtmlFilter < Filter
def call
- @doc = at_css('.content')
+ @doc = at_css(version == '3' ? 'main' : '.content')
at_css('h1').content = 'Vue.js' if root_page?
doc.child.before('<h1>Vue.js API</h1>') if slug == 'api/' || slug == 'api/index'
css('.demo', '.guide-links', '.footer', '#ad').remove
+ css('.header-anchor', '.page-edit', '.page-nav').remove
+
+ css('.custom-block-title').each do |node|
+ node.name = 'strong'
+ end
# Remove code highlighting
css('figure').each do |node|
@@ -16,6 +21,7 @@ module Docs
node['data-language'] = node['class'][/highlight (\w+)/, 1]
end
+ css('.line-numbers-wrapper').remove
css('pre').each do |node|
node.content = node.content.strip
node['data-language'] = 'javascript'
@@ -23,6 +29,7 @@ module Docs
css('iframe').each do |node|
node['sandbox'] = 'allow-forms allow-scripts allow-same-origin'
+ node.remove if node['src'][/player.vimeo.com/] #
https://v3.vuejs.org/guide/migration/introduction.html#overview
end
css('details').each do |node|
diff --git a/lib/docs/filters/vue/entries_v3.rb b/lib/docs/filters/vue/entries_v3.rb
new file mode 100644
index 00000000..a2941e3a
--- /dev/null
+++ b/lib/docs/filters/vue/entries_v3.rb
@@ -0,0 +1,55 @@
+module Docs
+ class Vue
+ class EntriesV3Filter < Docs::EntriesFilter
+ def get_name
+ if slug == 'api/' || slug == 'api/index'
+ 'API'
+ elsif slug == 'style-guide/'
+ 'Style Guide'
+ else
+ name = at_css('h1').content
+ name.sub! %r{#\s*}, ''
+ index = css('.sidebar-link').to_a.index(at_css('.sidebar-link.active'))
+ name.prepend "#{index + 1}. " if index
+ name
+ end
+ end
+
+ def get_type
+ if slug.start_with?('guide/migration')
+ 'Migration'
+ elsif slug.start_with?('guide')
+ subtype = at_css('.sidebar-heading.open, .sidebar-link.active')
+ subtype ? "Guide: #{subtype.content}": 'Guide'
+ elsif slug == 'style-guide/'
+ 'Style Guide'
+ else
+ 'API'
+ end
+ end
+
+ def additional_entries
+ return [] if slug.start_with?('guide')
+ type = nil
+
+ css('h2, h3').each_with_object [] do |node, entries|
+ if node.name == 'h2'
+ type = node.content.strip
+ type.sub! %r{#\s*}, ''
+ next if slug == 'style-guide/'
+ title = at_css('h1').content.strip
+ title.sub! %r{#\s*}, ''
+ entries << [type, node['id'], "API: #{title}"]
+ elsif slug == 'style-guide/'
+ name = node.content.strip
+ name.sub! %r{#\s*}, ''
+ name.sub! %r{\(.*\)}, '()'
+ name.sub! /(essential|strongly recommended|recommended|use with caution)\Z/, ''
+ curent_type = "Style Guide: #{type.sub(/Rules: /, ': ')}"
+ entries << [name, node['id'], curent_type]
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/lib/docs/scrapers/vue.rb b/lib/docs/scrapers/vue.rb
index 9f90f9bf..a0cfc5c2 100644
--- a/lib/docs/scrapers/vue.rb
+++ b/lib/docs/scrapers/vue.rb
@@ -8,8 +8,6 @@ module Docs
code: 'https://github.com/vuejs/vue'
}
- html_filters.push 'vue/entries', 'vue/clean_html'
-
options[:only_patterns] = [/guide\//, /api\//]
options[:skip] = %w(guide/team.html)
options[:replace_paths] = { 'guide/' => 'guide/index.html' }
@@ -19,11 +17,20 @@ module Docs
Licensed under the MIT License.
HTML
+ version '3' do
+ self.release = '3.0.5'
+ self.base_url = 'https://v3.vuejs.org/'
+ self.root_path = 'guide/introduction.html'
+ self.initial_paths = %w(api/)
+ html_filters.push 'vue/entries_v3', 'vue/clean_html'
+ end
+
version '2' do
- self.release = '2.6.10'
+ self.release = '2.6.12'
self.base_url = 'https://vuejs.org/v2/'
self.root_path = 'guide/index.html'
self.initial_paths = %w(api/)
+ html_filters.push 'vue/entries', 'vue/clean_html'
end
version '1' do
@@ -31,10 +38,11 @@ module Docs
self.base_url = 'https://v1.vuejs.org'
self.root_path = '/guide/index.html'
self.initial_paths = %w(/api/index.html)
+ html_filters.push 'vue/entries', 'vue/clean_html'
end
def get_latest_version(opts)
- get_latest_github_release('vuejs', 'vue-next', opts)
+ get_npm_version('vue', opts, 'next')
end
end
end
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]