Nibbles, 2224 23.5 22 21.5 bytes
;~"able"::"<t"$">".`,_:@"r".,_@"r"^_:_@?@"d"$"d" "h"
Attempt This Online!Attempt This Online!
Takes arguments in the order cols rows
. Outputs something like this (for 8 5
):
<table><tr> <th>1 <th>2 <th>3 <th>4 <th>5 <th>6 <th>7 <th>8<table><tr><th>0<th>0<th>0<th>0<th>0<th>0<th>0<th>0
<tr> <td>1 <td>2 <td>3 <td>4 <td>5 <td>6 <td>7 <td>8<tr><td>1<td>1<td>1<td>1<td>1<td>1<td>1<td>1
<tr> <td>1 <td>2 <td>3 <td>4 <td>5 <td>6 <td>7 <td>8<tr><td>2<td>2<td>2<td>2<td>2<td>2<td>2<td>2
<tr> <td>1 <td>2 <td>3 <td>4 <td>5 <td>6 <td>7 <td>8<tr><td>3<td>3<td>3<td>3<td>3<td>3<td>3<td>3
<tr> <td>1 <td>2 <td>3 <td>4 <td>5 <td>6 <td>7 <td>8<tr><td>4<td>4<td>4<td>4<td>4<td>4<td>4<td>4
Explanation
;~ Define function f(str)
"able" and call it with sstr = "able":
: join
: join
"<t" "<t"
$ str
">" ">"
. Map
`, 0...
_ number of rows
: join
@ f
"r" "r"
. map
, ^ 1..repeat
_ number of rowscolumns
: join
_@ f
? if
@$ row index is positive
"d" then "d"
"h" else "h"
columnrow index