io

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: Apache-2.0 Imports: 41 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

View Source
var ErrInvalidEtherpadFile = errors.New("invalid etherpad file")

ErrInvalidEtherpadFile wraps every reason a .etherpad file is rejected before it is written.

Functions

func GetPadTxt

func GetPadTxt(pad pad2.Pad, revNum *int) (*string, error)

Types

type AText

type AText struct {
	Text    string `json:"text"`
	Attribs string `json:"attribs"`
}

type ChatMessage

type ChatMessage struct {
	Text string `json:"text"`
	Time *int64 `json:"time"`
	// AuthorId is etherpad-lite's field; UserId the older name, which
	// etherpad-go exports wrote. Both are written and either is read.
	AuthorId *string `json:"authorId,omitempty"`
	UserId   *string `json:"userId"`
	UserName *string `json:"userName"`
}

func (ChatMessage) Author added in v0.7.0

func (c ChatMessage) Author() *string

Author is the chat message's author from either field.

type EtherpadExport

type EtherpadExport struct {
	Pad       map[string]PadData      `json:"-"`
	Authors   map[string]GlobalAuthor `json:"-"`
	Chats     map[string]ChatMessage  `json:"-"`
	Revisions map[string]Revision     `json:"-"`
}

func (EtherpadExport) MarshalJSON

func (e EtherpadExport) MarshalJSON() ([]byte, error)

type EtherpadImport

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

type ExportDocx

type ExportDocx struct {
	Hooks *hooks.Hook
	// contains filtered or unexported fields
}

func NewExportDocx

func NewExportDocx(padManager *padLib.Manager, authorManager *author.Manager, hooksSystem *hooks.Hook) *ExportDocx

func (*ExportDocx) GetPadDocxDocument

func (e *ExportDocx) GetPadDocxDocument(padId string, optRevNum *int) ([]byte, error)

type ExportEtherpad

type ExportEtherpad struct {
	PadManager    *pad.Manager
	AuthorManager *author.Manager
	// contains filtered or unexported fields
}

func NewExportEtherpad

func NewExportEtherpad(hooks *hooks.Hook, padManager *pad.Manager, db db.DataStore, logger *zap.SugaredLogger, uiAssets embed.FS) *ExportEtherpad

func (*ExportEtherpad) DoExport

func (e *ExportEtherpad) DoExport(ctx fiber.Ctx, id string, readOnlyId *string, fileExportType string) error

func (*ExportEtherpad) GetPadRaw

func (e *ExportEtherpad) GetPadRaw(padId string, readOnlyId *string, revNum *int) (*EtherpadExport, error)

GetPadRaw builds a .etherpad export. With revNum set (a /:rev/export request) the export is a point-in-time snapshot: head, text and revisions stop at that revision, and chat only contains messages posted no later than it (etherpad-lite #8389). Without it the whole pad is exported.

type ExportHtml

type ExportHtml struct {
	PadManager    *padLib.Manager
	AuthorManager *author.Manager
	Hooks         *hooks.Hook
}

func NewExportHtml

func NewExportHtml(padManager *padLib.Manager, authorManager *author.Manager, hooks *hooks.Hook) *ExportHtml

func (*ExportHtml) Export

func (e *ExportHtml) Export(padId string, revNum *int) (string, error)

Export returns a rendered HTML string (for interface compatibility)

func (*ExportHtml) GetPadHTML

func (e *ExportHtml) GetPadHTML(pad *padModel.Pad, revNum *int, authorColors map[string]string) (string, error)

GetPadHTML returns the HTML content for a pad (without document wrapper)

func (*ExportHtml) GetPadHTMLDocument

func (e *ExportHtml) GetPadHTMLDocument(padId string, revNum *int, readOnlyId *string) (string, error)

GetPadHTMLDocument returns the full HTML document for a pad

type ExportMarkdown added in v0.0.4

type ExportMarkdown struct {
	PadManager *pad.Manager
	Hooks      *hooks.Hook
}

func NewExportMarkdown added in v0.0.4

func NewExportMarkdown(padManager *pad.Manager, hooksSystem *hooks.Hook) *ExportMarkdown

func (*ExportMarkdown) GetPadMarkdownDocument added in v0.0.4

func (em *ExportMarkdown) GetPadMarkdownDocument(padID string, revNum *int) (*string, error)

type ExportOdt

type ExportOdt struct {
	Hooks *hooks.Hook
	// contains filtered or unexported fields
}

func NewExportOdt

func NewExportOdt(padManager *padLib.Manager, authorManager *author.Manager, hooksSystem *hooks.Hook) *ExportOdt

func (*ExportOdt) GetPadOdtDocument

func (e *ExportOdt) GetPadOdtDocument(padId string, optRevNum *int) ([]byte, error)

type ExportPDF

type ExportPDF struct {
	Hooks *hooks.Hook
	// contains filtered or unexported fields
}

func (*ExportPDF) GetPadPdfDocument

func (e *ExportPDF) GetPadPdfDocument(padId string, optRevNum *int) ([]byte, error)

type ExportTxt

type ExportTxt struct {
	PadManager *pad3.Manager
}

func (*ExportTxt) GetPadTxtDocument

func (e *ExportTxt) GetPadTxtDocument(padId string, revNum *int) (*string, error)

type FindURLPair added in v0.0.4

type FindURLPair struct {
	StartIndex int
	Url        string
}

type GlobalAuthor

type GlobalAuthor struct {
	ColorId   any     `json:"colorId"`
	Timestamp int64   `json:"timestamp"`
	PadIDs    string  `json:"padIDs"`
	Name      *string `json:"name"`
}

type Importer

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

func NewImporter

func NewImporter(padManager *pad.Manager, authorManager *author.Manager, db db.DataStore, logger *zap.SugaredLogger, hooks *hooks.Hook) *Importer

func (*Importer) ExtractEtherpadFromPdf

func (i *Importer) ExtractEtherpadFromPdf(content []byte) ([]byte, error)

ExtractEtherpadFromPdf extracts embedded Etherpad JSON data from a PDF file This is similar to how ZUGFeRD embeds XML in PDF, but uses JSON for Etherpad data Returns nil if no embedded Etherpad data is found

func (*Importer) ExtractTextFromDocx

func (i *Importer) ExtractTextFromDocx(content []byte) (string, error)

ExtractTextFromDocx extracts text content from a DOCX file

func (*Importer) ExtractTextFromEtherpadJson

func (i *Importer) ExtractTextFromEtherpadJson(content []byte) (string, error)

ExtractTextFromEtherpadJson extracts the plain text content from Etherpad JSON export

func (*Importer) ExtractTextFromOdt

func (i *Importer) ExtractTextFromOdt(content []byte) (string, error)

ExtractTextFromOdt extracts text content from an ODT file

func (*Importer) ExtractTextFromPdf

func (i *Importer) ExtractTextFromPdf(content []byte) (string, error)

ExtractTextFromPdf extracts text content from a PDF file using the ledongthuc/pdf library

func (*Importer) ExtractTextFromRtf

func (i *Importer) ExtractTextFromRtf(content []byte) (string, error)

ExtractTextFromRtf extracts text content from an RTF file

func (*Importer) SetPadHTML

func (i *Importer) SetPadHTML(pad *padModel.Pad, htmlContent string, authorId string) error

SetPadHTML replaces the pad's content with the HTML, keeping its formatting (see import_html.go), in one revision.

func (*Importer) SetPadRaw

func (i *Importer) SetPadRaw(padId string, content []byte, authorId string) error

func (*Importer) SetPadText

func (i *Importer) SetPadText(pad *padModel.Pad, text string, authorId string) error

SetPadText imports plain text into a pad

type PadData

type PadData struct {
	AText          AText `json:"atext"`
	Pool           Pool  `json:"pool"`
	Head           int   `json:"head"`
	ChatHead       int   `json:"chatHead"`
	PublicStatus   bool  `json:"publicStatus"`
	SavedRevisions []any `json:"savedRevisions"`
	// PadSettings are the pad-wide settings (etherpad-lite padSettings).
	PadSettings json.RawMessage `json:"padSettings,omitempty"`
}

type Pool

type Pool struct {
	NumToAttrib map[string][]string `json:"numToAttrib"`
	NextNum     int                 `json:"nextNum"`
}

type PoolWithAttribToNum

type PoolWithAttribToNum struct {
	NumToAttrib map[string][]string `json:"numToAttrib"`
	AttribToNum map[string]int      `json:"attribToNum"`
	NextNum     int                 `json:"nextNum"`
}

type Revision

type Revision struct {
	Changeset string       `json:"changeset"`
	Meta      RevisionMeta `json:"meta"`
}

type RevisionMeta

type RevisionMeta struct {
	Author    *string              `json:"author"`
	Timestamp *int64               `json:"timestamp"`
	Pool      *PoolWithAttribToNum `json:"pool,omitempty"`
	AText     *AText               `json:"atext,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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