 						let delimiter = quoteDepth % 2 == 1 ? locale.quotationBeginDelimiter : locale.alternateQuotationBeginDelimiter
 						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)

						result.mutableString.append(delimiter ?? "\"")
						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)

					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)

