def extract_passthroughs(text)
result = text.dup
result.gsub!(REGEXP[:pass_macro]) {
m = $~
if m[0].start_with? '\\'
next m[0][1..-1]
end
if m[1] == '$$'
subs = [:specialcharacters]
elsif !m[3].nil? && !m[3].empty?
subs = resolve_subs(m[3])
else
subs = []
end
@passthroughs << {:text => m[2] || m[4].gsub('\]', ']'), :subs => subs}
index = @passthroughs.size - 1
"\e#{index}\e"
} unless !(result.include?('+++') || result.include?('$$') || result.include?('pass:'))
result.gsub!(REGEXP[:pass_lit]) {
m = $~
if m[2].start_with? '\\'
next "#{m[1]}#{m[2][1..-1]}"
end
@passthroughs << {:text => m[3], :subs => [:specialcharacters], :literal => true}
index = @passthroughs.size - 1
"#{m[1]}\e#{index}\e"
} unless !result.include?('`')
result
end