compilehtml

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compile

func Compile(doc psrt.Document, client *http.Client) ([]byte, error)

Compile downloads all assets referenced by doc and returns a self-contained HTML document.

func CompileWithCache

func CompileWithCache(ctx context.Context, doc psrt.Document, client *http.Client, store *cache.Store) ([]byte, error)

CompileWithCache uses local asset cache when store is non-nil.

func CompileWithCacheFrom

func CompileWithCacheFrom(ctx context.Context, doc psrt.Document, sourcePath string, morePaths []string, morePSRT []VariantPSRT, client *http.Client, store *cache.Store, opts compileopts.Options) ([]byte, error)

CompileWithCacheFrom is like CompileWithCache. Variants come only from sourcePath plus morePaths (explicit compile inputs), never from scanning the source directory.

func CompileWithOptions

func CompileWithOptions(ctx context.Context, doc psrt.Document, client *http.Client, store *cache.Store, opts compileopts.Options) ([]byte, error)

CompileWithOptions compiles with shared compile flags.

func DiscoverPSRTPaths

func DiscoverPSRTPaths(primaryPath string) ([]string, error)

DiscoverPSRTPaths returns sibling .psrt files in the same directory as primaryPath, with the primary file first (stable order for the rest).

func RenderHTML

func RenderHTML(doc psrt.Document, assets map[string]compileasset.Asset) ([]byte, error)

RenderHTML produces a standalone HTML document using embedded assets.

func RenderHTMLBundle

func RenderHTMLBundle(variants []Variant, assets map[string]compileasset.Asset, opts compileopts.Options) ([]byte, error)

RenderHTMLBundle renders one or more PSRT variants; Ctrl+L cycles variants and "sem PSRT".

Types

type Variant

type Variant struct {
	Label string
	Doc   psrt.Document
}

Variant is one PSRT document bundled into a compiled HTML file.

func LoadVariantsFromPSRT

func LoadVariantsFromPSRT(items []VariantPSRT) ([]Variant, error)

LoadVariantsFromPSRT parses each body and resolves constants.

func LoadVariantsFromPaths

func LoadVariantsFromPaths(paths []string) ([]Variant, error)

LoadVariantsFromPaths parses each path and resolves constants; primary path should be first.

type VariantPSRT

type VariantPSRT struct {
	Label   string
	Content string
}

VariantPSRT is a variant supplied as raw PSRT text (e.g. from a browser file picker).

Jump to

Keyboard shortcuts

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