mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-26 12:27:06 +00:00 
			
		
		
		
	Backport #31420 by charles7668 Co-authored-by: charles <30816317+charles7668@users.noreply.github.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
		| @@ -542,6 +542,10 @@ func TestMathBlock(t *testing.T) { | |||||||
| 			"$$a$$", | 			"$$a$$", | ||||||
| 			`<pre class="code-block is-loading"><code class="chroma language-math display">a</code></pre>` + nl, | 			`<pre class="code-block is-loading"><code class="chroma language-math display">a</code></pre>` + nl, | ||||||
| 		}, | 		}, | ||||||
|  | 		{ | ||||||
|  | 			"$a$ ($b$) [$c$] {$d$}", | ||||||
|  | 			`<p><code class="language-math is-loading">a</code> (<code class="language-math is-loading">b</code>) [$c$] {$d$}</p>` + nl, | ||||||
|  | 		}, | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	for _, test := range testcases { | 	for _, test := range testcases { | ||||||
|   | |||||||
| @@ -45,6 +45,10 @@ func isPunctuation(b byte) bool { | |||||||
| 	return b == '.' || b == '!' || b == '?' || b == ',' || b == ';' || b == ':' | 	return b == '.' || b == '!' || b == '?' || b == ',' || b == ';' || b == ':' | ||||||
| } | } | ||||||
|  |  | ||||||
|  | func isBracket(b byte) bool { | ||||||
|  | 	return b == ')' | ||||||
|  | } | ||||||
|  |  | ||||||
| func isAlphanumeric(b byte) bool { | func isAlphanumeric(b byte) bool { | ||||||
| 	return (b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z') || (b >= '0' && b <= '9') | 	return (b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z') || (b >= '0' && b <= '9') | ||||||
| } | } | ||||||
| @@ -84,7 +88,7 @@ func (parser *inlineParser) Parse(parent ast.Node, block text.Reader, pc parser. | |||||||
| 			break | 			break | ||||||
| 		} | 		} | ||||||
| 		suceedingCharacter := line[pos] | 		suceedingCharacter := line[pos] | ||||||
| 		if !isPunctuation(suceedingCharacter) && !(suceedingCharacter == ' ') { | 		if !isPunctuation(suceedingCharacter) && !(suceedingCharacter == ' ') && !isBracket(suceedingCharacter) { | ||||||
| 			return nil | 			return nil | ||||||
| 		} | 		} | ||||||
| 		if line[ender-1] != '\\' { | 		if line[ender-1] != '\\' { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Giteabot
					Giteabot