ここの最後に書いた「表のタグも何とかしたい」
とりあえず、簡単なのを作ったw
CotEditor用だ。
セルをタブ区切りで作って、選択してスクリプトを実行すればいい。
ExcelやLibreOffice Calcでタブ区切りのテキストで保存したやつが使えるはず。
#!/bin/bash
# %%%{CotEditorXInput=Selection}%%%
# %%%{CotEditorXOutput=ReplaceSelection}%%%
cat - | awk '
BEGIN {
FS="\t"
print "<table>"
row=0
}
{
print " <tr>"
for(i = 1; i <= NF; i++) {
if(row == 0) {
print " <th>" $i "</th>"
} else {
print " <td>" $i "</td>"
}
}
print " </tr>"
row++;
}
END {
print "</table>"
}'