mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-25 01:01:21 +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)
|
tag.append(first)
|
||||||
}
|
}
|
||||||
} else if char == ">" && inTag != .none {
|
} 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 {
|
if inTag == .opening {
|
||||||
tagStack.append(tag)
|
tagStack.append(tag)
|
||||||
|
|
||||||
@ -168,12 +174,6 @@ extension NSAttributedString {
|
|||||||
result.mutableString.append(delimiter ?? "\"")
|
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) {
|
if let style = Style(tag: tag) {
|
||||||
currentStyles.insert(style)
|
currentStyles.insert(style)
|
||||||
}
|
}
|
||||||
@ -184,12 +184,6 @@ extension NSAttributedString {
|
|||||||
quoteDepth -= 1
|
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) {
|
if let style = Style(tag: tag) {
|
||||||
currentStyles.remove(style)
|
currentStyles.remove(style)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user