export

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2026 License: Apache-2.0 Imports: 20 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 WriteBundle added in v0.1.2

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

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

func WriteDocumentManifest added in v0.1.2

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

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

func WriteManifest added in v0.1.2

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

WriteManifest 将 OFD 写入 manifest,并将字体和多媒体资源写入 AssetRoot。 导出的 manifest 可以作为 ofd-creator 的输入,但不承诺原始 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 标识导出目录包中的一个文档 manifest。

type BundleIndex

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

BundleIndex 描述 WriteBundle 生成的 manifest 集合。

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