 		let result = NSMutableAttributedString()
 
 		var attributeRanges = [ (range: NSRange, styles: CountedSet<Style>) ]()
+		var quoteDepth = 0
 
 		while let char = iterator.next() {
 			if char == "<" && inTag == .none {

					if style != nil {
						currentStyles.insert(style!)
					}


				} else {
					if tag == "q" {
						result.mutableString.append(locale.quotationEndDelimiter ?? "\"")
					}

					let lastRange = attributeRanges.last?.range

					tagStack.append(tag)

					if tag == "q" {
						quoteDepth += 1
						let delimiter = quoteDepth % 2 == 1 ? locale.quotationBeginDelimiter : locale.alternateQuotationBeginDelimiter
						result.mutableString.append(delimiter ?? "\"")
					}

					let lastRange = attributeRanges.last?.range
