Jump to content

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"
"oserrors"
"flag"
"fmt"
"os"
"strings"
"template"
Line 827:
}
 
func csvToHtml(csv string, specialHeadings bool) (string, os.Errorerror) {
lines := strings.Split(csv, "\n")
if len(lines) == 0 {
return "", oserrors.NewErrorNew("no data")
}
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>
1,707

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.