gsub -> gsub!
In case you were exerting a coding style opinion, feel free to ignore this pull request.
The following are equivalent, as far as I understand, so some chars can be deleted 🙂:
`current_note.content = current_note.content.gsub()` == `current_note.content.gsub!()`
This commit is contained in:
parent
c421400ae9
commit
8514601d06
@ -25,28 +25,28 @@ class BidirectionalLinksGenerator < Jekyll::Generator
|
|||||||
|
|
||||||
# Replace double-bracketed links with label using note title
|
# Replace double-bracketed links with label using note title
|
||||||
# [[A note about cats|this is a link to the note about cats]]
|
# [[A note about cats|this is a link to the note about cats]]
|
||||||
current_note.content = current_note.content.gsub(
|
current_note.content.gsub!(
|
||||||
/\[\[#{title_from_filename}\|(.+?)(?=\])\]\]/i,
|
/\[\[#{title_from_filename}\|(.+?)(?=\])\]\]/i,
|
||||||
anchor_tag
|
anchor_tag
|
||||||
)
|
)
|
||||||
|
|
||||||
# Replace double-bracketed links with label using note filename
|
# Replace double-bracketed links with label using note filename
|
||||||
# [[cats|this is a link to the note about cats]]
|
# [[cats|this is a link to the note about cats]]
|
||||||
current_note.content = current_note.content.gsub(
|
current_note.content.gsub!(
|
||||||
/\[\[#{note_potentially_linked_to.data['title']}\|(.+?)(?=\])\]\]/i,
|
/\[\[#{note_potentially_linked_to.data['title']}\|(.+?)(?=\])\]\]/i,
|
||||||
anchor_tag
|
anchor_tag
|
||||||
)
|
)
|
||||||
|
|
||||||
# Replace double-bracketed links using note title
|
# Replace double-bracketed links using note title
|
||||||
# [[a note about cats]]
|
# [[a note about cats]]
|
||||||
current_note.content = current_note.content.gsub(
|
current_note.content.gsub!(
|
||||||
/\[\[(#{note_potentially_linked_to.data['title']})\]\]/i,
|
/\[\[(#{note_potentially_linked_to.data['title']})\]\]/i,
|
||||||
anchor_tag
|
anchor_tag
|
||||||
)
|
)
|
||||||
|
|
||||||
# Replace double-bracketed links using note filename
|
# Replace double-bracketed links using note filename
|
||||||
# [[cats]]
|
# [[cats]]
|
||||||
current_note.content = current_note.content.gsub(
|
current_note.content.gsub!(
|
||||||
/\[\[(#{title_from_filename})\]\]/i,
|
/\[\[(#{title_from_filename})\]\]/i,
|
||||||
anchor_tag
|
anchor_tag
|
||||||
)
|
)
|
||||||
@ -55,7 +55,7 @@ class BidirectionalLinksGenerator < Jekyll::Generator
|
|||||||
# At this point, all remaining double-bracket-wrapped words are
|
# At this point, all remaining double-bracket-wrapped words are
|
||||||
# pointing to non-existing pages, so let's turn them into disabled
|
# pointing to non-existing pages, so let's turn them into disabled
|
||||||
# links by greying them out and changing the cursor
|
# links by greying them out and changing the cursor
|
||||||
current_note.content = current_note.content.gsub(
|
current_note.content.gsub!(
|
||||||
/\[\[(.*)\]\]/i, # match on the remaining double-bracket links
|
/\[\[(.*)\]\]/i, # match on the remaining double-bracket links
|
||||||
<<~HTML.chomp # replace with this HTML (\\1 is what was inside the brackets)
|
<<~HTML.chomp # replace with this HTML (\\1 is what was inside the brackets)
|
||||||
<span title='There is no note that matches this link.' class='invalid-link'>
|
<span title='There is no note that matches this link.' class='invalid-link'>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user