We're getting markdown tables! I assume this is what they look like:
data
data data data
---------------------
| |
| |
| |
| |
Your task is to make a program or function to generate one of these tables. You'll be given input (string, list of lines, list of characters, etc.) containing data, which looks like this:
datadata
data
data data
data data data
The data consists of spaces and non-overlapping data
s. The data will not necessarily form neat stacks (it can float in midair). There is guaranteed to be data on the top and bottom lines, as well as some touching the left side. You can choose if the data is right padded with spaces or not.
The table will always be six characters wider than the data, padded three spaces on the left. The table top is directly below the bottom row of data, and is made up of a line of -
s.
As for the legs, everyone knows taller tables can support more weight, so they'll need to be one unit tall for every data
in the input. They will be made up of |
s, one space in from the sides.
This is code-golf, so shortest answer in bytes per language wins!
Test cases
Input:
data
Output:
data
----------
| |
Input:
data data data
data data data
Output:
data data data
data data data
---------------------
| |
| |
| |
| |
| |
| |
Input:
data
data
Output:
data
data
----------
| |
| |
" data "
,"data \n data"
. \$\endgroup\$