Skip to content

Commit c64639f

Browse files
authored
Merge branch 'main' into delay_lang
2 parents d1633b9 + d5cfcf8 commit c64639f

File tree

9 files changed

+23
-48
lines changed

9 files changed

+23
-48
lines changed

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ require (
1212
github.com/lib/pq v1.10.9
1313
github.com/prometheus/client_golang v1.20.5
1414
github.com/tdewolff/minify/v2 v2.21.2
15-
github.com/yuin/goldmark v1.7.8
1615
golang.org/x/crypto v0.30.0
1716
golang.org/x/net v0.32.0
1817
golang.org/x/oauth2 v0.24.0

go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@ github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcY
6666
github.com/xyproto/randomstring v1.0.5 h1:YtlWPoRdgMu3NZtP45drfy1GKoojuR7hmRcnhZqKjWU=
6767
github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E=
6868
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
69-
github.com/yuin/goldmark v1.7.8 h1:iERMLn0/QJeHFhxSt3p6PeN9mGnvIKSpG9YYorDMnic=
70-
github.com/yuin/goldmark v1.7.8/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E=
7169
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
7270
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
7371
golang.org/x/crypto v0.30.0 h1:RwoQn3GkWiMkzlX562cLB7OxWvjH1L8xutO2WoJcRoY=

internal/locale/catalog_test.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,26 @@ func TestMissingTranslations(t *testing.T) {
9090
}
9191

9292
func TestTranslationFilePluralForms(t *testing.T) {
93+
var numberOfPluralFormsPerLanguage = map[string]int{
94+
"en_US": 2,
95+
"es_ES": 2,
96+
"fr_FR": 2,
97+
"de_DE": 2,
98+
"pl_PL": 3,
99+
"pt_BR": 2,
100+
"zh_CN": 1,
101+
"zh_TW": 1,
102+
"nl_NL": 2,
103+
"ru_RU": 3,
104+
"it_IT": 2,
105+
"ja_JP": 1,
106+
"tr_TR": 2,
107+
"el_EL": 2,
108+
"fi_FI": 2,
109+
"hi_IN": 2,
110+
"uk_UA": 3,
111+
"id_ID": 1,
112+
}
93113
for language := range AvailableLanguages {
94114
messages, err := loadTranslationFile(language)
95115
if err != nil {

internal/locale/locale.go

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,6 @@
33

44
package locale // import "miniflux.app/v2/internal/locale"
55

6-
var numberOfPluralFormsPerLanguage = map[string]int{
7-
"en_US": 2,
8-
"es_ES": 2,
9-
"fr_FR": 2,
10-
"de_DE": 2,
11-
"pl_PL": 3,
12-
"pt_BR": 2,
13-
"zh_CN": 1,
14-
"zh_TW": 1,
15-
"nl_NL": 2,
16-
"ru_RU": 3,
17-
"it_IT": 2,
18-
"ja_JP": 1,
19-
"tr_TR": 2,
20-
"el_EL": 2,
21-
"fi_FI": 2,
22-
"hi_IN": 2,
23-
"uk_UA": 3,
24-
"id_ID": 1,
25-
}
26-
276
// AvailableLanguages is the list of available languages.
287
var AvailableLanguages = map[string]string{
298
"en_US": "English",

internal/locale/translations/zh_CN.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@
211211
"page.settings.webauthn.last_seen_on": "最后使用时间",
212212
"page.settings.webauthn.register": "注册 Passkey",
213213
"page.settings.webauthn.register.error": "无法注册 Passkey",
214-
"page.login.webauthn_login.help": "Please enter your username if you're using a security key. This is not required if you are using a Passkey (discoverable credentials).",
214+
"page.login.webauthn_login.help": "如果您正在使用安全密钥,请输入您的用户名。如果您正在使用通行密钥(可发现凭证),则无需输入用户名。",
215215
"page.settings.webauthn.delete": [
216216
"删除 %d 个 Passkey"
217217
],

internal/reader/rewrite/rewrite_functions.go

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ import (
1717
nethtml "golang.org/x/net/html"
1818

1919
"github.com/PuerkitoBio/goquery"
20-
"github.com/yuin/goldmark"
21-
goldmarkhtml "github.com/yuin/goldmark/renderer/html"
2220
)
2321

2422
var (
@@ -410,21 +408,6 @@ func addHackerNewsLinksUsing(entryContent, app string) string {
410408
return entryContent
411409
}
412410

413-
func parseMarkdown(entryContent string) string {
414-
var sb strings.Builder
415-
md := goldmark.New(
416-
goldmark.WithRendererOptions(
417-
goldmarkhtml.WithUnsafe(),
418-
),
419-
)
420-
421-
if err := md.Convert([]byte(entryContent), &sb); err != nil {
422-
return entryContent
423-
}
424-
425-
return sb.String()
426-
}
427-
428411
func removeTables(entryContent string) string {
429412
doc, err := goquery.NewDocumentFromReader(strings.NewReader(entryContent))
430413
if err != nil {

internal/reader/rewrite/rewriter.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,6 @@ func (rule rule) applyRule(entryURL string, entry *model.Entry) {
9191
entry.Content = addHackerNewsLinksUsing(entry.Content, "hack")
9292
case "add_hn_links_using_opener":
9393
entry.Content = addHackerNewsLinksUsing(entry.Content, "opener")
94-
case "parse_markdown":
95-
entry.Content = parseMarkdown(entry.Content)
9694
case "remove_tables":
9795
entry.Content = removeTables(entry.Content)
9896
case "remove_clickbait":

internal/reader/rewrite/rules.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ var predefinedRules = map[string]string{
3535
"treelobsters.com": "add_image_title",
3636
"webtoons.com": `add_dynamic_image,replace("webtoon"|"swebtoon")`,
3737
"www.qwantz.com": "add_image_title,add_mailto_subject",
38-
"www.recalbox.com": "parse_markdown",
3938
"xkcd.com": "add_image_title",
4039
"youtube.com": "add_youtube_video",
4140
}

internal/reader/sanitizer/sanitizer.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
package sanitizer // import "miniflux.app/v2/internal/reader/sanitizer"
55

66
import (
7-
"fmt"
87
"io"
98
"regexp"
109
"slices"
@@ -19,7 +18,7 @@ import (
1918
)
2019

2120
var (
22-
youtubeEmbedRegex = regexp.MustCompile(`//(?:www\.)?youtube\.com/embed/(.+)$`)
21+
youtubeEmbedRegex = regexp.MustCompile(`^(?:https?:)?//(?:www\.)?youtube\.com/embed/(.+)$`)
2322
tagAllowList = map[string][]string{
2423
"a": {"href", "title", "id"},
2524
"abbr": {"title"},
@@ -221,7 +220,7 @@ func sanitizeAttributes(baseURL, tagName string, attributes []html.Attribute) ([
221220
}
222221

223222
attrNames = append(attrNames, attribute.Key)
224-
htmlAttrs = append(htmlAttrs, fmt.Sprintf(`%s=%q`, attribute.Key, html.EscapeString(value)))
223+
htmlAttrs = append(htmlAttrs, attribute.Key+`="`+html.EscapeString(value)+`"`)
225224
}
226225

227226
if !isAnchorLink {

0 commit comments

Comments
 (0)