Documentation
¶
Index ¶
- func Compile(doc psrt.Document, client *http.Client) ([]byte, error)
- func CompileWithCache(ctx context.Context, doc psrt.Document, client *http.Client, ...) ([]byte, error)
- func CompileWithCacheFrom(ctx context.Context, doc psrt.Document, sourcePath string, morePaths []string, ...) ([]byte, error)
- func CompileWithOptions(ctx context.Context, doc psrt.Document, client *http.Client, ...) ([]byte, error)
- func DiscoverPSRTPaths(primaryPath string) ([]string, error)
- func RenderHTML(doc psrt.Document, assets map[string]compileasset.Asset) ([]byte, error)
- func RenderHTMLBundle(variants []Variant, assets map[string]compileasset.Asset, ...) ([]byte, error)
- type Variant
- type VariantPSRT
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Compile ¶
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 ¶
DiscoverPSRTPaths returns sibling .psrt files in the same directory as primaryPath, with the primary file first (stable order for the rest).
func RenderHTML ¶
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 ¶
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 ¶
LoadVariantsFromPaths parses each path and resolves constants; primary path should be first.
type VariantPSRT ¶
VariantPSRT is a variant supplied as raw PSRT text (e.g. from a browser file picker).