export

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2026 License: Unlicense Imports: 19 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package export 将 OFD 文档导出为 ofd-creator 可读取的 manifest。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Export

func Export(input any, output io.Writer, options Options) error

Export 将 OFD 导出为 manifest,并将字体和多媒体资源写入 AssetRoot。 导出的 manifest 可以作为 ofd-creator 的输入,但不承诺原始 OFD 的字节级还原。

func ExportAll

func ExportAll(input any, outputDir string) error

ExportAll 将 OFD 的全部文档体导出为一个目录包。 每个文档体拥有独立的 manifest 和资源目录,根目录下同时写入索引文件。

func ExportAllWithFormat

func ExportAllWithFormat(input any, outputDir, format string) error

ExportAllWithFormat 将 OFD 的全部文档体导出为指定格式的目录包。

func ExportAllWithOptions

func ExportAllWithOptions(input any, outputDir string, options Options) error

ExportAllWithOptions 将 OFD 的全部文档体导出为指定格式的目录包,并应用输出选项。

func ExportDocument

func ExportDocument(input any, index int, output io.Writer, options Options) error

ExportDocument 将指定索引的文档体导出为 manifest。 index 从 0 开始;该 API 用于 OFD 包含多个文档体时选择其中一个文档。

Types

type BundleDocument

type BundleDocument struct {
	Index     int    `json:"index" yaml:"index"`
	ID        string `json:"id" yaml:"id"`
	Title     string `json:"title" yaml:"title"`
	Manifest  string `json:"manifest" yaml:"manifest"`
	AssetRoot string `json:"asset_root" yaml:"asset_root"`
	Pages     int    `json:"pages" yaml:"pages"`
}

BundleDocument identifies one document manifest in an export bundle.

type BundleIndex

type BundleIndex struct {
	Version   int              `json:"version" yaml:"version"`
	Documents []BundleDocument `json:"documents" yaml:"documents"`
}

BundleIndex describes the manifests produced by ExportAll.

type Options

type Options struct {
	// AssetRoot 是导出二进制资源的实际目录。
	AssetRoot string
	// AssetPrefix 是 manifest 中相对于 manifest 文件的资源目录前缀。
	AssetPrefix string
	// Format 是 manifest 输出格式,可选 yaml、json 或 toml。
	Format string
	// JSONIndent 控制 JSON 输出是否使用 2 空格缩进。
	JSONIndent bool
}

Options 控制 OFD manifest 导出。

Jump to

Keyboard shortcuts

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