History

Update Marionette.js documentation (3.1.0, 2.4.7)

Thibaut Courouble committed 10 years ago

Commit 2cab0671 parent fb7e5c73 files · +49 −6Browse files

Unified · Split

3 files
  1. lib/docs/filters/marionette/entries_v2.rb +1 −1
  2. lib/docs/filters/marionette/entries_v3.rb +39 −0
  3. lib/docs/scrapers/marionette.rb +9 −5
lib/docs/filters/marionette/entries_v2.rbrenamed from lib/docs/filters/marionette/entries.rb+1−1
@@ -1,6 +1,6 @@
1module Docs1module Docs
2 class Marionette2 class Marionette
3 class EntriesFilter < Docs::EntriesFilter3 class EntriesV2Filter < Docs::EntriesFilter
4 def get_name4 def get_name
5 name = at_css('h1').content.strip5 name = at_css('h1').content.strip
6 name.remove!(/Marionette./)6 name.remove!(/Marionette./)
lib/docs/filters/marionette/entries_v3.rb+39−0
@@ -0,0 +1,39 @@
1module Docs
2 class Marionette
3 class EntriesV3Filter < Docs::EntriesFilter
4 def get_name
5 name = at_css('h1').content.strip
6 name.remove!(/Marionette./)
7 name = name[0].upcase + name.from(1)
8 name
9 end
10
11 def get_type
12 type = name.dup
13 type = 'CollectionView' if type.include?('CollectionView')
14 type = 'Miscellaneous' if %w(Features Installing\ Marionette Upgrade\ Guide Common\ Concepts Common\ Functionality).include?(type)
15 type
16 end
17
18 def additional_entries
19 if slug == 'marionette.behavior'
20 css('#documentation-index + ul a[href="#api"] + ul a').map do |node|
21 ["#{name}: #{node.content}", node['href'].remove('#')]
22 end
23 else
24 css('#documentation-index + ul a').each_with_object [] do |node, entries|
25 content = node.content.strip
26 content.remove! '\'s'
27 id = node['href'].remove('#')
28 next if content == name
29 if content.start_with?(name) || content.start_with?('Marionette.')
30 entries << [content, id]
31 elsif content =~ /\A"?[a-z]/
32 entries << ["#{name.sub('View Lifecycle', 'View')} #{content}", id]
33 end
34 end
35 end
36 end
37 end
38 end
39end
lib/docs/scrapers/marionette.rb+9−5
@@ -5,11 +5,11 @@ module Docs · 4 unmodified lines
5 self.type = 'marionette'5 self.type = 'marionette'
6 self.root_path = 'index'6 self.root_path = 'index'
7 self.links = {7 self.links = {
8 home: 'http://marionettejs.com/',8 home: 'https://marionettejs.com/',
9 code: 'https://github.com/marionettejs/backbone.marionette'9 code: 'https://github.com/marionettejs/backbone.marionette'
10 }10 }
11 11
12 html_filters.push 'marionette/clean_html', 'marionette/entries'12 html_filters.push 'marionette/clean_html'
13 13
14 options[:container] = '.docs__content'14 options[:container] = '.docs__content'
15 15
@@ -19,13 +19,17 @@ module Docs · 3 unmodified lines
19 HTML19 HTML
20 20
21 version '3' do21 version '3' do
22 self.release = '3.0.0'22 self.release = '3.1.0'
23 self.base_url = "http://marionettejs.com/docs/v#{release}/"23 self.base_url = "https://marionettejs.com/docs/v#{release}/"
24
25 html_filters.push 'marionette/entries_v3'
24 end26 end
25 27
26 version '2' do28 version '2' do
27 self.release = '2.4.7'29 self.release = '2.4.7'
28 self.base_url = "http://marionettejs.com/docs/v#{release}/"30 self.base_url = "https://marionettejs.com/docs/v#{release}/"
31
32 html_filters.push 'marionette/entries_v2'
29 end33 end
30 end34 end
31end35end