Fix some edge cases; closes #3232

- Fixes wrong usage of AppURL
- Fixes wrong rendering with extra path segments when AppSubURL is empty
- Now also renders all links when 2+ permalinks are present
This commit is contained in:
Mai-Lapyst 2024-04-17 12:44:17 +02:00
parent e4aa7bd511
commit 5b6b3f3fb3
No known key found for this signature in database
GPG key ID: F88D929C09E239F8
3 changed files with 191 additions and 79 deletions

View file

@ -1063,19 +1063,20 @@ func filePreviewPatternProcessor(ctx *RenderContext, node *html.Node) {
return
}
locale := translation.NewLocale("en-US")
if ctx.Ctx != nil {
ctxLocale, ok := ctx.Ctx.Value(translation.ContextKey).(translation.Locale)
if ok {
locale = ctxLocale
}
}
next := node.NextSibling
for node != nil && node != next {
locale := translation.NewLocale("en-US")
if ctx.Ctx != nil {
ctxLocale, ok := ctx.Ctx.Value(translation.ContextKey).(translation.Locale)
if ok {
locale = ctxLocale
}
}
preview := NewFilePreview(ctx, node, locale)
if preview == nil {
return
node = node.NextSibling
continue
}
previewNode := preview.CreateHTML(locale)