Skip to content

Commit 7752104

Browse files
committed
lib/docs_android: fixup link generation
Signed-off-by: Ruby Iris Juric <[email protected]>
1 parent 233c132 commit 7752104

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

lib/pebble_documentation_pebblekit_android.rb

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -196,12 +196,16 @@ def name_to_url(name)
196196

197197
def process_html(html, root)
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 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

Comments
 (0)