The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

takes two-dimensional perl array and formats it in html table

DEMO:

  my @data;

  push @data, [
              '123',
              { ARGS => 'align=right', DATA => 'asd' },
              'qwe'
              ];
  push @data, {
                CLASS => 'grid',
                DATA => [
                        '123',
                        { ARGS  => 'align=center', DATA => 'asd' },
                        { CLASS => 'fmt-img',      DATA => 'qwe' },
                        ],
              };
  push @data, {
              # columns class list (CCL), used only for current row
              # use PCCL for permanent (for the rest of the rows)
              CCL  => [ 'view-name-h', 'view-value-h' ],
              DATA => [ 'name',        'value'        ],
              };
  push @data, {
              PCCL  => [ 'view-name-h', 'view-value-h' ],
              # set only PCCL and skip this row
              SKIP  => YES,
              };

  $text .= html_table( \@data, ARGS => 'width=100%' );

formats pair for left/right boxes aligned within specific width

format is: 'left-spec=right-spec'

left-spec is formatting for the left data. right-spec is formatting for the right data.

both specs are:

align-symbol . width-len%

examples:

<50%=50%> -- left is left aligned, right is right aligned, equal length <=> -- the same >20=> -- left is right aligned, 20% width, right is right aligned, 80% =1% -- same as <99=1> or <99%=1%>

using '==' instead of '=' enables no-word-wrap style