article

package
v0.0.0-...-b34ddb9 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClassFgPrefix       = `f`
	ClassBgPrefix       = `b`
	ClassHighlight      = `hl`
	ClassPushDiv        = `push`
	ClassPushTag        = `push-tag`
	ClassPushUserId     = `push-userid`
	ClassPushContent    = `push-content`
	ClassPushIpDatetime = `push-ipdatetime`

	ClassArticleMetaLine      = `article-metaline`
	ClassArticleMetaLineRight = `article-metaline-right`
	ClassArticleMetaTag       = `article-meta-tag`
	ClassArticleMetaValue     = `article-meta-value`
)
View Source
const (
	NoFlags = 1 << iota
	Highlighted
)

Flags

View Source
const (
	DefaultFg = 7
	DefaultBg = 0
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ExtraFlag

type ExtraFlag int
const (
	PushTag ExtraFlag = 1 << iota
	PushUserId
	PushContent
	PushIpDateTime
	PushMaxVal // Dummy value
)

type IndexMapper

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

func NewIndexMapper

func NewIndexMapper(elemLen int) *IndexMapper

func (*IndexMapper) Get

func (im *IndexMapper) Get(from int) []int

func (*IndexMapper) Record

func (im *IndexMapper) Record(from int, to ...int)

func (*IndexMapper) Reset

func (im *IndexMapper) Reset()

type RenderOption

type RenderOption func(*renderer)

func WithContent

func WithContent(content []byte) RenderOption

func WithContext

func WithContext(ctx context.Context) RenderOption

func WithDisableArticleHeader

func WithDisableArticleHeader() RenderOption

type RenderedArticle

type RenderedArticle interface {
	ParsedTitle() string
	PreviewContent() string
	HTML() []byte
}

func Render

func Render(opts ...RenderOption) (RenderedArticle, error)

type Segment

type Segment struct {
	*bytes.Buffer
	Tag        string
	ExtraFlags ExtraFlag
	TermState  TerminalState
}

func (*Segment) HasExtraFlags

func (s *Segment) HasExtraFlags(fl ExtraFlag) bool

func (*Segment) InnerBytes

func (s *Segment) InnerBytes() []byte

func (*Segment) TrimRight

func (s *Segment) TrimRight(cutset string)

func (*Segment) WriteClose

func (s *Segment) WriteClose(w io.Writer) (int, error)

func (*Segment) WriteInner

func (s *Segment) WriteInner(w io.Writer) (int, error)

func (*Segment) WriteOpen

func (s *Segment) WriteOpen(w io.Writer) (int, error)

func (*Segment) WriteTo

func (s *Segment) WriteTo(w io.Writer) (total int64, err error)

type TerminalState

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

func (*TerminalState) ApplyEscapeSequence

func (t *TerminalState) ApplyEscapeSequence(esc ansi.EscapeSequence)

func (*TerminalState) Bg

func (t *TerminalState) Bg() int

func (*TerminalState) Equal

func (t *TerminalState) Equal(u *TerminalState) bool

func (*TerminalState) Fg

func (t *TerminalState) Fg() int

func (*TerminalState) Flags

func (t *TerminalState) Flags() int

func (*TerminalState) HasFlags

func (t *TerminalState) HasFlags(f int) bool

func (*TerminalState) IsDefaultState

func (t *TerminalState) IsDefaultState() bool

func (*TerminalState) Reset

func (t *TerminalState) Reset()

func (*TerminalState) SetColor

func (t *TerminalState) SetColor(fg, bg, flags int)

Jump to

Keyboard shortcuts

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