mirror of
https://github.com/miniflux/v2.git
synced 2025-08-06 17:41:00 +00:00
refactor(readability): minor code folding
This commit is contained in:
parent
20825a92c5
commit
2d24f5d04e
1 changed files with 4 additions and 7 deletions
|
@ -153,8 +153,7 @@ func getArticle(topCandidate *candidate, candidates candidateList) string {
|
|||
} else {
|
||||
if linkDensity == 0 {
|
||||
// It's a small selection, so .Text doesn't impact performances too much.
|
||||
content := s.Text()
|
||||
if containsSentence(content) {
|
||||
if containsSentence(s.Text()) {
|
||||
append = true
|
||||
}
|
||||
}
|
||||
|
@ -300,7 +299,7 @@ func scoreNode(s *goquery.Selection) *candidate {
|
|||
return c
|
||||
}
|
||||
|
||||
switch s.Get(0).DataAtom.String() {
|
||||
switch s.Get(0).Data {
|
||||
case "div":
|
||||
c.score += 5
|
||||
case "pre", "td", "blockquote", "img":
|
||||
|
@ -363,8 +362,7 @@ func transformMisusedDivsIntoParagraphs(document *goquery.Document) {
|
|||
nodes := s.Children().Nodes
|
||||
|
||||
if len(nodes) == 0 {
|
||||
node := s.Get(0)
|
||||
node.Data = "p"
|
||||
s.Nodes[0].Data = "p"
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -375,8 +373,7 @@ func transformMisusedDivsIntoParagraphs(document *goquery.Document) {
|
|||
"table", "ul":
|
||||
return
|
||||
default:
|
||||
currentNode := s.Get(0)
|
||||
currentNode.Data = "p"
|
||||
s.Nodes[0].Data = "p"
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue