@@ -16,8 +16,8 @@ def javadoc(project, series)
16
16
return DocumentRef . from_patterns ( project , series , :javadoc )
17
17
end
18
18
19
- def getting_started_guide ( project , series )
20
- return DocumentRef . from_patterns ( project , series , :getting_started_guide )
19
+ def getting_started_guides ( project , series )
20
+ return DocumentRef . from_patterns_multi ( project , series , :getting_started_guide )
21
21
end
22
22
23
23
def migration_guide ( project , series )
@@ -148,13 +148,32 @@ class DocumentRef
148
148
149
149
def self . from_patterns ( project , series , link_key )
150
150
log_prefix = "#{ project . name } /#{ series . version } /#{ link_key } : "
151
- link = series &.links &.[]( link_key )
152
- link ||= project &.links &.[]( link_key )
151
+ link_root = series &.links &.[]( link_key )
152
+ link_root ||= project &.links &.[]( link_key )
153
+ return from_patterns_single ( project , series , link_key , link_root )
154
+ end
155
+
156
+ def self . from_patterns_multi ( project , series , link_key )
157
+ log_prefix = "#{ project . name } /#{ series . version } /#{ link_key } : "
158
+ link_root = series &.links &.[]( link_key )
159
+ link_root ||= project &.links &.[]( link_key )
160
+ links = [ ]
161
+ if link_root . kind_of? ( Array )
162
+ link_root . each do |link |
163
+ links . push ( from_patterns_single ( project , series , link_key , link ) )
164
+ end
165
+ else
166
+ links . push ( from_patterns_single ( project , series , link_key , link_root ) )
167
+ end
168
+ return links . compact
169
+ end
170
+
171
+ def self . from_patterns_single ( project , series , link_key , link )
172
+ log_prefix = "#{ project . name } /#{ series . version } /#{ link_key } : "
153
173
if link . nil?
154
174
@@logger . debug ( "#{ log_prefix } Link is nil" )
155
175
return nil
156
176
end
157
- @@logger . debug ( "#{ log_prefix } Link is #{ link } " )
158
177
displayed = link [ 'displayed' ]
159
178
if not displayed . nil? and not displayed
160
179
@@logger . debug ( "#{ log_prefix } Link is not displayed" )
@@ -165,6 +184,8 @@ def self.from_patterns(project, series, link_key)
165
184
@@logger . debug ( "#{ log_prefix } Link is for the latest stable series only" )
166
185
return nil
167
186
end
187
+ name = link [ 'name' ]
188
+ @@logger . debug ( "#{ log_prefix } Link name: #{ name } " )
168
189
latest_stable = link [ 'latest_stable' ]
169
190
if latest_stable and series . latest_stable
170
191
link = latest_stable
@@ -179,12 +200,13 @@ def self.from_patterns(project, series, link_key)
179
200
if html_url . nil? and pdf_url . nil?
180
201
return nil
181
202
end
182
- return DocumentRef . new ( html_url , pdf_url )
203
+ return DocumentRef . new ( name , html_url , pdf_url )
183
204
end
184
205
185
- attr_reader :html_url , :pdf_url
206
+ attr_reader :name , : html_url, :pdf_url
186
207
187
- def initialize ( html_url , pdf_url )
208
+ def initialize ( name , html_url , pdf_url )
209
+ @name = name
188
210
@html_url = html_url
189
211
@pdf_url = pdf_url
190
212
end
0 commit comments