@@ -126,7 +126,7 @@ def process_markdown_parts(page, markdown)
126
126
127
127
# Search for known link titles
128
128
# NOTE: Using multi line matching here will not help either if the pattern itself is in the middle broken/spaned to multiple lines, so using whitespace replacements now inside the patter to handle this, see above!
129
- full_pattern = /(^|[\s .,;:&'"\- (])(#{ pattern } )([\s .,;:&'"\- )]|\z )(?![^<]*?<\/ a>)/
129
+ full_pattern = /(^|[\s .,;:&'"(])(#{ pattern } )([\s .,;:&'")]|\z )(?![^<]*?<\/ a>)/
130
130
markdown_part = process_markdown_part ( page , markdown_part , page_links , full_pattern , id , url , needs_tooltip , true )
131
131
else
132
132
# Content inside of special Markdown blocks
@@ -232,7 +232,11 @@ def page_links_ids_sorted_by_title(page_links)
232
232
end
233
233
end
234
234
235
- sorted_arr . sort_by { |page | page [ "title" ] . downcase } . reverse
235
+ # With this reversed length sort order we try to guarantie that
236
+ # the autolink/tooltip title pattern matching finds titles like
237
+ # 'Soft macros' before 'macros'
238
+ # In most of the cases matching the longer titles first will eliminate such issues
239
+ sorted_arr . sort_by { |page | page [ "title" ] . length } . reverse
236
240
end
237
241
238
242
def gen_page_link_data ( links_dir , link_files_pattern )
@@ -287,16 +291,15 @@ def gen_page_link_data(links_dir, link_files_pattern)
287
291
puts "Unknow ID (#{ alias_id } ) in alias definition"
288
292
exit 4
289
293
end
290
- _ , aliases = alias_data . first
291
- page_link_data [ "title" ] = aliases . concat ( page_link_data [ "title" ] )
292
- #puts "page_link_data: #{page_link_data}"
294
+ page_link_data [ "title" ] . concat ( alias_data [ "aliases" ] )
295
+ # puts "page_link_data: #{page_link_data}"
293
296
end
294
297
295
298
# Just for debugging
296
299
# pp page_links_dictionary
297
- page_links_ids_sorted_by_title ( page_links_dictionary ) . each do |data |
298
- # puts data
299
- end
300
+ # page_links_ids_sorted_by_title(page_links_dictionary).each do |data|
301
+ # puts data
302
+ # end
300
303
301
304
#pp page_links_dictionary
302
305
return page_links_dictionary
0 commit comments