#!/usr/bin/perl
for my $d (map {chomp;$_} `find . -mindepth 1 -maxdepth 1 -type d`) {
    $d=~m{\A\./(.*)\z};
    open my $f, '>', "../../tmp/doc/asciidoc-867_$1.txt" or die "open: $!";
    select $f;
    print <<'TABLE';
++++
<table class=cs>
++++
TABLE
    my $row = 'odd';
    for my $f (map {chomp;$_} `find \Q$d\E -type f | sort -n -t / -k 3`) {
        my $txt = `cat \Q$f\E`;
        print <<COL1;
++++
<tr class="$row"><td class="col1">
++++
....
COL1
        $row = $row eq 'odd' ? 'even' : 'odd';
        if ($txt =~ /^\.\.\.\.$/m) {
            my $tmp = $txt;
            $tmp =~ s/^/ /mg;
            print $tmp;
        } else {
            print $txt;
        }
        print <<'COL2';

....
++++
</td><td class="col2">
++++
COL2
        print $txt;
        print <<'EOROW';

++++
</td></tr>
++++
EOROW
    }
    print <<'EOTABLE';
++++
</table>
++++
EOTABLE
}
system('touch', '../asciidoc-867.txt') and die "system: $! $?";
system('touch', '../asciidoc-867-compact.txt') and die "system: $! $?";

