Use original note link casing
This commit is contained in:
parent
006d99466e
commit
1d4f39b502
@ -15,15 +15,15 @@ class BidirectionalLinksGenerator < Jekyll::Generator
|
|||||||
all_docs.each do |note_potentially_linked_to|
|
all_docs.each do |note_potentially_linked_to|
|
||||||
# Replace double-bracketed links using note title
|
# Replace double-bracketed links using note title
|
||||||
current_note.content = current_note.content.gsub(
|
current_note.content = current_note.content.gsub(
|
||||||
/\[\[#{note_potentially_linked_to.data['title']}\]\]/i,
|
/\[\[(#{note_potentially_linked_to.data['title']})\]\]/i,
|
||||||
"<a class='internal-link' href='#{note_potentially_linked_to.url}'>#{note_potentially_linked_to.data['title']}</a>"
|
"<a class='internal-link' href='#{note_potentially_linked_to.url}'>\\1</a>"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Replace double-bracketed links using note filename
|
# Replace double-bracketed links using note filename
|
||||||
title_from_filename = File.basename(note_potentially_linked_to.basename, File.extname(note_potentially_linked_to.basename)).gsub('_', ' ').gsub('-', ' ').capitalize
|
title_from_filename = File.basename(note_potentially_linked_to.basename, File.extname(note_potentially_linked_to.basename)).gsub('_', ' ').gsub('-', ' ').capitalize
|
||||||
current_note.content = current_note.content.gsub(
|
current_note.content = current_note.content.gsub(
|
||||||
/\[\[#{title_from_filename}\]\]/i,
|
/\[\[(#{title_from_filename})\]\]/i,
|
||||||
"<a class='internal-link' href='#{note_potentially_linked_to.url}'>#{title_from_filename}</a>"
|
"<a class='internal-link' href='#{note_potentially_linked_to.url}'>\\1</a>"
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user