Parse HTML in trending link card descriptions
This commit is contained in:
parent
2933ac491b
commit
1eab964c0b
|
@ -9,6 +9,7 @@
|
||||||
import UIKit
|
import UIKit
|
||||||
import Pachyderm
|
import Pachyderm
|
||||||
import WebURLFoundationExtras
|
import WebURLFoundationExtras
|
||||||
|
import SwiftSoup
|
||||||
|
|
||||||
class TrendingLinkCardCollectionViewCell: UICollectionViewCell {
|
class TrendingLinkCardCollectionViewCell: UICollectionViewCell {
|
||||||
|
|
||||||
|
@ -55,7 +56,7 @@ class TrendingLinkCardCollectionViewCell: UICollectionViewCell {
|
||||||
let provider = card.providerName!.trimmingCharacters(in: .whitespacesAndNewlines)
|
let provider = card.providerName!.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||||
providerLabel.text = provider
|
providerLabel.text = provider
|
||||||
|
|
||||||
let description = card.description.trimmingCharacters(in: .whitespacesAndNewlines)
|
let description = try! SwiftSoup.parseBodyFragment(card.description).text()
|
||||||
descriptionLabel.text = description
|
descriptionLabel.text = description
|
||||||
descriptionLabel.isHidden = description.isEmpty
|
descriptionLabel.isHidden = description.isEmpty
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ import UIKit
|
||||||
import Pachyderm
|
import Pachyderm
|
||||||
import SafariServices
|
import SafariServices
|
||||||
import WebURLFoundationExtras
|
import WebURLFoundationExtras
|
||||||
|
import SwiftSoup
|
||||||
|
|
||||||
class StatusCardView: UIView {
|
class StatusCardView: UIView {
|
||||||
|
|
||||||
|
@ -156,7 +157,7 @@ class StatusCardView: UIView {
|
||||||
titleLabel.text = title
|
titleLabel.text = title
|
||||||
titleLabel.isHidden = title.isEmpty
|
titleLabel.isHidden = title.isEmpty
|
||||||
|
|
||||||
let description = card.description.trimmingCharacters(in: .whitespacesAndNewlines)
|
let description = try! SwiftSoup.parseBodyFragment(card.description).text()
|
||||||
descriptionLabel.text = description
|
descriptionLabel.text = description
|
||||||
descriptionLabel.isHidden = description.isEmpty
|
descriptionLabel.isHidden = description.isEmpty
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue