io

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2026 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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"`
	UserId   *string `json:"userId"`
	UserName *string `json:"userName"`
}

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) (*EtherpadExport, error)

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   string  `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) *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 imports HTML content into a pad Note: This currently imports only the text content. Full formatting support would require complex changeset generation which is error-prone. For full formatting preservation, export/import via .etherpad format is recommended.

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"`
}

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"`
}

Jump to

Keyboard shortcuts

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