// Renders a simple index page
555821
func (s *HTTPServer) Index(resp http.ResponseWriter, req *http.Request) {
	// Check if this is a non-index path
	if req.URL.Path != "/" {
		resp.WriteHeader(http.StatusNotFound)
		return
	}

	// Give them something helpful if there's no UI so they at least know
	// what this server is.
	if !s.IsUIEnabled() {
		fmt.Fprint(resp, "Consul Agent")
		return
	}

	// Redirect to the UI endpoint
	http.Redirect(resp, req, "/ui/", http.StatusMovedPermanently) // 301
}
424950
func (self *IndexOnlyComponent) Page(pb PBundle, path []string, trailingSlash bool) ComponentResult {
	//allow singular to be used as synonym for plural
	if len(path) == 0 {
		return ComponentResult{
			Path:   "/" + self.indexPath,
			Status: http.StatusOK,
		}
	}

	if len(path) == 1 && path[0] == "index.html" {
		return ComponentResult{
			Path:   "/" + self.indexPath,
			Status: http.StatusOK,
		}
	}

	continuePoint := self.plural
	if self.singular != "" {
		continuePoint = self.singular
	}

	//just try to serve up the content
	return ComponentResult{
		Status:           CONTINUE,
		ContinueAt:       continuePoint,
		ContinueConsumed: 1,
	}

}
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)
}
194793
func RenderSpecialLink(rawBytes []byte, urlPrefix string, metas map[string]string) []byte {
	ms := MentionPattern.FindAll(rawBytes, -1)
	for _, m := range ms {
		m = m[bytes.Index(m, []byte("@")):]
		rawBytes = bytes.Replace(rawBytes, m,
			[]byte(fmt.Sprintf(`<a href="%s/%s">%s</a>`, setting.AppSubURL, m[1:], m)), -1)
	}

	rawBytes = RenderIssueIndexPattern(rawBytes, urlPrefix, metas)
	rawBytes = RenderCrossReferenceIssueIndexPattern(rawBytes, urlPrefix, metas)
	rawBytes = RenderSha1CurrentPattern(rawBytes, urlPrefix)
	return rawBytes
}
1169760
func (r *ChartRepository) Index() error {
	err := r.generateIndex()
	if err != nil {
		return err
	}
	return r.saveIndexFile()
}
299846
func (m *Manifest) Render() string {
	var b bytes.Buffer
	size := len(m.sections) - 1

	for i, section := range m.sections {
		b.WriteString(fmt.Sprintf("[%s]\n", section.key))
		if section.content != "" {
			b.WriteString(section.content)
		}
		for _, x := range section.entries {
			b.WriteString(x)
		}
		if i < size {
			b.WriteString("\n")
		}
	}

	return b.String()
}
745954
func (self *SimpleIdComponent) Page(pb PBundle, path []string, trailingSlash bool) ComponentResult {

	//allow singular to be used as synonym for plural
	if len(path) == 0 {
		return ComponentResult{
			Path:   "/" + filepath.Join(self.UrlPrefix(), "index.html"),
			Status: http.StatusOK,
		}
	}

	if (len(path) == 1 && path[0] == "new") || (len(path) == 1 && path[0] == "new.html") {
		if self.newcheck != nil {
			ok, err := self.newcheck(pb)
			if err != nil {
				return ComponentResult{
					Status:  http.StatusInternalServerError,
					Message: err.Error(),
				}
			}
			if !ok {
				return ComponentResult{
					Message: "you lose",
					Status:  http.StatusUnauthorized,
				}
			}
		}
		return ComponentResult{
			Path:   "/" + filepath.Join(self.UrlPrefix(), "new.html"),
			Status: http.StatusOK,
		}
	}

	if (len(path) == 1 && path[0] == "index") || (len(path) == 1 && path[0] == "index.html") {
		return ComponentResult{
			Path:   "/" + filepath.Join(self.UrlPrefix(), "index.html"),
			Status: http.StatusOK,
		}
	}

	// parse the id in the URL
	rawId := path[0]
	id, err := strconv.ParseInt(rawId, 10, 64)
	if err != nil {
		//handle the case of /<singular>/new.js
		return ComponentResult{
			Status:           CONTINUE,
			ContinueAt:       self.singular,
			ContinueConsumed: 1,
		}
	}
	if self.exists != nil {
		ok, err := self.exists(pb, id)
		if err != nil {
			return ComponentResult{
				Status:  http.StatusInternalServerError,
				Message: err.Error(),
			}
		}
		if !ok {
			return ComponentResult{
				Status:  http.StatusNotFound,
				Message: fmt.Sprintf("could not find %d", id),
			}
		}
	}

	// show view.html for /foo/1 or /foo/1/
	if len(path) == 1 {
		if self.viewedit != nil {
			ok, err := self.viewedit(pb, id, true)
			if err != nil {
				return ComponentResult{
					Status:  http.StatusInternalServerError,
					Message: err.Error(),
				}
			}
			if !ok {
				return ComponentResult{
					Message: "you lose",
					Status:  http.StatusUnauthorized,
				}
			}
		}
		return ComponentResult{
			Path:   "/" + filepath.Join(self.UrlPrefix(), "view.html"),
			Status: http.StatusOK,
		}
	}

	// see if it's a verb we understand
	if len(path) == 2 {
		verb := path[1]
		switch verb {
		case "edit", "edit.html", "view", "view.html":
			if !strings.HasSuffix(verb, ".html") {
				verb = verb + ".html"
			}
			if self.viewedit != nil {
				ok, err := self.viewedit(pb, id, verb == "view.html")
				if err != nil {
					return ComponentResult{
						Status:  http.StatusInternalServerError,
						Message: err.Error(),
					}
				}
				if !ok {
					return ComponentResult{
						Message: "you lose",
						Status:  http.StatusUnauthorized,
					}
				}
				return ComponentResult{
					Path:   "/" + filepath.Join(self.UrlPrefix(), verb),
					Status: http.StatusOK,
				}

			}
		default:
			return ComponentResult{
				Status:           CONTINUE,
				ContinueAt:       self.UrlPrefix(),
				ContinueConsumed: 2,
			}
		}
	}

	//we don't accept any more parts to the URL
	return ComponentResult{
		Status:  http.StatusBadRequest,
		Message: fmt.Sprintf("Unacceptable url for %s", self.singular),
	}
}
1349287
func (p *PageView) Render() vecty.ComponentOrHTML {
	return elem.Body(
		elem.Section(
			vecty.Markup(
				vecty.Class("todoapp"),
			),

			p.renderHeader(),
			vecty.If(len(store.Items) > 0,
				p.renderItemList(),
				p.renderFooter(),
			),
		),

		p.renderInfo(),
	)
}
28271
func (collection Collection) Render(context *qor.Context, name string, objects ...interface{}) template.HTML {
	seoSetting := collection.GetSEOSetting(context, name, objects...)
	return seoSetting.FormattedHTML(context)
}
366733
func Render(w http.ResponseWriter, data interface{}, rCode int, tpl *template.Template) {
	// In case of HTML response, setting appropriate header type for text/HTML response
	w.Header().Set(HeaderContentType, HTMLContentType)
	w.WriteHeader(rCode)

	// Rendering an HTML template with appropriate data
	err := tpl.Execute(w, data)
	if err != nil {
		LOGHANDLER.Error(err.Error())
	}
}
867128
func Render(v string, ctx *Context) (string, error) {
	return (&I{Value: v}).Render(ctx)
}
1351609
func (s *Site) renderPages(ctx *siteRenderContext) error {

	numWorkers := config.GetNumWorkerMultiplier()

	results := make(chan error)
	pages := make(chan *pageState, numWorkers) // buffered for performance
	errs := make(chan error)

	go s.errorCollator(results, errs)

	wg := &sync.WaitGroup{}

	for i := 0; i < numWorkers; i++ {
		wg.Add(1)
		go pageRenderer(ctx, s, pages, results, wg)
	}

	cfg := ctx.cfg

	if !cfg.PartialReRender && ctx.outIdx == 0 && len(s.headlessPages) > 0 {
		wg.Add(1)
		go headlessPagesPublisher(s, wg)
	}

L:
	for _, page := range s.workAllPages {
		if cfg.shouldRender(page) {
			select {
			case <-s.h.Done():
				break L
			default:
				pages <- page
			}
		}
	}

	close(pages)

	wg.Wait()

	close(results)

	err := <-errs
	if err != nil {
		return errors.Wrap(err, "failed to render pages")
	}
	return nil
}
733877
func Render404(w http.ResponseWriter, tpl *template.Template) {
	Render(w, ErrorData{
		http.StatusNotFound,
		"Sorry, the URL you requested was not found on this server... Or you're lost :-/",
	},
		http.StatusNotFound,
		tpl,
	)
}
472291
func (t *Table) Render() string {
	// Elements is already populated with row data.
	switch t.outputMode {
	case outputTerminal:
		return t.renderTerminal()
	case outputMarkdown:
		return t.renderMarkdown()
	case outputHTML:
		return t.RenderHTML()
	default:
		panic("unknown output mode set")
	}
}
862502
func Render(c context.Context, name string, args Args) ([]byte, error) {
	if b, _ := c.Value(&contextKey).(*boundBundle); b != nil {
		return b.Render(c, b.Extra, name, args)
	}
	return nil, errNoBundle
}
106081
func (p *WebPage) Pages() ([]*WebPage, error) {
	var resp struct {
		Refs []refJSON `json:"refs"`
	}
	if err := p.ref.process.doJSON("POST", "/webpage/Pages", map[string]interface{}{"ref": p.ref.id}, &resp); err != nil {
		return nil, err
	}

	// Convert reference IDs to web pages.
	a := make([]*WebPage, len(resp.Refs))
	for i, ref := range resp.Refs {
		a[i] = &WebPage{ref: newRef(p.ref.process, ref.ID)}
	}
	return a, nil
}
1257351
func Render(w http.ResponseWriter, r *http.Request, v Renderer) error {
	if err := renderer(w, r, v); err != nil {
		return err
	}
	Respond(w, r, v)
	return nil
}