mirror of
https://github.com/monero-project/monero-site.git
synced 2024-12-04 15:41:11 +02:00
moneropedia.rb: replace hyperlink text with regex match
This commit is contained in:
parent
f4d135a6fc
commit
06bb8b9ea6
@ -120,14 +120,14 @@ module Jekyll
|
||||
if lang != "en"
|
||||
@@moneropedia[lang].each do |entry|
|
||||
entry[:terms].each do |term|
|
||||
content = content.gsub(/(\@#{term})((?=-#{lookahead})|(?![\w-]))/i, '<a class="info-tooltip" data-tooltip="' + entry[:summary] + '" href="/' + lang + '/resources/moneropedia/' + entry[:file] + '.html" >' + term.gsub('-',' ') + '</a>')
|
||||
content = content.gsub(/(\@#{term})((?=-#{lookahead})|(?![\w-]))/i) { |match_term| '<a class="info-tooltip" data-tooltip="' + entry[:summary] + '" href="/' + lang + '/resources/moneropedia/' + entry[:file] + '.html" >' + match_term.gsub(/[@-]/, '@' => '', '-' => ' ') + '</a>' }
|
||||
end
|
||||
end
|
||||
end
|
||||
# For English and as a default (in case an entry has been forgotten in a non-English moneropedia folder)
|
||||
@@moneropedia["en"].each do |entry|
|
||||
entry[:terms].each do |term|
|
||||
content = content.gsub(/(\@#{term})((?=-#{lookahead})|(?![\w-]))/i, '<a class="info-tooltip" data-tooltip="' + entry[:summary] + '" href="/resources/moneropedia/' + entry[:file] + '.html" >' + term.gsub('-',' ') + '</a>')
|
||||
content = content.gsub(/(\@#{term})((?=-#{lookahead})|(?![\w-]))/i) { |match_term| '<a class="info-tooltip" data-tooltip="' + entry[:summary] + '" href="/resources/moneropedia/' + entry[:file] + '.html" >' + match_term.gsub(/[@-]/, '@' => '', '-' => ' ') + '</a>' }
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -136,4 +136,4 @@ module Jekyll
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user