Login  Register

Re: Creating tables in extensions

Posted by lorrden on Apr 26, 2019; 7:40pm
URL: https://discuss.asciidoctor.org/Creating-tables-in-extensions-tp6875p6877.html

Thanks,  that got me in the right direction, just for reference something like this will work:

class FooBarMacro < Asciidoctor::Extensions::BlockMacroProcessor
  use_dsl

  named :foobar

  def process parent, target, attrs
    tab = ['[width="15%"]',
           '|=======',
           '|1 |2 |A',
           '|3 |4 |B',
           '|5 |6 |C',
           '|=======']
    block = create_open_block parent, '', attrs
    parse_content block, tab, attrs
  end
end