CSV to HTML translation: Difference between revisions
→{{header|Go}}: language change. built in error type.
m (→{{header|Delphi}}: whitespace) |
(→{{header|Go}}: language change. built in error type.) |
||
Line 794:
import (
"bytes"
"flag"
"fmt"
▲ "os"
"strings"
"template"
Line 827:
}
func csvToHtml(csv string, specialHeadings bool) (string,
lines := strings.Split(csv, "\n")
if len(lines) == 0 {
return "",
}
var s script
Line 865:
{{define "body"}}{{range .}} <tr><td>{{html .Character}}</td><td>{{html .Speech}}</td></tr>
{{end}}{{end}}
{{define "tableNoHeadings"}}<table>
{{template "body" .Body}}</table>
{{end}}
{{define "tableWithHeadings"}}<table>
<tr><th>{{html .Headings.Character}}</th><th>{{html .Headings.Speech}}</th></tr>
|