// HTML returns the HTML representation of the Dataset as an Exportable.
359385
func (d *Dataset) HTML() *Exportable {
	back := d.Records()
	b := newBuffer()

	b.WriteString("<table class=\"table table-striped\">\n\t<thead>")
	for i, r := range back {
		b.WriteString("\n\t\t<tr>")
		for _, c := range r {
			tag := "td"
			if i == 0 {
				tag = "th"
			}
			b.WriteString("\n\t\t\t<" + tag + ">")
			b.WriteString(c)
			b.WriteString("</" + tag + ">")
		}
		b.WriteString("\n\t\t</tr>")
		if i == 0 {
			b.WriteString("\n\t</thead>\n\t<tbody>")
		}
	}
	b.WriteString("\n\t</tbody>\n</table>")

	return newExportable(b)
}
766701
func (s *Selection) AppendHtml(html string) *Selection {
	return s.AppendNodes(parseHtml(html)...)
}
986354
func HTML(lang string, code []byte) ([]byte, error) {
	h, err := makeAndHighlight(lang, code)
	if err != nil {
		return nil, err
	}

	var buf bytes.Buffer
	buf.Write([]byte(`<div class="highlight"><pre><code>`))
	h.render(&buf, func(w io.Writer, class string, body []byte) {
		escaped := html.EscapeString(string(body))
		if len(class) > 0 {
			fmt.Fprintf(w, "<span class=\"%s\">%s</span>", class, escaped)
		} else {
			w.Write([]byte(escaped))
		}
	})
	buf.Write([]byte(`</code></pre></div>`))
	return buf.Bytes(), nil
}
514300
func (c *Context) HTML(code int, name string, obj interface{}) {
	instance := c.engine.HTMLRender.Instance(name, obj)
	c.Render(code, instance)
}
359497
func (r *RenderRenderer) Render(w http.ResponseWriter, code int, templateName string, data interface{}, layout string) {
	if layout != "" {
		r.r.HTML(w, code, templateName, data, render.HTMLOptions{Layout: layout})
		return
	}
	r.r.HTML(w, code, templateName, data)
}
1246707
func (d *Dataset) JSON() (*Exportable, error) {
	back := d.Dict()

	b, err := json.Marshal(back)
	if err != nil {
		return nil, err
	}
	return newExportableFromBytes(b), nil
}
635767
func (c *DOM) GetOuterHTML(nodeId int, backendNodeId int, objectId string) (string, error) {
	var v DOMGetOuterHTMLParams
	v.NodeId = nodeId
	v.BackendNodeId = backendNodeId
	v.ObjectId = objectId
	return c.GetOuterHTMLWithParams(&v)
}
1136945
func (self htmlIdImpl) StyleAttribute(name string) DomAttribute {
	return self.getOrCreateAttribute("style:"+name, func() DomAttribute {
		return NewStyleAttr(name, self.t)
	})
}
982115
func (c *Captcha) CreateHTML() template.HTML {
	value, err := c.CreateCaptcha()
	if err != nil {
		panic(fmt.Errorf("fail to create captcha: %v", err))
	}
	return template.HTML(fmt.Sprintf(`<input type="hidden" name="%[1]s" value="%[2]s">
	<a class="captcha" href="javascript:" tabindex="-1">
		<img onclick="this.src=('%[3]s%[4]s%[2]s.png?reload='+(new Date()).getTime())" class="captcha-img" src="%[3]s%[4]s%[2]s.png">
	</a>`, c.FieldIdName, value, c.SubURL, c.URLPrefix))
}
41100
func (inliner *Inliner) parseHTML() error {
	doc, err := goquery.NewDocumentFromReader(strings.NewReader(inliner.html))
	if err != nil {
		return err
	}

	inliner.doc = doc

	return nil
}
401170
func (br BuilderRef) RenderHTML(buffer *bytes.Buffer, depth int, maxDepth int) {
	// If render the HTML as flat rather than nested, we don't need to recurse at all and should just
	// return after rendering the BuilderSummary.
	if maxDepth < 0 {
		if br.Builder != nil && br.Builder.LastFinishedBuildID != "" {
			must(fmt.Fprintf(buffer, `<a class="console-builder-status" href="%s" title="%s">`,
				template.HTMLEscapeString(br.Builder.LastFinishedBuildIDLink()),
				template.HTMLEscapeString(br.Builder.BuilderID),
			))
			must(fmt.Fprintf(buffer, `<div class="console-list-builder status-%s"></div>`,
				template.HTMLEscapeString(br.Builder.LastFinishedStatus.String()),
			))
		} else {
			must(fmt.Fprintf(buffer, `<a class="console-builder-status" href="/%s" title="%s">`,
				template.HTMLEscapeString(br.ID),
				template.HTMLEscapeString(br.ID),
			))
			must(buffer.WriteString(`<div class="console-list-builder"></div>`))
		}
		must(buffer.WriteString(`</a>`))
		return
	}

	must(buffer.WriteString(`<div class="console-builder-column">`))
	// Add spaces if we haven't hit maximum depth to keep the grid consistent.
	for i := 0; i < (maxDepth - depth); i++ {
		must(buffer.WriteString(`<div class="console-space"></div>`))
	}
	must(buffer.WriteString(`<div>`))
	var extraStatus string
	if br.Builder != nil {
		extraStatus += fmt.Sprintf("console-%s", br.Builder.LastFinishedStatus)
	}
	must(fmt.Fprintf(
		buffer, `<span class="%s"><a class="console-builder-item" href="%s" title="%s">%s</a></span>`,
		template.HTMLEscapeString(extraStatus),
		template.HTMLEscapeString(br.Builder.SelfLink()),
		template.HTMLEscapeString(br.BuilderName()),
		template.HTMLEscapeString(br.ShortName)))
	must(buffer.WriteString(`</div>`))

	must(buffer.WriteString(`<div class="console-build-column">`))

	status := "None"
	link := "#"
	class := ""

	// Below is a state machine for rendering a single builder's column.
	// In essence, the state machine takes 3 inputs: the current state, and
	// the if the next 2 builds exist. It uses this information to choose the
	// next state.
	//
	// Each iteration, the state machine writes out the state's corresponding element,
	// either a lone cell, the top of a long cell, the bottom of a long cell, the
	// middle of a long cell, or an empty space.
	//
	// The ultimate goal of this state machine is to visually extend a single
	// build down to the next known build for this builder by commit.

	// Initialize state machine state.
	//
	// Could equivalently be implemented using a "start" state, but
	// that requires a no-render special case which would make the
	// state machine less clean.
	var state int
	switch {
	case len(br.Build) == 1:
		switch {
		case br.Build[0] != nil:
			state = cell
		case br.Build[0] == nil:
			state = empty
		}
	case len(br.Build) > 1:
		switch {
		case br.Build[0] != nil && br.Build[1] != nil:
			state = cell
		case br.Build[0] != nil && br.Build[1] == nil:
			state = top
		case br.Build[0] == nil:
			state = empty
		}
	default:
		// This is probably a console preview.
	}
	// Execute state machine for determining cell type.
	for i, build := range br.Build {
		nextBuild := false
		if i < len(br.Build)-1 {
			nextBuild = br.Build[i+1] != nil
		}
		nextNextBuild := false
		if i < len(br.Build)-2 {
			nextNextBuild = br.Build[i+2] != nil
		}

		var nextState int
		switch state {
		case empty:
			class = "empty-cell"
			switch {
			case nextBuild && nextNextBuild:
				nextState = cell
			case nextBuild && !nextNextBuild:
				nextState = top
			case !nextBuild:
				nextState = empty
			}
		case top:
			class = "cell-top"
			status = build.Summary.Status.String()
			link = build.SelfLink()
			switch {
			case nextNextBuild:
				nextState = bottom
			case !nextNextBuild:
				nextState = middle
			}
		case middle:
			class = "cell-middle"
			switch {
			case nextNextBuild:
				nextState = bottom
			case !nextNextBuild:
				nextState = middle
			}
		case bottom:
			class = "cell-bottom"
			switch {
			case nextNextBuild:
				nextState = cell
			case !nextNextBuild:
				nextState = top
			}
		case cell:
			class = "cell"
			status = build.Summary.Status.String()
			link = build.SelfLink()
			switch {
			case nextNextBuild:
				nextState = cell
			case !nextNextBuild:
				nextState = top
			}
		default:
			panic("Unrecognized state")
		}
		// Write current state's information.
		must(fmt.Fprintf(buffer,
			`<div class="console-cell-container"><a class="console-%s status-%s" href="%s" title="%s">`+
				`<span class="console-cell-text">%s</span></a><div class="console-cell-spacer"></div></div>`,
			class, status, link,
			template.HTMLEscapeString(br.BuilderName()),
			br.ShortName))

		// Update state.
		state = nextState
	}
	must(buffer.WriteString(`</div></div>`))
}
320763
func (r *Row) HTML(tag string, style *renderStyle) string {
	attrs := make([]string, len(r.cells))
	elems := make([]string, len(r.cells))
	for i := range r.cells {
		if r.cells[i].alignment != nil {
			switch *r.cells[i].alignment {
			case AlignLeft:
				attrs[i] = " align='left'"
			case AlignCenter:
				attrs[i] = " align='center'"
			case AlignRight:
				attrs[i] = " align='right'"
			}
		}
		elems[i] = html.EscapeString(strings.TrimSpace(r.cells[i].Render(style)))
	}
	// WAG as to max capacity, plus a bit
	buf := bytes.NewBuffer(make([]byte, 0, 8192))
	buf.WriteString("<tr>")
	for i := range elems {
		fmt.Fprintf(buf, "<%s%s>%s</%s>", tag, attrs[i], elems[i], tag)
	}
	buf.WriteString("</tr>\n")
	return buf.String()
}
1105997
func (remote *RemoteDebugger) GetOuterHTML(nodeID int) (string, error) {
	res, err := remote.SendRequest("DOM.getOuterHTML", Params{
		"nodeId": nodeID,
	})

	if err != nil {
		return "", err
	}

	return res["outerHTML"].(string), nil
}
223550
func (r Data) Render(w http.ResponseWriter) (err error) {
	r.WriteContentType(w)
	_, err = w.Write(r.Data)
	return
}
1211488
func HTMLToText(input io.Reader) string {
	text, _ := XMLToText(input, []string{"br", "p", "h1", "h2", "h3", "h4"}, []string{}, false)
	return text
}
413645
func (r XML) Render(w http.ResponseWriter) error {
	r.WriteContentType(w)
	return xml.NewEncoder(w).Encode(r.Data)
}
58498
func (ctx *context) HTML(htmlContents string) (int, error) {
	ctx.ContentType(ContentHTMLHeaderValue)
	return ctx.writer.WriteString(htmlContents)
}