mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-01-13 02:25:34 +00:00
Merge pull request '[GITEA] Require Latex code to have a end sequence' (#1822) from Gusted/forgejo:forgejo-math-require-end into forgejo-dependency
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/1822
This commit is contained in:
commit
1bd2a27823
2 changed files with 13 additions and 4 deletions
|
@ -510,6 +510,18 @@ 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\]`,
|
||||||
|
`<pre class="code-block is-loading"><code class="chroma language-math display">a b</code></pre>` + nl,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
`\[a b]`,
|
||||||
|
`<p>[a b]</p>` + nl,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
`$$a`,
|
||||||
|
`<p>$$a</p>` + nl,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testcases {
|
for _, test := range testcases {
|
||||||
|
|
|
@ -55,10 +55,7 @@ func (b *blockParser) Open(parent ast.Node, reader text.Reader, pc parser.Contex
|
||||||
return node, parser.Close | parser.NoChildren
|
return node, parser.Close | parser.NoChildren
|
||||||
}
|
}
|
||||||
|
|
||||||
reader.Advance(segment.Len() - 1)
|
return nil, parser.NoChildren
|
||||||
segment.Start += 2
|
|
||||||
node.Lines().Append(segment)
|
|
||||||
return node, parser.NoChildren
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Continue parses the current line and returns a result of parsing.
|
// Continue parses the current line and returns a result of parsing.
|
||||||
|
|
Loading…
Reference in a new issue