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

Keep other table rows and columns

This commit is contained in:
Jake Walker 2023-04-01 10:02:58 +01:00 committed by Frédéric Guillot
parent 49d2596fc6
commit 8b6dd3e599
2 changed files with 19 additions and 18 deletions

View file

@ -342,25 +342,26 @@ func removeTables(entryContent string) string {
return entryContent
}
var table *goquery.Selection
selectors := []string{"table", "tbody", "thead", "td", "th", "td"}
for {
table = doc.Find("table").First()
var loopElement *goquery.Selection
if table.Length() == 0 {
break
for _, selector := range selectors {
for {
loopElement = doc.Find(selector).First()
if loopElement.Length() == 0 {
break
}
innerHtml, err := loopElement.Html()
if err != nil {
break
}
loopElement.Parent().AppendHtml(innerHtml)
loopElement.Remove()
}
td := table.Find("td").First()
if td.Length() == 0 {
break
}
tdHtml, _ := td.Html()
table.Parent().AppendHtml(tdHtml)
table.Remove()
}
output, _ := doc.Find("body").First().Html()