597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
|
# File 'lib/zafu/parser.rb', line 597
def expand_with(acontext={})
blocks = acontext.delete(:blocks) || @blocks
res = ""
only = acontext[:only]
new_context = @context.merge(acontext)
if acontext[:ignore]
new_context[:ignore] = (@context[:ignore] || []) + (acontext[:ignore] || []).uniq
end
if acontext[:no_ignore]
new_context[:ignore] = (new_context[:ignore] || []) - acontext[:no_ignore]
end
ignore = new_context[:ignore]
blocks.each do |b|
if b.kind_of?(String)
if (!only || (only.kind_of?(Array) && only.include?(:string))) && (!ignore || !ignore.include?(:string))
res << b
end
elsif (!only || (only.kind_of?(Array) && only.include?(b.method)) || only =~ b.method) && (!ignore || !ignore.include?(b.method))
res << b.process(new_context.dup)
if pass = b.pass
new_context.merge!(pass)
end
end
end
res
end
|