Skip to content

Commit b678128

Browse files
committed
fix(alertgenerator): Fix slug parsing logic in custom tips when there is a space between % and slug keyword
1 parent 838d290 commit b678128

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

_plugins/alert_generator.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def createAlert(alertType, content)
2020
sub_string.each do |s|
2121
# puts("s - #{s} ; s1 - #{s[1]}; replaced - #{s[1].gsub(/(^>)/, "")}")
2222
block ="<blockquote class='#{alertType}'>" + @converter.convert(s[1].gsub(/(^>)/x, "")) + "</blockquote>"
23-
slugsInBlock = block.scan(/.*?(%7[Bb]%slug%20([0-9a-zA-Z_\-\(\)\*\.\/\,\%\'\?\:]+)%{2}7[Dd])/)
23+
slugsInBlock = block.scan(/.*?(%7[Bb]%(?:%20){0,}slug(?:%20){1,}([0-9a-zA-Z_\-\(\)\*\.\/\,\%\'\?\:]+)(?:%20){0,}%{2}7[Dd])/)
2424
if slugsInBlock.count > 0
2525
slugsInBlock.each do |slug|
2626
targetPage = @site.pages.find {|p| p.data['slug'] == slug[1]}

0 commit comments

Comments
 (0)