@@ -54,6 +54,7 @@ def is_modifiable_markdown_part?(part)
54
54
end
55
55
56
56
def make_tooltip ( page , page_links , id , url , match )
57
+ use_blank = false
57
58
match_parts = match . split ( /(?<!\\ )\| / )
58
59
59
60
# If the text has an '|' it means it comes from our special autolink/tooltip [[text|id]] markdown block
@@ -74,6 +75,7 @@ def make_tooltip(page, page_links, id, url, match)
74
75
end
75
76
link_data = page_links [ id ]
76
77
if link_data != nil
78
+ use_blank = link_data [ "open_in_blank" ]
77
79
url = link_data [ "url" ]
78
80
url = prefixed_url ( url , page . site . config [ "baseurl" ] )
79
81
else
@@ -99,7 +101,7 @@ def make_tooltip(page, page_links, id, url, match)
99
101
# NOTE: Now we treat every link that has protocol prefix part as an external one
100
102
# that allows usage of direct links anywhere if needed (not recommended, plz use external_links.yml instead)
101
103
# but, at the same time requires e.g. all the really external links to be fully qualified (even in external_links.yml as well)
102
- external_url = is_prefixed_url? ( url )
104
+ external_url = is_prefixed_url? ( url ) || use_blank
103
105
title = save_from_markdownify ( title )
104
106
replacement_text = '<a href="' + url + '" class="nav-link content-tooltip"' + ( external_url ? ' target="_blank"' : '' ) + '>' + title + '</a>'
105
107
# puts "replacement_text: " + replacement_text
@@ -345,6 +347,7 @@ def gen_page_link_data(links_dir, link_files_pattern)
345
347
page_id = yaml_content [ 'id' ]
346
348
page_url = yaml_content [ 'url' ]
347
349
page_title = yaml_content [ 'title' ]
350
+ open_in_blank = yaml_content [ 'open_in_blank' ]
348
351
chars_to_remove = %{"'}
349
352
page_title = page_title . gsub ( /\A [#{ Regexp . escape ( chars_to_remove ) } ]+|[#{ Regexp . escape ( chars_to_remove ) } ]+\z / , '' )
350
353
#puts "page_title: " + page_title
@@ -358,6 +361,7 @@ def gen_page_link_data(links_dir, link_files_pattern)
358
361
"id" => page_id ,
359
362
"url" => page_url ,
360
363
"title" => [ page_title ] ,
364
+ "open_in_blank" => open_in_blank ,
361
365
}
362
366
363
367
# Add the page_link_data object to the ID dictionary
@@ -423,7 +427,7 @@ def JekyllTooltipGen_debug_page_info(page, details = true)
423
427
def JekyllTooltipGen_debug_filter_pages? ( page )
424
428
debug_pages = {
425
429
# "doc/README.md" => true,
426
- }
430
+ }
427
431
debug_ok = true
428
432
# Comment this line out if not debugging!!!
429
433
# debug_ok = (debug_pages[page.relative_path] != nil && debug_pages[page.relative_path])
0 commit comments