package main import ( "bufio" "d1pkgweb/deb822" "fmt" "os" "strings" ) var templ = ` {{.Name}}-{{.Version}}
{{.Name}} {{.Version}} [{{.Section}} - {{.Priority}}]
[{{.Suite}} - {{.Component}}]
{{.Description}}
{{.LongDescription}}

Depends:
Recommends:
Maintainer: {{.Maintainer}}
` func main() { args := os.Args if len(args) < 2 { fmt.Printf("Usage: %s \n", args[0]) return } fnames := args[1:] for _, fname := range fnames { nameComps := strings.Split(fname, "_") suite := nameComps[3] component := nameComps[4] f, err := os.Open(fname) if err != nil { defer f.Close() } if err != nil { fmt.Printf("Error opening file %s\n", fname) } else { r := bufio.NewScanner(f) if r != nil { for s, err := deb822.ScanStanza(r); s["Package"] != ""; s, err = deb822.ScanStanza(r) { if err == nil { deb822.Stanza2HtmlPage(s, templ, ".", suite, component) } else { fmt.Printf("error: %s\n", err) } //WriteFiles(s, num, "./files/") } } } } }