-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
fix media description render for orgmode #26895
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
description := strings.TrimPrefix(org.String(l.Description...), "file:") | ||
imageSrc := getMediaURL([]byte(description)) | ||
fmt.Fprintf(r, `<a href="%s"><img src="%s" alt="%s" /></a>`, link, imageSrc, imageSrc) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am thoroughly confused by these changes.
I'd interpret description
as alt
or title
attribute or something like that (which is already present).
But not as an external link that wraps the image.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are from the "official" org package. org/html_writer.go#L406-L427
I would prefer to leave a comment there to tell readers why the code is written as this, where they are copied from.
aff2753
to
65dd90c
Compare
- In org mode you can specify an description for media via the following syntax `[[description][media link]]`. The description is then used as title or alt. - This patch fixes the rendering of the description by seperating the description and non-description cases and using `org.String()`. - Added unit tests. - Inspired by https://github.com/niklasfasching/go-org/blob/6eb20dbda93cb88c3503f7508dc78cbbc639378f/org/html_writer.go#L406-L427 - Resolves https://codeberg.org/Codeberg/Community/issues/848 (cherry picked from commit 8b8aab83113b34bade61964e2097ed497abc39e9)
65dd90c
to
516318a
Compare
* giteaofficial/main: fix media description render for orgmode (go-gitea#26895) Show OpenID Connect and OAuth on signup page (go-gitea#20242) Update status and code index after changing the default branch (go-gitea#27018) add sparse url in cargo package guide (go-gitea#26937) Add missing 404 response to Swagger (go-gitea#27038) Fix object storage path handling (go-gitea#27024) [skip ci] Updated translations via Crowdin bump rootful to 16gb setup go in the nightly release pipeline Speed up nightly builds (go-gitea#27045) Improve repo/user/org search (go-gitea#27030) Use Actuated.dev runner for nightly builds update snap package (go-gitea#27021) resolve issue with sort icons on admin/users and admin/runners (go-gitea#24360)
[[description][media link]]
. The description is then used as title or alt.org.String()
.(cherry picked from commit 8b8aab83113b34bade61964e2097ed497abc39e9)