mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Add context menu for Fullscreen mode actions. Issue #1344
This commit is contained in:
@@ -92,6 +92,50 @@ extension Article {
|
||||
|
||||
return FaviconGenerator.favicon(webFeed)
|
||||
}
|
||||
|
||||
func byline() -> String {
|
||||
guard let authors = authors ?? webFeed?.authors, !authors.isEmpty else {
|
||||
return ""
|
||||
}
|
||||
|
||||
// If the author's name is the same as the feed, then we don't want to display it.
|
||||
// This code assumes that multiple authors would never match the feed name so that
|
||||
// if there feed owner has an article co-author all authors are given the byline.
|
||||
if authors.count == 1, let author = authors.first {
|
||||
if author.name == webFeed?.nameForDisplay {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
var byline = ""
|
||||
var isFirstAuthor = true
|
||||
|
||||
for author in authors {
|
||||
if !isFirstAuthor {
|
||||
byline += ", "
|
||||
}
|
||||
isFirstAuthor = false
|
||||
|
||||
if let emailAddress = author.emailAddress, emailAddress.contains(" ") {
|
||||
byline += emailAddress // probably name plus email address
|
||||
}
|
||||
else if let name = author.name, let emailAddress = author.emailAddress {
|
||||
byline += "\(name) <\(emailAddress)>"
|
||||
}
|
||||
else if let name = author.name {
|
||||
byline += name
|
||||
}
|
||||
else if let emailAddress = author.emailAddress {
|
||||
byline += "<\(emailAddress)>"
|
||||
}
|
||||
else if let url = author.url {
|
||||
byline += url
|
||||
}
|
||||
}
|
||||
|
||||
return byline
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: Path
|
||||
|
||||
Reference in New Issue
Block a user