Yann B asked:
Is it doable? (I bet it is, but I can't figure it out). I want to create a HTML snippets that transforms a tab delimited table into an HTML table, fo instance, I'd select this:
item_01 item_02 item_03 item_11 item_12 item_13 item_21 item_22 item_23
hit a key combo, and get:
<table> <tr><th>item_01</th><th>item_02</th><th>item_03</th></tr> <tr><td>item_11</td><td>item_12</td><td>item_13</td></tr> <tr><td>item_21</td><td>item_22</td><td>item_23</td></tr> </table>
OK, I'm feeling sufficiently perverse to write it as a one-long-liner in perl (it's a *Saturday*...). Not elegant, to be sure, but it works OK and might give the "perl as unmaintainable line noise" folk a warm fuzzy feeling.
Cheers, Paul =======================================================================
Make a new command: input as "selected text", output as "replace selected text". The command should be:
#!/usr/bin/perl print "<table>\n\t<tr><td>",join("</td></tr>\n\t<tr><td>",map {chomp;join("</td><td>",(split(/\t/,$_)))} <>),"</td></tr>\n</table>\n";