GoPLS Viewer

Home|gopls/present/html.go
1// Copyright 2013 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5package present
6
7import (
8    "errors"
9    "html/template"
10    "path/filepath"
11    "strings"
12)
13
14func init() {
15    Register("html"parseHTML)
16}
17
18func parseHTML(ctx *ContextfileName stringlineno inttext string) (Elemerror) {
19    p := strings.Fields(text)
20    if len(p) != 2 {
21        return nilerrors.New("invalid .html args")
22    }
23    name := filepath.Join(filepath.Dir(fileName), p[1])
24    berr := ctx.ReadFile(name)
25    if err != nil {
26        return nilerr
27    }
28    return HTML{texttemplate.HTML(b)}, nil
29}
30
31type HTML struct {
32    Cmd string // original command from present source
33    template.HTML
34}
35
36func (s HTMLPresentCmd() string   { return s.Cmd }
37func (s HTMLTemplateName() string { return "html" }
38
MembersX
parseHTML.text
parseHTML.name
HTML
HTML.TemplateName
parseHTML.ctx
parseHTML.lineno
parseHTML.b
parseHTML.err
HTML.PresentCmd
parseHTML
HTML.PresentCmd.s
HTML.TemplateName.s
parseHTML.fileName
parseHTML.p
HTML.Cmd
Members
X