padutil

package
v0.0.0-...-00088c8 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2022 License: MIT Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	LineStart int
	LineEnd   int
}

Block represents a

type Etherpad

type Etherpad struct {
	etherpadlite.EtherpadLite
}

Etherpad adds a few utility functions.

func (*Etherpad) Exists

func (p *Etherpad) Exists(ctx context.Context, id string) (bool, error)

Exists returns true, if a pad with a given id exists.

func (*Etherpad) GetPadSavedRevisions

func (p *Etherpad) GetPadSavedRevisions(ctx context.Context, id string) (*PadSavedRevisions, error)

func (*Etherpad) GetPadText

func (p *Etherpad) GetPadText(ctx context.Context, id string) (*PadText, error)

GetPadText is a convenience function to get rid of type assertions.

type PadSavedRevisions

type PadSavedRevisions struct {
	Code int64
	Data struct {
		SavedRevisions []int64 `json:"savedRevisions"`
	}
	Message string
}

type PadText

type PadText struct {
	Code int64
	Data struct {
		Text string `json:"text"`
	}
	Message string
}

PadText is a response to a GetText response.

type PadTextAttribs

type PadTextAttribs struct {
	Code int64
	Data struct {
		Text struct {
			Attribs string `json:"attribs"`
			Text    string `json:"text"`
		} `json:"text"`
	}
	Message string
}

PadTextAttribs is a response to a GetText response.

type Runner

type Runner interface {
	Run(w io.Writer, s *Snippet) error
}

Runner executes a snippet of code and writes combined output of the program to the given writer.

type SimpleFileRunner

type SimpleFileRunner struct {
	Prefix []string
}

SimpleFileRunner just executes code on the host, without any security features.

func (*SimpleFileRunner) Run

func (r *SimpleFileRunner) Run(w io.Writer, s *Snippet) error

type Snippet

type Snippet struct {
	Tag   string
	Text  string
	Block Block
}

Snippet contains a types piece of text, e.g. a code block in a given language.

func (*Snippet) NumLines

func (s *Snippet) NumLines() int

NumLines return number of lines of the snippet.

type Text

type Text struct {
	Content string
}

Text represents a blob of text from a pad. This struct allows to find and access code snippets in the text.

func (*Text) Snippets

func (t *Text) Snippets() (snippets []*Snippet)

Jump to

Keyboard shortcuts

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