Method: Latexmath::Aggregator#process_row

Defined in:
lib/latexmath/aggregator.rb

#process_row(tokens) ⇒ Object



283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
# File 'lib/latexmath/aggregator.rb', line 283

def process_row(tokens)
  row = []
  content = []

  tokens.each do |token|
    if token == AMPERSAND
      next
    elsif token == BACKSLASH
      content << row if row.any?
      row = []
    else
      row << token
    end
  end

  content << row if row.any?

  content = content.pop while content.size == 1 && content.first.is_a?(Array)

  content
end