parts

package
v0.0.0-...-1543a3a Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Copyright (C) 2024 early (LGPL)

Index

Constants

This section is empty.

Variables

View Source
var SourcePreview = part.New("source-preview", "source-preview.html",
	part.OnLoad(func(data render.Data) error {
		opener, ok := data.Get("source").(include.Opener)
		if !ok || opener == nil {
			return errors.New("source-preview requires include.Opener source")
		}
		file, err := opener.Open()
		if err != nil {
			return err
		}
		buf := new(strings.Builder)
		io.Copy(buf, file)
		data.Set("source_raw", buf.String())
		return nil
	}),
)

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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