Package iframe

import "gitlab.com/zoralab/bissetii/pkg/internal/iframe"

Package iframe is the full package for rendering all compatible iframe.

The HTML template codes are written in Go’s string format under the corresponding group. This allows one to embed the HTML codes instead of parsing it from file.

Constants

Constants for managing the package as a whole.

const (
	// Name is the block name (`{{- define "this-name" -}}`).
	Name = "iframe"

	// AMPName is the AMP HTML block name.
	AMPName = root.AMPPrefix + Name

	// ParametersComment are the list of comment headers
	// describing inputs.
	ParametersComment = `
{{- /* .URL         - the targeted iframe                               */ -}}
{{- /* .Sandbox     - the sandbox value for the iframe                  */ -}}
{{- /* .Width       - the width for the iframe                          */ -}}
{{- /* .Height      - the height for the iframe                         */ -}}
{{- /* .Class       - the class for the iframe                          */ -}}
{{- /* .Content     - the content of the iframe                         */ -}}
{{- /* .Title       - the title for the iframe                          */ -}}
{{- /* .Layout      - the layout value (e.g. <amp-iframe>)              */ -}}

`
)

Full HTML codes for rendering templates without needing to parse file.

const (
	// HTML is the vanilla HTML output type.
	HTML = `
<iframe src="{{- .URL -}}"
        sandbox="{{- .Sandbox -}}"
{{- if .Width }}
        width="{{- .Width -}}"
{{- end }}
{{- if .Height }}
        height="{{- .Height -}}"
{{- end }}
{{- if .Class }}
        class="{{- .Class -}}"
{{- end }}
{{- if .Title }}
        title="{{- .Title -}}"
{{- end }}>
        {{ .Content -}}
</iframe>
`

	// AMPHTML is the Accelerated Mobile Pages HTML output type.
	AMPHTML = `
<amp-iframe src="{{- .URL -}}"
        sandbox="{{- .Sandbox -}}"
        width="{{- .Width -}}"
        height="{{- .Height -}}"
{{- if .Class }}
        class="{{- .Class -}}"
{{- end }}
        layout="{{- .Layout -}}">
        {{ .Content -}}
</amp-iframe>
`
)

Data

type Data struct {
	URL     string
	SandBox string
	Width   string
	Height  string
	Class   string
	Content string
	Title   string
	Layout  string
}

Data is the data structure for rendering the component.