CSV to HTML translation: Difference between revisions
Content added Content deleted
Alextretyak (talk | contribs) (Added 11l) |
No edit summary |
||
Line 3,224: | Line 3,224: | ||
</body> |
</body> |
||
</html></lang> |
</html></lang> |
||
=={{header||Nanoquery}}== |
|||
<lang nanoquery>// a method that converts a csv row into a html table row as a string |
|||
def toHtmlRow($record, $tag) |
|||
$htmlrow = "\t<tr>\n" |
|||
// look through the values in the current csv row |
|||
for ($i = 1) ($i <= len($record)) ($i = $i+1) |
|||
$htmlrow = ($htmlrow + "\t\t<" + $tag + ">" + ($record ~ $i) + "</" + $tag + ">\n") |
|||
end for |
|||
return ($htmlrow + "\t</tr>\n") |
|||
end def |
|||
// get the name of the csv file then open it |
|||
print "filename: " |
|||
input $fname |
|||
open $fname |
|||
// allocate a string to hold the table |
|||
$htmltable = "<table>\n" |
|||
// add the column names to the table (#0 returns column names as a record object |
|||
$htmltable = ($htmltable + toHtmlRow(#0, "th")) |
|||
// add all other rows to the table |
|||
for ($i = 1) ($i < $dbsize) ($i = $i+1) |
|||
$htmltable = ($htmltable + toHtmlRow(#$i, "td")) |
|||
end for |
|||
// close the html table |
|||
$htmltable = $htmltable+"</table>" |
|||
println $htmltable</lang> |
|||
=={{header|NetRexx}}== |
=={{header|NetRexx}}== |