1- require ' redcarpet'
1+ require " redcarpet"
22class CustomRenderer < Redcarpet ::Render ::HTML
33 def initialize ( circuit_embed : false , video_embed : false , user_tagging : false )
44 @circuit_embed = circuit_embed
@@ -9,15 +9,15 @@ def initialize(circuit_embed: false, video_embed: false, user_tagging: false)
99
1010 def image ( url , title , alt_text )
1111 case alt_text
12- when ' Circuit'
12+ when " Circuit"
1313 if @circuit_embed
1414 "<iframe width=\" 540\" height=\" 300\" src=\" #{ url } \" frameborder=\" 0\" ></iframe><br>"
1515 else
1616 "<img src=\" #{ url } \" alt=\" #{ alt_text } \" title=\" #{ title } \" ><br>"
1717 end
18- when ' Video'
18+ when " Video"
1919 if @video_embed
20- video_id = url . split ( 'v=' ) [ 1 ] . split ( '&' ) [ 0 ]
20+ video_id = url . split ( "v=" ) [ 1 ] . split ( "&" ) [ 0 ]
2121 "<iframe width=\" 540\" height=\" 300\" src=\" https://www.youtube.com/embed/#{ video_id } \" frameborder=\" 0\" allowfullscreen></iframe><br>"
2222 else
2323 "<img src=\" #{ url } \" alt=\" #{ alt_text } \" title=\" #{ title } \" ><br>"
@@ -29,11 +29,11 @@ def image(url, title, alt_text)
2929 end
3030
3131 def link ( link , _title , content )
32- if @user_tagging && link . start_with? ( ' /users/' )
32+ if @user_tagging && link . start_with? ( " /users/" )
3333 uri = URI . parse ( link )
3434 uri . path =~ %r{^/users/\d +/?$}
3535 # remove the brackets from the content
36- content = content . gsub ( /[()]/ , '' )
36+ content = content . gsub ( /[()]/ , "" )
3737 "<a class='tag-user' target='_blank' href=\" #{ link } \" >#{ content } </a>"
3838 else
3939 "<a href=\" #{ link } \" >#{ content } </a>"
0 commit comments