Exemplo n.º 1
0
// html writer
func wrhtml(t *Text, wid int, out io.Writer, outfig string) {
	f := &htmlFmt{
		par: &par{fn: escHtml, out: out, wid: wid, tab: "    "},
		outfig: outfig,
	}
	var tmpl []string
	if cliveMan {
		dat, err := nsutil.GetAll(TEMPLATE)
		if err != nil {
			app.Warn("%s", err)
		} else {
			tmpl = strings.Split(string(dat), "\n")
		}
		for len(tmpl) > 0 {
			ln := tmpl[0]
			tmpl = tmpl[1:]
			fmt.Fprintf(out, "%s\n", ln)
			if strings.Contains(ln, `div id="content" class="Content"`) {
				break
			}
		}
	}
	f.run(t)
	for _, ln := range tmpl {
		fmt.Fprintf(out, "%s\n", ln)
	}
}
Exemplo n.º 2
0
func (l *lex) source(what string) {
	dat, err := nsutil.GetAll(what)
	if err != nil {
		app.Warn("open: %s: %s", what, err)
		return
	}
	l.in = append([]inText{bytes.NewBuffer(dat)}, l.in...)
	l.saddr = append([]Addr{l.Addr}, l.saddr...)
	l.Addr = Addr{what, 1}
}