This PR deals with the rendering part only since it's already too big. Replies are WIP.
Moved DraftyFormatter's associated type Node out of the enclosing protocol (protocols with an associated type are too hard to work with when using generics).
Refactored the logic which turns Drafty into a tree of Drafty.Spans and traverses it into a separate Drafty.SpanTreeProcessor class. Now Drafty.format() and Drafty.preview() may implement their own processors and apply their own logic in them by subclassing Drafty.SpanTreeProcessor.
Quotes (QQs) are rendered via QuotedAttachments - these are similar to the DraftyButtonAttachment. The quoted Drafty object is rendered in an image object which subsequently is embedded in a NSTextAttachment in the parent Drafty object (unfortunately, Apple's NSAttributedString does not have anything similar to the Android's Spans).
This PR deals with the rendering part only since it's already too big. Replies are WIP.
DraftyFormatter
's associated typeNode
out of the enclosing protocol (protocols with an associated type are too hard to work with when using generics).Drafty
into a tree ofDrafty.Span
s and traverses it into a separateDrafty.SpanTreeProcessor
class. NowDrafty.format()
andDrafty.preview()
may implement their own processors and apply their own logic in them by subclassingDrafty.SpanTreeProcessor
.QQ
s) are rendered viaQuotedAttachment
s - these are similar to theDraftyButtonAttachment
. The quotedDrafty
object is rendered in an image object which subsequently is embedded in aNSTextAttachment
in the parentDrafty
object (unfortunately, Apple's NSAttributedString does not have anything similar to the Android's Spans).