RosettaCodeData/Task/CSV-to-HTML-translation/Vedit-macro-language/csv-to-html-translation-1.vedit
Ingy döt Net d066446780 langs a-z
2013-04-10 22:43:41 -07:00

27 lines
605 B
Text

if (BB < 0) { // block not set
BB(0) // convert entire file
BE(File_Size)
}
// Convert special characters into entities
Replace_Block("&","&amp;", BB, BE, BEGIN+ALL+NOERR)
Replace_Block("<","&lt;", BB, BE, BEGIN+ALL+NOERR)
Replace_Block(">","&gt;", BB, BE, BEGIN+ALL+NOERR)
// Convert CSV into HTML table
Goto_Pos(BB)
IT('<table>') IN
#80 = Cur_Pos
Goto_Pos(BE)
IT("</table>")
#81 = Cur_Line
IN
Goto_Pos(#80)
while (Cur_Line < #81) {
IT(" <tr><td>")
Replace_Block(",","</td><td>",Cur_Pos,EOL_Pos,ALL+NOERR)
EOL
IT("</td></tr>")
Line(1)
}
BB(Clear)