@@ -8,10 +8,10 @@ def get_name
8
8
9
9
# Add index on guides
10
10
unless subpath . start_with? ( 'api' )
11
- sidebarLink = at_css ( '.sidebar-link.active' )
12
- allLinks = css ( '.sidebar-link:not([href="/"]):not([href="../index"])' )
11
+ sidebar_link = at_css ( '.sidebar-link.active' )
12
+ all_links = css ( '.sidebar-link:not([href="/"]):not([href="../index"])' )
13
13
14
- index = allLinks . index ( sidebarLink )
14
+ index = all_links . index ( sidebar_link )
15
15
16
16
name . prepend "#{ index + 1 } . " if index
17
17
end
@@ -28,41 +28,42 @@ def include_default_entry?
28
28
end
29
29
30
30
def additional_entries
31
- return [ ] unless subpath . start_with? ( 'api' )
31
+ return [ ] unless subpath . start_with? ( 'api' )
32
32
33
33
entries = [
34
34
[ 'Component Binding Helpers' , 'component-binding-helpers' , 'API Reference' ] ,
35
35
[ 'Store' , 'vuex-store' , 'API Reference' ] ,
36
36
]
37
37
38
38
css ( 'h3' ) . each do |node |
39
- entryName = node . content . strip
39
+ entry_name = node . content . strip
40
40
41
41
# Get the previous h2 title
42
42
title = node
43
43
title = title . previous_element until title . name == 'h2'
44
44
title = title . content . strip
45
45
title . remove! '# '
46
46
47
- entryName . remove! '# '
47
+ entry_name . remove! '# '
48
48
49
- unless entryName . start_with? ( 'router.' )
50
- if title == "Vuex.Store Constructor Options"
51
- entryName = "StoreOptions.#{ entryName } "
52
- elsif title == "Vuex.Store Instance Properties"
53
- entryName = "Vuex.Store.#{ entryName } "
54
- elsif title == "Vuex.Store Instance Methods"
55
- entryName = "Vuex.Store.#{ entryName } ()"
56
- elsif title == "Component Binding Helpers"
57
- entryName = "#{ entryName } ()"
49
+ unless entry_name . start_with? ( 'router.' )
50
+ case title
51
+ when "Vuex.Store Constructor Options"
52
+ entry_name = "StoreOptions.#{ entry_name } "
53
+ when "Vuex.Store Instance Properties"
54
+ entry_name = "Vuex.Store.#{ entry_name } "
55
+ when "Vuex.Store Instance Methods"
56
+ entry_name = "Vuex.Store.#{ entry_name } ()"
57
+ when "Component Binding Helpers"
58
+ entry_name = "#{ entry_name } ()"
58
59
end
59
60
end
60
61
61
- entries << [ entryName , node [ 'id' ] , 'API Reference' ]
62
+ entries << [ entry_name , node [ 'id' ] , 'API Reference' ]
62
63
end
63
64
64
65
entries
65
66
end
66
67
end
67
68
end
68
- end
69
+ end
0 commit comments