render

package
v0.19.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2023 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package render handles template parsing and execution for services.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Digest added in v0.15.1

func Digest(cols []wayback.Collect, rdx reduxer.Reduxer) (dgst string)

Digest returns digest of the webpage content. Its maximum length is defined by `maxDigestLen`.

func Title added in v0.15.1

func Title(cols []wayback.Collect, rdx reduxer.Reduxer) (title string)

Title returns the title of the webpage. Its maximum length is defined by `maxTitleLen`.

Types

type Collect

type Collect struct {
	Arc, Ext, Src string

	Dst []map[string]string // wayback results
}

Collect represents a render data collection. Arc is name of the archive service, Dst mapping the original URL and archived destination URL, Ext is extra descriptions.

type Collects

type Collects map[string]Collect

Collects represents a set of Collect in a map, and its key is a URL string.

type Discord added in v0.15.1

type Discord struct {
	Cols []wayback.Collect
	Data reduxer.Reduxer
}

Discord represents a Discord template data for render.

func (*Discord) ForPublish added in v0.15.1

func (d *Discord) ForPublish() (r *Render)

ForPublish implements the standard Renderer interface: it reads `[]wayback.Collect` and `reduxer.Reduxer` from the Discord and returns a *Render.

func (*Discord) ForReply added in v0.15.1

func (d *Discord) ForReply() (r *Render)

ForReply implements the standard Renderer interface: it reads `[]wayback.Collect` from the Discord and returns a *Render.

type GitHub

type GitHub struct {
	Cols []wayback.Collect
	Data reduxer.Reduxer
}

GitHub represents a GitHub template data for render.

func (*GitHub) ForPublish

func (gh *GitHub) ForPublish() *Render

ForPublish implements the standard Renderer interface: it reads `[]wayback.Collect` and `reduxer.Reduxer` from the GitHub and returns a *Render.

func (*GitHub) ForReply

func (gh *GitHub) ForReply() *Render

ForReply implements the standard Renderer interface: it returns a Render from the ForPublish.

type Mastodon

type Mastodon struct {
	Cols []wayback.Collect
	Data reduxer.Reduxer
}

Mastodon represents a Mastodon template data for render.

func (*Mastodon) ForPublish

func (m *Mastodon) ForPublish() *Render

ForPublish implements the standard Renderer interface: it reads `[]wayback.Collect` and `reduxer.Reduxer` from the Mastodon and returns a *Render.

func (*Mastodon) ForReply

func (m *Mastodon) ForReply() *Render

ForReply implements the standard Renderer interface: it returns a Render from the ForPublish.

type Matrix

type Matrix struct {
	Cols []wayback.Collect
	Data reduxer.Reduxer
}

Matrix represents a Matrix template data for render.

func (*Matrix) ForPublish

func (m *Matrix) ForPublish() *Render

ForPublish implements the standard Renderer interface: it reads `[]wayback.Collect` and `reduxer.Reduxer` from the Matrix and returns a *Render.

func (*Matrix) ForReply

func (m *Matrix) ForReply() *Render

ForReply implements the standard Renderer interface: it reads `[]wayback.Collect` from the Matrix and returns a *Render.

type Nostr added in v0.19.0

type Nostr struct {
	Cols []wayback.Collect
	Data reduxer.Reduxer
}

Nostr represents a Nostr template data for render.

func (*Nostr) ForPublish added in v0.19.0

func (n *Nostr) ForPublish() *Render

ForPublish implements the standard Renderer interface: it reads `[]wayback.Collect` and `reduxer.Reduxer` from the Nostr and returns a *Render.

ForPublish generate tweet of given wayback collects in Nostr struct. It excluded telegra.ph, because this link has been identified by Nostr.

func (*Nostr) ForReply added in v0.19.0

func (n *Nostr) ForReply() *Render

ForReply implements the standard Renderer interface: it reads `[]wayback.Collect` from the Nostr and returns a *Render.

type Notion added in v0.18.0

type Notion struct {
	Cols []wayback.Collect
	Data reduxer.Reduxer
}

Notion represents a Notion template data for render.

func (*Notion) ForPublish added in v0.18.0

func (no *Notion) ForPublish() *Render

ForPublish implements the standard Renderer interface: it reads `[]wayback.Collect` and `reduxer.Reduxer` from the Notion and returns a *Render.

func (*Notion) ForReply added in v0.18.0

func (no *Notion) ForReply() *Render

ForReply implements the standard Renderer interface: it returns a Render from the ForPublish.

type Relaychat

type Relaychat struct {
	Cols []wayback.Collect
	Data interface{}
}

Relaychat represents a Relaychat template data for render.

func (*Relaychat) ForPublish

func (i *Relaychat) ForPublish() *Render

ForPublish implements the standard Renderer interface: it reads `[]wayback.Collect` from the Relaychat and returns a *Render.

func (*Relaychat) ForReply

func (i *Relaychat) ForReply() *Render

ForReply implements the standard Renderer interface: it returns a Render from the ForPublish.

type Render

type Render struct {
	// contains filtered or unexported fields
}

Render represents a Render result.

func ForPublish

func ForPublish(r Renderer) *Render

ForPublish handles render template for publishing, it returns a Render.

func ForReply

func ForReply(r Renderer) *Render

ForReply handles render template for replying to user, it returns a Render.

func (*Render) String

func (r *Render) String() string

String returns a string from the Render.

type Renderer

type Renderer interface {
	// ForReply render text for reply to user.
	ForReply() *Render

	// ForPublish render text for publish.
	ForPublish() *Render
}

Renderer is the interface that wraps the ForReply and ForPublish method.

type Slack added in v0.15.1

type Slack struct {
	Cols []wayback.Collect
	Data reduxer.Reduxer
}

Slack represents a Slack template data for render.

func (*Slack) ForPublish added in v0.15.1

func (s *Slack) ForPublish() (r *Render)

ForPublish implements the standard Renderer interface: it reads `[]wayback.Collect` and `reduxer.Reduxer` from the Slack and returns a *Render.

func (*Slack) ForReply added in v0.15.1

func (s *Slack) ForReply() (r *Render)

ForReply implements the standard Renderer interface: it reads `[]wayback.Collect` from the Slack and returns a *Render.

type Telegram

type Telegram struct {
	Cols []wayback.Collect
	Data reduxer.Reduxer
}

Telegram represents a Telegram template data for render.

func (*Telegram) ForPublish

func (t *Telegram) ForPublish() (r *Render)

ForPublish implements the standard Renderer interface: it reads `[]wayback.Collect` and `reduxer.Reduxer` from the Telegram and returns a *Render.

func (*Telegram) ForReply

func (t *Telegram) ForReply() (r *Render)

ForReply implements the standard Renderer interface: it reads `[]wayback.Collect` from the Telegram and returns a *Render.

type Twitter

type Twitter struct {
	Cols []wayback.Collect
	Data reduxer.Reduxer
}

Twitter represents a Twitter template data for render.

func (*Twitter) ForPublish

func (t *Twitter) ForPublish() *Render

ForPublish implements the standard Renderer interface: it reads `[]wayback.Collect` and `reduxer.Reduxer` from the Twitter and returns a *Render.

ForPublish generate tweet of given wayback collects in Twitter struct. It excluded telegra.ph, because this link has been identified by Twitter.

func (*Twitter) ForReply

func (t *Twitter) ForReply() *Render

ForReply implements the standard Renderer interface: it reads `[]wayback.Collect` from the Twitter and returns a *Render.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL