mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	Render email addresses as such if followed by punctuation (#27987)
Added the following characters to the regular expression for the email: - , - ; - ? - ! Also added a test case. - Fixes #27616 # Before  # After  Signed-off-by: Yarden Shoham <git@yardenshoham.com>
This commit is contained in:
		@@ -66,7 +66,7 @@ var (
 | 
			
		||||
	// well as the HTML5 spec:
 | 
			
		||||
	//   http://spec.commonmark.org/0.28/#email-address
 | 
			
		||||
	//   https://html.spec.whatwg.org/multipage/input.html#e-mail-state-(type%3Demail)
 | 
			
		||||
	emailRegex = regexp.MustCompile("(?:\\s|^|\\(|\\[)([a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9]{2,}(?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+)(?:\\s|$|\\)|\\]|\\.(\\s|$))")
 | 
			
		||||
	emailRegex = regexp.MustCompile("(?:\\s|^|\\(|\\[)([a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9]{2,}(?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+)(?:\\s|$|\\)|\\]|;|,|\\?|!|\\.(\\s|$))")
 | 
			
		||||
 | 
			
		||||
	// blackfriday extensions create IDs like fn:user-content-footnote
 | 
			
		||||
	blackfridayExtRegex = regexp.MustCompile(`[^:]*:user-content-`)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user