converter

package
v0.0.0-...-614c6bf Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: AGPL-3.0 Imports: 40 Imported by: 0

Documentation

Overview

Package converter provides bookmark export/converter tooling.

Index

Constants

This section is empty.

Variables

View Source
var WithAtomStylesheet, _ = ctxr.WithChecker[string](ctxAtomStylesheetKey{})

WithAtomStylesheet sets an XSL stylesheet URL to the context.

View Source
var (
	WithEnableEPUBNotes, _ = ctxr.WithChecker[bool](ctxEnableEPUBNotesKey{})
)

Context helpers.

Functions

This section is empty.

Types

type AtomExporter

type AtomExporter struct {
	dataset.HTMLConverter
}

AtomExporter is an Exporter that produces an Atom feed.

func NewAtomExporter

func NewAtomExporter() AtomExporter

NewAtomExporter return a new AtomExporter instance.

func (AtomExporter) Export

func (e AtomExporter) Export(ctx context.Context, w io.Writer, r *http.Request, bookmarkList *dataset.BookmarkList) error

Export implements Exporter.

type BrowserExporter

type BrowserExporter struct{}

BrowserExporter is an IterExporter that produces a browser bookmark file.

func (BrowserExporter) IterExport

func (e BrowserExporter) IterExport(_ context.Context, w io.Writer, r *http.Request, bookmarkSeq *dataset.BookmarkIterator) error

IterExport implements IterExporter.

type CSVExporter

type CSVExporter struct{}

CSVExporter is an IterExporter that produces a CSV file.

func (CSVExporter) IterExport

func (e CSVExporter) IterExport(_ context.Context, w io.Writer, _ *http.Request, bookmarkSeq *dataset.BookmarkIterator) error

IterExport implements IterExporter.

type EPUBEmailExporter

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

EPUBEmailExporter is a content exporter that send converted bookmarks as EPUB attachment by emails.

func NewEPUBEmailExporter

func NewEPUBEmailExporter(to string, options ...email.MessageOption) EPUBEmailExporter

NewEPUBEmailExporter returns an NewEPUBEmailExporter instance.

func (EPUBEmailExporter) Export

func (e EPUBEmailExporter) Export(ctx context.Context, _ io.Writer, r *http.Request, bookmarkList *dataset.BookmarkList) error

Export implements Exporter. It create an email with the bookmark's EPUB file attached to it.

type EPUBExporter

type EPUBExporter struct {
	dataset.HTMLConverter
	Collection *bookmarks.Collection
}

EPUBExporter is a content exporter that produces EPUB files.

func NewEPUBExporter

func NewEPUBExporter() EPUBExporter

NewEPUBExporter returns a new EPUBExporter instance.

func (EPUBExporter) IterExport

func (e EPUBExporter) IterExport(ctx context.Context, w io.Writer, r *http.Request, bookmarkSeq *dataset.BookmarkIterator) error

IterExport implements IterExporter. It writes an EPUB file on the provided io.Writer.

type Exporter

type Exporter interface {
	Export(ctx context.Context, w io.Writer, r *http.Request, bookmarkList *dataset.BookmarkList) error
}

Exporter describes a bookmarks exporter.

type HTMLEmailExporter

type HTMLEmailExporter struct {
	dataset.HTMLConverter
	// contains filtered or unexported fields
}

HTMLEmailExporter is a content exporter that send bookmarks by emails.

func NewHTMLEmailExporter

func NewHTMLEmailExporter(to string, options ...email.MessageOption) HTMLEmailExporter

NewHTMLEmailExporter returns a new HTMLEmailExporter instance.

func (HTMLEmailExporter) Export

func (e HTMLEmailExporter) Export(ctx context.Context, _ io.Writer, r *http.Request, bookmarkList *dataset.BookmarkList) error

Export implements Exporter. It create an email with a text/plain and text/html version and attaches images as inline resources.

type IterExporter

type IterExporter interface {
	IterExport(ctx context.Context, w io.Writer, r *http.Request, bookmarkSeq *dataset.BookmarkIterator) error
}

IterExporter describes a bookmarks exporter that works with an iterator.

type MarkdownExporter

type MarkdownExporter struct {
	dataset.HTMLConverter
}

MarkdownExporter is a content exporter that produces markdown.

func NewMarkdownExporter

func NewMarkdownExporter() MarkdownExporter

NewMarkdownExporter returns a new MarkdownExporter instance.

func (MarkdownExporter) IterExport

func (e MarkdownExporter) IterExport(ctx context.Context, w io.Writer, r *http.Request, bookmarkSeq *dataset.BookmarkIterator) error

IterExport implement IterExporter. It can write text only articles (the default) separated by an horizontal rule. If the request contains "Accept: multipart/alternative", it returns a multipart response that contains images for the exported bookmarks.

type SyncExporter

type SyncExporter struct {
	dataset.HTMLConverter
	// contains filtered or unexported fields
}

SyncExporter is a content exporter for content sync. It exports every item from the select dataset as a multipart/alternative response into a writer.

func NewSyncExporter

func NewSyncExporter(options ...SyncOption) SyncExporter

NewSyncExporter returns a new SyncExporter.

func (SyncExporter) IterExport

func (e SyncExporter) IterExport(ctx context.Context, w io.Writer, _ *http.Request, bookmarkSeq *dataset.BookmarkIterator) error

IterExport implements IterExporter. It writes parts to a multipart/mixed response.

type SyncOption

type SyncOption func(*SyncExporter)

SyncOption is a SyncExporter option.

func WithSyncHTML

func WithSyncHTML(v bool) SyncOption

WithSyncHTML enables or disables HTML (articles) export.

func WithSyncJSON

func WithSyncJSON(v bool) SyncOption

WithSyncJSON enables or disables JSON information export.

func WithSyncMarkdown

func WithSyncMarkdown(v bool) SyncOption

WithSyncMarkdown enables or disables markdown export.

func WithSyncResourcePrefix

func WithSyncResourcePrefix(v string) SyncOption

WithSyncResourcePrefix set the resource prefix put in front of every bookmark's resource. It also triggers a replacement in the bookmark's article when there is one. "%" is placeholder for the bookmark's ID.

func WithSyncResources

func WithSyncResources(v bool) SyncOption

WithSyncResources enables or disables exporting images.

Jump to

Keyboard shortcuts

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