1
- require ' redcarpet'
1
+ require " redcarpet"
2
2
class CustomRenderer < Redcarpet ::Render ::HTML
3
3
def initialize ( circuit_embed : false , video_embed : false , user_tagging : false )
4
4
@circuit_embed = circuit_embed
@@ -9,15 +9,15 @@ def initialize(circuit_embed: false, video_embed: false, user_tagging: false)
9
9
10
10
def image ( url , title , alt_text )
11
11
case alt_text
12
- when ' Circuit'
12
+ when " Circuit"
13
13
if @circuit_embed
14
14
"<iframe width=\" 540\" height=\" 300\" src=\" #{ url } \" frameborder=\" 0\" ></iframe><br>"
15
15
else
16
16
"<img src=\" #{ url } \" alt=\" #{ alt_text } \" title=\" #{ title } \" ><br>"
17
17
end
18
- when ' Video'
18
+ when " Video"
19
19
if @video_embed
20
- video_id = url . split ( 'v=' ) [ 1 ] . split ( '&' ) [ 0 ]
20
+ video_id = url . split ( "v=" ) [ 1 ] . split ( "&" ) [ 0 ]
21
21
"<iframe width=\" 540\" height=\" 300\" src=\" https://www.youtube.com/embed/#{ video_id } \" frameborder=\" 0\" allowfullscreen></iframe><br>"
22
22
else
23
23
"<img src=\" #{ url } \" alt=\" #{ alt_text } \" title=\" #{ title } \" ><br>"
@@ -29,11 +29,11 @@ def image(url, title, alt_text)
29
29
end
30
30
31
31
def link ( link , _title , content )
32
- if @user_tagging && link . start_with? ( ' /users/' )
32
+ if @user_tagging && link . start_with? ( " /users/" )
33
33
uri = URI . parse ( link )
34
34
uri . path =~ %r{^/users/\d +/?$}
35
35
# remove the brackets from the content
36
- content = content . gsub ( /[()]/ , '' )
36
+ content = content . gsub ( /[()]/ , "" )
37
37
"<a class='tag-user' target='_blank' href=\" #{ link } \" >#{ content } </a>"
38
38
else
39
39
"<a href=\" #{ link } \" >#{ content } </a>"
0 commit comments