[GITEA] Fix orgmode link resolver for text descriptions
- It's possible that the description of an `Regularlink` is `Text` and not another `Regularlink`. Therefor if it's `Text`, convert it to an `Regularlink` trough the 'old' behavior (pass it trough `org.String` and trim `file:` prefix). - Adds unit tests. - Resolves https://codeberg.org/Codeberg/Community/issues/1430 (cherry picked from commit 385fc6ee6be25859066a716aa15be09991e2d33c)
This commit is contained in:
parent
fde08f91fd
commit
2ed825c5be
2 changed files with 14 additions and 3 deletions
|
@ -80,6 +80,12 @@ func TestRender_Media(t *testing.T) {
|
|||
`<p><img src="https://example.com/example.svg" alt="https://example.com/example.svg" /></p>`)
|
||||
test("[[https://example.com/example.mp4]]",
|
||||
`<p><video src="https://example.com/example.mp4">https://example.com/example.mp4</video></p>`)
|
||||
|
||||
// Text description.
|
||||
test("[[file:./lem-post.png][file:./lem-post.png]]",
|
||||
`<p><a href="http://localhost:3000/gogits/gogs/lem-post.png"><img src="http://localhost:3000/gogits/gogs/lem-post.png" alt="http://localhost:3000/gogits/gogs/lem-post.png" /></a></p>`)
|
||||
test("[[file:./lem-post.mp4][file:./lem-post.mp4]]",
|
||||
`<p><a href="http://localhost:3000/gogits/gogs/lem-post.mp4"><video src="http://localhost:3000/gogits/gogs/lem-post.mp4">http://localhost:3000/gogits/gogs/lem-post.mp4</video></a></p>`)
|
||||
}
|
||||
|
||||
func TestRender_Source(t *testing.T) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue