| 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 | |
| 5 | package presentscip-go gomod golang.org/x/tools . `golang.org/x/tools/present`/ |
| 6 | |
| 7 | import ( |
| 8 | "fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/" |
| 9 | "stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/" |
| 10 | ) |
| 11 | |
| 12 | func initscip-go gomod golang.org/x/tools . `golang.org/x/tools/present`/init().() { |
| 13 | Registerscip-go gomod golang.org/x/tools . `golang.org/x/tools/present`/Register().("iframe", parseIframescip-go gomod golang.org/x/tools . `golang.org/x/tools/present`/parseIframe().) |
| 14 | } |
| 15 | |
| 16 | type Iframescip-go gomod golang.org/x/tools . `golang.org/x/tools/present`/Iframe# struct { |
| 17 | Cmdscip-go gomod golang.org/x/tools . `golang.org/x/tools/present`/Iframe#Cmd. string // original command from present source |
| 18 | URLscip-go gomod golang.org/x/tools . `golang.org/x/tools/present`/Iframe#URL. string |
| 19 | Widthscip-go gomod golang.org/x/tools . `golang.org/x/tools/present`/Iframe#Width. int |
| 20 | Heightscip-go gomod golang.org/x/tools . `golang.org/x/tools/present`/Iframe#Height. int |
| 21 | } |
| 22 | |
| 23 | func (i Iframescip-go gomod golang.org/x/tools . `golang.org/x/tools/present`/Iframe#) PresentCmdscip-go gomod golang.org/x/tools . `golang.org/x/tools/present`/Iframe#PresentCmd().() string { return i.Cmdscip-go gomod golang.org/x/tools . `golang.org/x/tools/present`/Iframe#Cmd. } |
| 24 | func (i Iframescip-go gomod golang.org/x/tools . `golang.org/x/tools/present`/Iframe#) TemplateNamescip-go gomod golang.org/x/tools . `golang.org/x/tools/present`/Iframe#TemplateName().() string { return "iframe" } |
| 25 | |
| 26 | func parseIframescip-go gomod golang.org/x/tools . `golang.org/x/tools/present`/parseIframe().(ctx *Contextscip-go gomod golang.org/x/tools . `golang.org/x/tools/present`/Context#, fileName string, lineno int, text string) (Elemscip-go gomod golang.org/x/tools . `golang.org/x/tools/present`/Elem#, error) { |
| 27 | args := stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.Fieldsscip-go gomod github.com/golang/go/src go1.25.0 strings/Fields().(text) |
| 28 | if len(args) < 2 { |
| 29 | return nil, fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Errorf().("incorrect iframe invocation: %q", text) |
| 30 | } |
| 31 | i := Iframescip-go gomod golang.org/x/tools . `golang.org/x/tools/present`/Iframe#{Cmdscip-go gomod golang.org/x/tools . `golang.org/x/tools/present`/Iframe#Cmd.: text, URLscip-go gomod golang.org/x/tools . `golang.org/x/tools/present`/Iframe#URL.: args[1]} |
| 32 | a, err := parseArgsscip-go gomod golang.org/x/tools . `golang.org/x/tools/present`/parseArgs().(fileName, lineno, args[2:]) |
| 33 | if err != nil { |
| 34 | return nil, err |
| 35 | } |
| 36 | switch len(a) { |
| 37 | case 0: |
| 38 | // no size parameters |
| 39 | case 2: |
| 40 | if v, ok := a[0].(int); ok { |
| 41 | i.Heightscip-go gomod golang.org/x/tools . `golang.org/x/tools/present`/Iframe#Height. = v |
| 42 | } |
| 43 | if v, ok := a[1].(int); ok { |
| 44 | i.Widthscip-go gomod golang.org/x/tools . `golang.org/x/tools/present`/Iframe#Width. = v |
| 45 | } |
| 46 | default: |
| 47 | return nil, fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Errorf().("incorrect iframe invocation: %q", text) |
| 48 | } |
| 49 | return i, nil |
| 50 | } |