1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-11 17:51:01 +00:00

refactor(readability): minor code folding

This commit is contained in:
jvoisin 2025-07-10 17:16:50 +02:00 committed by Frédéric Guillot
parent 20825a92c5
commit 2d24f5d04e

View file

@ -153,8 +153,7 @@ func getArticle(topCandidate *candidate, candidates candidateList) string {
} else { } else {
if linkDensity == 0 { if linkDensity == 0 {
// It's a small selection, so .Text doesn't impact performances too much. // It's a small selection, so .Text doesn't impact performances too much.
content := s.Text() if containsSentence(s.Text()) {
if containsSentence(content) {
append = true append = true
} }
} }
@ -300,7 +299,7 @@ func scoreNode(s *goquery.Selection) *candidate {
return c return c
} }
switch s.Get(0).DataAtom.String() { switch s.Get(0).Data {
case "div": case "div":
c.score += 5 c.score += 5
case "pre", "td", "blockquote", "img": case "pre", "td", "blockquote", "img":
@ -363,8 +362,7 @@ func transformMisusedDivsIntoParagraphs(document *goquery.Document) {
nodes := s.Children().Nodes nodes := s.Children().Nodes
if len(nodes) == 0 { if len(nodes) == 0 {
node := s.Get(0) s.Nodes[0].Data = "p"
node.Data = "p"
return return
} }
@ -375,8 +373,7 @@ func transformMisusedDivsIntoParagraphs(document *goquery.Document) {
"table", "ul": "table", "ul":
return return
default: default:
currentNode := s.Get(0) s.Nodes[0].Data = "p"
currentNode.Data = "p"
} }
} }
}) })