@@ -103,7 +103,7 @@ def process_package(zipfile, package, summary)
103103 url = "#{ @path } #{ name_to_url ( package [ :name ] ) } "
104104
105105 html = summary . at_css ( '#class-summary' ) . to_html
106- html = process_html ( html , url )
106+ html = process_html ( html , url , is_package : true )
107107
108108 @pages << PageDocPebbleKitAndroid . new ( @site , url , package [ :name ] , html , package )
109109
@@ -194,14 +194,18 @@ def name_to_url(name)
194194 name . split ( '.' ) . join ( '/' )
195195 end
196196
197- def process_html ( html , root )
197+ def process_html ( html , root , is_package : false )
198198 contents = Nokogiri ::HTML ( html )
199- contents . css ( 'a' ) . each do | link |
200- next if link [ 'href' ] . nil?
201-
202- href = File . expand_path ( link [ 'href' ] , root )
203- href = href . sub ( '/com/com/' , '/com/' )
204- href = href . sub ( '.html' , '/' )
199+ contents . css ( 'a' ) . each do |link |
200+ href = link [ 'href' ]
201+ next if href . nil?
202+
203+ unless href . start_with? ( 'https://' )
204+ href = "../#{ href } " unless is_package or href . start_with? ( '#' )
205+ href = File . expand_path ( href , root )
206+ . sub ( '/com/com/' , '/com/' )
207+ . sub ( '.html' , '/' )
208+ end
205209 link [ 'href' ] = href
206210 end
207211 contents . css ( '.memberSummary caption' ) . remove
0 commit comments