File tree Expand file tree Collapse file tree 2 files changed +24
-9
lines changed
Expand file tree Collapse file tree 2 files changed +24
-9
lines changed Original file line number Diff line number Diff line change @@ -98,15 +98,7 @@ def linkify(text, mode = :urls)
9898 private
9999
100100 def gsub_pairs_for_linkify_detection
101- Array
102- . wrap ( Settings . linkify &.detection_rules )
103- . select { |rule | rule . path_template && rule . patterns . is_a? ( Array ) }
104- . flat_map do |rule |
105- expanded_path = "#{ rule . host || "#{ Settings . server_protocol } ://#{ Settings . server_url } " } /#{ rule . path_template } "
106- rule . patterns
107- . select { |pattern | pattern . is_a? ( String ) }
108- . map { |pattern | [ Regexp . new ( "(?<=^|#{ URL_UNSAFE_CHARS } )#{ pattern } " , Regexp ::IGNORECASE ) , expanded_path ] }
109- end
101+ [ ]
110102 end
111103
112104 def expand_link_shorthands ( text )
@@ -279,5 +271,19 @@ def to_html
279271 def to_text
280272 to_s
281273 end
274+
275+ private
276+
277+ def gsub_pairs_for_linkify_detection
278+ Array
279+ . wrap ( Settings . linkify &.detection_rules )
280+ . select { |rule | rule . path_template && rule . patterns . is_a? ( Array ) }
281+ . flat_map do |rule |
282+ expanded_path = "#{ rule . host || "#{ Settings . server_protocol } ://#{ Settings . server_url } " } /#{ rule . path_template } "
283+ rule . patterns
284+ . select { |pattern | pattern . is_a? ( String ) }
285+ . map { |pattern | [ Regexp . new ( "(?<=^|#{ URL_UNSAFE_CHARS } )#{ pattern } " , Regexp ::IGNORECASE ) , expanded_path ] }
286+ end
287+ end
282288 end
283289end
Original file line number Diff line number Diff line change @@ -491,6 +491,15 @@ def test_text_to_html_linkify_no_year_misinterpretation
491491 end
492492 end
493493
494+ def test_deactivated_linkify_expansion_in_markdown
495+ t0 = "foo `surface=metal` bar"
496+
497+ r1 = RichText . new ( "markdown" , t0 )
498+ t1 = Nokogiri ::HTML . fragment ( r1 . to_html ) . text
499+
500+ assert_equal t0 . delete ( "`" ) , t1 . strip
501+ end
502+
494503 def test_text_to_html_email
495504 r = RichText . new ( "text" , "foo [email protected] bar" ) 496505 assert_html r do
You can’t perform that action at this time.
0 commit comments