adapters

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package adapters contains source-format codecs for rich text documents.

Index

Constants

View Source
const DOCXMediaType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
View Source
const XLSXMediaType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"

Variables

This section is empty.

Functions

func Codecs added in v0.5.0

func Codecs() []vfs.Codec

Codecs are the Word and Excel codecs, for OpenVFS.WithCodecs. HTML is not among them: text/html stays a text type, so .html files keep raw-byte writes; a host that wants HTML blocks adds vfs.BlockCodec with HTML itself.

Types

type DOCX

type DOCX struct{}

DOCX converts the main document part of a Word document. It intentionally operates on the portable WordprocessingML subset used by common editors.

func (DOCX) DecodeBlocks

func (DOCX) DecodeBlocks(ctx context.Context, path, _ string, data []byte) ([]vfs.Block, error)

func (DOCX) EncodeBlocks

func (DOCX) EncodeBlocks(ctx context.Context, blocks []vfs.Block) ([]byte, error)

type HTML

type HTML struct{}

HTML encodes and decodes the pretty HTML dialect used for Docs/Word agent buffers. It is not registered as the text/html file codec (FUSE would steal .html). One heading, paragraph, list item, or table per line.

func (HTML) DecodeBlocks

func (HTML) DecodeBlocks(ctx context.Context, _ string, _ string, data []byte) ([]vfs.Block, error)

func (HTML) EncodeBlocks

func (HTML) EncodeBlocks(ctx context.Context, blocks []vfs.Block) ([]byte, error)

type XLSX

type XLSX struct{}

XLSX is the vfs.SheetNormalizer of Excel workbooks: it maps workbook.xml, sheetN.xml, sharedStrings.xml and styles.xml to sheets. Codecs registers it in a vfs.TabularCodec.

func (XLSX) DecodeSheets

func (XLSX) DecodeSheets(ctx context.Context, _, _ string, data []byte) ([]vfs.Sheet, []vfs.NamedRange, error)

func (XLSX) EncodeSheets

func (XLSX) EncodeSheets(ctx context.Context, sheets []vfs.Sheet, _ []vfs.NamedRange) ([]byte, error)

Jump to

Keyboard shortcuts

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