Example #1
0
func (r *Result) Emit(c token.Code, s string) error {
	if r.Verbose {
		r.t.Logf("%s %#v", c.Name(), s)
	}
	r.Tokens = append(r.Tokens, c, s)
	return nil
}
Example #2
0
File: theme.go Project: koron/beni
// GetStyle returns Style for token.Code.
func (t *Definition) GetStyle(tc token.Code) Style {
	// FIXME: style cascading
	s := t.findStyle(tc)
	for s == nil {
		tc = tc.Parent()
		if tc == 0 {
			return Style{}
		}
		s = t.findStyle(tc)
	}
	return *s
}
Example #3
0
File: html.go Project: koron/beni
func (f *htmlFormatter) Emit(c token.Code, s string) (err error) {
	// FIXME: support lineNumbers option.
	_, err = fmt.Fprintf(f.writer, `<span class="%s">%s</span>`,
		c.ShortName(), html.EscapeString(s))
	return
}