mirror of
https://github.com/monero-project/monero-site.git
synced 2024-11-16 15:58:16 +00:00
moneropedia.rb: replace hyperlink text with regex match
This commit is contained in:
parent
f4d135a6fc
commit
06bb8b9ea6
1 changed files with 3 additions and 3 deletions
|
@ -120,14 +120,14 @@ module Jekyll
|
||||||
if lang != "en"
|
if lang != "en"
|
||||||
@@moneropedia[lang].each do |entry|
|
@@moneropedia[lang].each do |entry|
|
||||||
entry[:terms].each do |term|
|
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
|
end
|
||||||
end
|
end
|
||||||
# For English and as a default (in case an entry has been forgotten in a non-English moneropedia folder)
|
# For English and as a default (in case an entry has been forgotten in a non-English moneropedia folder)
|
||||||
@@moneropedia["en"].each do |entry|
|
@@moneropedia["en"].each do |entry|
|
||||||
entry[:terms].each do |term|
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue