Class: Latex::Parsers::TableParser
- Inherits:
-
Object
- Object
- Latex::Parsers::TableParser
- Defined in:
- lib/ruby-latex.rb
Class Method Summary collapse
Class Method Details
.parse(text) ⇒ Object
332 333 334 335 336 337 338 339 340 341 342 |
# File 'lib/ruby-latex.rb', line 332 def self.parse(text) table_space = ['\\begin{table}', '\\end{table}'].map { |s| text.index(s) } table_space[0] += 13 # length of '\begin{table}' table_text = text[*table_space] caption = table_text.scan(/\\caption\{([^}]*)\}/).flatten[0] label = table_text.scan(/\\label\{([^}]*)\}/).flatten[0] self.parse_tabular(table_text) end |
.parse_align_string(text) ⇒ Object
359 360 361 362 363 |
# File 'lib/ruby-latex.rb', line 359 def self.parse_align_string(text) # TODO implement warn "Ignoring align string #{text}" return nil end |
.parse_tabular(text) ⇒ Object
344 345 346 347 348 349 350 351 352 353 354 355 356 357 |
# File 'lib/ruby-latex.rb', line 344 def self.parse_tabular(text) tabular_space = ['\\begin{tabular}', '\\end{tabular}'].map { |s| text.index(s) } tabular_space[0] += 15 # length of '\begin{tabular}' tabular_text = text[*tabular_space] align_string = tabular_text.scan(/\{([^}]*)\}/).flatten[0] align = self.parse_align_string(align_string) content_text = tabular_text[tabular_text.index('}') + 1, content_text.length] content_text.lines.each do |line| end end |