Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
23
Task/Create-an-HTML-table/Jq/create-an-html-table-1.jq
Normal file
23
Task/Create-an-HTML-table/Jq/create-an-html-table-1.jq
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
def html_row:
|
||||
"<tr>",
|
||||
" \(.[] | "<td>\(.)</td>")",
|
||||
"</tr>";
|
||||
|
||||
def html_header:
|
||||
"<thead align = 'right'>",
|
||||
" \(html_row)",
|
||||
"</thead>";
|
||||
|
||||
def html_table(header):
|
||||
"<table>",
|
||||
" \(header | html_header)",
|
||||
" <tbody align = 'right'>",
|
||||
" \(.[] | html_row)",
|
||||
" </tbody",
|
||||
"</table>";
|
||||
|
||||
# Prepend the sequence number
|
||||
def html_table_with_sequence(header):
|
||||
length as $length
|
||||
| . as $in
|
||||
| [range(0;length) | [.+1] + $in[.]] | html_table(header);
|
||||
7
Task/Create-an-HTML-table/Jq/create-an-html-table-2.jq
Normal file
7
Task/Create-an-HTML-table/Jq/create-an-html-table-2.jq
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
def data:
|
||||
[ [4,5,6],
|
||||
[41, 51, 61],
|
||||
[401, 501, 601] ];
|
||||
|
||||
# The first column has no header
|
||||
data | html_table_with_sequence( ["", "X", "Y", "Z"] )
|
||||
31
Task/Create-an-HTML-table/Jq/create-an-html-table-3.jq
Normal file
31
Task/Create-an-HTML-table/Jq/create-an-html-table-3.jq
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
$ jq -r -n -f Create_an_HTML_table.jq
|
||||
<table>
|
||||
<thead align = 'right'>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>X</td>
|
||||
<td>Y</td>
|
||||
<td>Z</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody align = 'right'>
|
||||
<tr>
|
||||
<td>1</td>
|
||||
<td>4</td>
|
||||
<td>5</td>
|
||||
<td>6</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>2</td>
|
||||
<td>41</td>
|
||||
<td>51</td>
|
||||
<td>61</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>3</td>
|
||||
<td>401</td>
|
||||
<td>501</td>
|
||||
<td>601</td>
|
||||
</tr>
|
||||
</tbody
|
||||
</table>
|
||||
Loading…
Add table
Add a link
Reference in a new issue