mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-24 08:41:31 +01:00
Move duplicated code outside of the if
This commit is contained in:
parent
b7916f7d31
commit
fcbfce4ace
@ -159,6 +159,12 @@ extension NSAttributedString {
|
||||
tag.append(first)
|
||||
}
|
||||
} else if char == ">" && inTag != .none {
|
||||
let lastRange = attributeRanges.last?.range
|
||||
let location = lastRange != nil ? lastRange!.location + lastRange!.length : 0
|
||||
let range = NSRange(location: location, length: result.mutableString.length - location)
|
||||
|
||||
attributeRanges.append( (range: range, styles: currentStyles) )
|
||||
|
||||
if inTag == .opening {
|
||||
tagStack.append(tag)
|
||||
|
||||
@ -168,12 +174,6 @@ extension NSAttributedString {
|
||||
result.mutableString.append(delimiter ?? "\"")
|
||||
}
|
||||
|
||||
let lastRange = attributeRanges.last?.range
|
||||
let location = lastRange != nil ? lastRange!.location + lastRange!.length : 0
|
||||
let range = NSRange(location: location, length: result.mutableString.length - location)
|
||||
|
||||
attributeRanges.append( (range: range, styles: currentStyles) )
|
||||
|
||||
if let style = Style(tag: tag) {
|
||||
currentStyles.insert(style)
|
||||
}
|
||||
@ -184,12 +184,6 @@ extension NSAttributedString {
|
||||
quoteDepth -= 1
|
||||
}
|
||||
|
||||
let lastRange = attributeRanges.last?.range
|
||||
let location = lastRange != nil ? lastRange!.location + lastRange!.length : 0
|
||||
let range = NSRange(location: location, length: result.mutableString.length - location)
|
||||
|
||||
attributeRanges.append( ( range: range, styles: currentStyles ))
|
||||
|
||||
if let style = Style(tag: tag) {
|
||||
currentStyles.remove(style)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user