// Paragraph renders the start and end of a paragraph.
545206
func (r *ASCIIRenderer) Paragraph(out *bytes.Buffer, text func() bool) {
	out.WriteString(linebreak)
	text()
	out.WriteString(linebreak)
}
1340006
func (s *stackContext) render() lines {
	siz := len(s.tags)
	if s.internalReason != "" {
		siz++
	}
	if s.reason != "" {
		siz++
	}
	if siz == 0 {
		return nil
	}

	ret := make(lines, 0, siz)
	if s.reason != "" {
		ret = append(ret, fmt.Sprintf("reason: %s", s.reason))
	}
	if s.internalReason != "" {
		ret = append(ret, fmt.Sprintf("internal reason: %s", s.internalReason))
	}
	keys := make(tagKeySlice, 0, len(s.tags))
	for key := range s.tags {
		keys = append(keys, key)
	}
	sort.Sort(keys)
	for _, key := range keys {
		if key != nil {
			ret = append(ret, fmt.Sprintf("tag[%q]: %#v", key.description, s.tags[key]))
		} else {
			ret = append(ret, fmt.Sprintf("tag[nil]: %#v", s.tags[key]))
		}
	}

	return ret
}
1054045
func (c *Context) Render(code int, r render.Render) {
	c.Status(code)

	if !bodyAllowedForStatus(code) {
		r.WriteContentType(c.Writer)
		c.Writer.WriteHeaderNow()
		return
	}

	if err := r.Render(c.Writer); err != nil {
		panic(err)
	}
}
1242829
func (f *File) Render(spec *Specifier) (string, error) {
	ret, err := f.Template[spec.TemplateName].Render(spec.Params)
	if err != nil {
		err = fmt.Errorf("rendering %q: %s", spec.TemplateName, err)
	}
	return ret, err
}
1172770
func (p Paragraph) Output(out io.Writer) {
	s := []byte(spacify(string(p.data)))
	if len(s) == 0 {
		out.Write(nl)
		return
	}
	indent := p.indent * INDENT
	width := p.cols - indent - len(p.prefix)
	wrapped := text.WrapBytes(s, width)
	lines := bytes.Split(wrapped, nl)
	gutter := makePad(indent)
	pad := makePad(len(p.prefix))

	for i, line := range lines {
		out.Write(gutter)
		if i == 0 {
			out.Write([]byte(p.prefix))
		} else {
			out.Write(pad)
		}
		out.Write(line)
		out.Write(nl)
	}
}
667393
func HipsterParagraph(paragraphCount int, sentenceCount int, wordCount int, separator string) string {
	return paragraphGenerator(paragrapOptions{paragraphCount, sentenceCount, wordCount, separator}, HipsterSentence)
}
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()
}
20600
func (resp *Response) Text() (string, error) {
	b, err := resp.Content()
	s := string(b)
	return s, err
}
497617
func (v *VerbalExpression) StartOfLine() *VerbalExpression {
	if !strings.HasPrefix(v.prefixes, "^") {
		v.prefixes = `^` + v.prefixes
	}
	return v
}
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)
}
428305
func yaml_parser_parse_document_start(parser *yaml_parser_t, event *yaml_event_t, implicit bool) bool {

	token := peek_token(parser)
	if token == nil {
		return false
	}

	// Parse extra document end indicators.
	if !implicit {
		for token.typ == yaml_DOCUMENT_END_TOKEN {
			skip_token(parser)
			token = peek_token(parser)
			if token == nil {
				return false
			}
		}
	}

	if implicit && token.typ != yaml_VERSION_DIRECTIVE_TOKEN &&
		token.typ != yaml_TAG_DIRECTIVE_TOKEN &&
		token.typ != yaml_DOCUMENT_START_TOKEN &&
		token.typ != yaml_STREAM_END_TOKEN {
		// Parse an implicit document.
		if !yaml_parser_process_directives(parser, nil, nil) {
			return false
		}
		parser.states = append(parser.states, yaml_PARSE_DOCUMENT_END_STATE)
		parser.state = yaml_PARSE_BLOCK_NODE_STATE

		*event = yaml_event_t{
			typ:        yaml_DOCUMENT_START_EVENT,
			start_mark: token.start_mark,
			end_mark:   token.end_mark,
		}

	} else if token.typ != yaml_STREAM_END_TOKEN {
		// Parse an explicit document.
		var version_directive *yaml_version_directive_t
		var tag_directives []yaml_tag_directive_t
		start_mark := token.start_mark
		if !yaml_parser_process_directives(parser, &version_directive, &tag_directives) {
			return false
		}
		token = peek_token(parser)
		if token == nil {
			return false
		}
		if token.typ != yaml_DOCUMENT_START_TOKEN {
			yaml_parser_set_parser_error(parser,
				"did not find expected <document start>", token.start_mark)
			return false
		}
		parser.states = append(parser.states, yaml_PARSE_DOCUMENT_END_STATE)
		parser.state = yaml_PARSE_DOCUMENT_CONTENT_STATE
		end_mark := token.end_mark

		*event = yaml_event_t{
			typ:               yaml_DOCUMENT_START_EVENT,
			start_mark:        start_mark,
			end_mark:          end_mark,
			version_directive: version_directive,
			tag_directives:    tag_directives,
			implicit:          false,
		}
		skip_token(parser)

	} else {
		// Parse the stream end.
		parser.state = yaml_PARSE_END_STATE
		*event = yaml_event_t{
			typ:        yaml_STREAM_END_EVENT,
			start_mark: token.start_mark,
			end_mark:   token.end_mark,
		}
		skip_token(parser)
	}

	return true
}
763199
func (d draw) Text(r Renderer, text string, x, y int, style Style) {
	style.GetTextOptions().WriteToRenderer(r)
	defer r.ResetStyle()

	r.Text(text, x, y)
}
1137157
func (r *Row) Render(style *renderStyle) string {
	// pre-render and shove into an array... helps with cleanly adding borders
	renderedCells := []string{}
	for _, c := range r.cells {
		renderedCells = append(renderedCells, c.Render(style))
	}

	// format final output
	return style.BorderY + strings.Join(renderedCells, style.BorderY) + style.BorderY
}
737449
func (s *SequenceRenderer) Render(m ...string) trees.Markup {
	root := trees.NewElement(s.Tag, false)

	attrs.Class(strings.Join(s.Class, " ")).Apply(root)
	attrs.ID(s.ID).Apply(root)

	for _, st := range s.stack {
		st.Render(m...).Apply(root)
	}

	return root
}
800598
func (p *Pair) Trim() *Pair {
	p.Key = strings.TrimSpace(p.Key)
	p.Value = strings.TrimSpace(p.Value)

	return p
}
555932
func (r *Render) Render(w io.Writer, e Engine, data interface{}) error {
	err := e.Render(w, data)
	if hw, ok := w.(http.ResponseWriter); err != nil && !r.opt.DisableHTTPErrorRendering && ok {
		http.Error(hw, err.Error(), http.StatusInternalServerError)
	}
	return err
}
77764
func (p *Parser) Start() (err error) {
	var msg *outerMessage

	defer p.afterStop()

	defer func() {
		if x, ok := recover().(error); ok {
			err = x
		}
	}()

	// Loop through all outer messages until we're signaled to stop. Stopping
	// happens when either the OnCDemoStop message is encountered or
	// parser.Stop() is called programatically.
	for !p.isStopping {
		if p.stopAtTick > 0 && p.Tick > p.stopAtTick {
			return
		}

		msg, err = p.readOuterMessage()
		if err != nil {
			if err == io.EOF {
				err = nil
			}
			return
		}

		p.Tick = msg.tick

		if err = p.Callbacks.callByDemoType(msg.typeId, msg.data); err != nil {
			return
		}
	}

	return
}