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:
parent
49d2596fc6
commit
8b6dd3e599
2 changed files with 19 additions and 18 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue