Sha256: 2f0a07da666768a997c9140be80f2541c68771962650501e3f49559c6151ef0a
Contents?: true
Size: 772 Bytes
Versions: 6
Compression:
Stored size: 772 Bytes
Contents
module Slacken::Filters # Public: Wrap child content nodes of each li or dd node with an indent node. class GroupIndent < Slacken::Filter def call(component) if component.type.member_of?(%i(li dd)) head, *tails = component.children.map(&method(:call)) component.derive([head, component.class.new(:indent, tails)]) else component.derive( component.children.map(&method(:call)) ) end end def valid?(component) if component.type.member_of?(%i(li dd)) head, tail = component.children if tail tail.type.member_of?(:indent) && valid?(tail) else true end else component.children.all?(&method(:valid?)) end end end end
Version data entries
6 entries across 6 versions & 1 rubygems