GoPLS Viewer

Home|gopls/present/iframe.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    "fmt"
9    "strings"
10)
11
12func init() {
13    Register("iframe"parseIframe)
14}
15
16type Iframe struct {
17    Cmd    string // original command from present source
18    URL    string
19    Width  int
20    Height int
21}
22
23func (i IframePresentCmd() string   { return i.Cmd }
24func (i IframeTemplateName() string { return "iframe" }
25
26func parseIframe(ctx *ContextfileName stringlineno inttext string) (Elemerror) {
27    args := strings.Fields(text)
28    if len(args) < 2 {
29        return nilfmt.Errorf("incorrect iframe invocation: %q"text)
30    }
31    i := Iframe{CmdtextURLargs[1]}
32    aerr := parseArgs(fileNamelinenoargs[2:])
33    if err != nil {
34        return nilerr
35    }
36    switch len(a) {
37    case 0:
38        // no size parameters
39    case 2:
40        if vok := a[0].(int); ok {
41            i.Height = v
42        }
43        if vok := a[1].(int); ok {
44            i.Width = v
45        }
46    default:
47        return nilfmt.Errorf("incorrect iframe invocation: %q"text)
48    }
49    return inil
50}
51
MembersX
Iframe.TemplateName.i
Iframe.TemplateName
parseIframe.i
Iframe.PresentCmd
Iframe.Width
Iframe.PresentCmd.i
parseIframe.fileName
parseIframe.text
parseIframe.a
parseIframe.err
Iframe
Iframe.URL
parseIframe
parseIframe.args
Iframe.Cmd
parseIframe.ctx
parseIframe.lineno
Iframe.Height
Members
X