Sha256: b811470d9f86eb4ccf65361e0456d46577805bd751d85f678243be1daaf9e16f
Contents?: true
Size: 716 Bytes
Versions: 1
Compression:
Stored size: 716 Bytes
Contents
class Slacken::DocumentComponent module GroupInlines # Private: Group inline elements and wrap them in a wrapper node. # Wrapper nodes are introduced to group inline nodes in a paragraph. def group_inlines if block? new_children = children.map(&:group_inlines).chunk(&:inline?).map do |is_inline, group| is_inline ? self.class.new(:wrapper, group) : group end.flatten derive(new_children) else derive(children.map(&:group_inlines)) end end def inlines_grouped? if type.member_of?(:wrapper) true elsif inline? false else children.all?(&:inlines_grouped?) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
slacken-0.1.0 | lib/slacken/document_component/group_inlines.rb |