page

package
v0.0.0-...-cf3f7d6 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2025 License: EUPL-1.2 Imports: 12 Imported by: 0

Documentation

Overview

Package page contains utilities for rendering documents.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecuteTemplate

func ExecuteTemplate(w io.Writer, tmpl string, d *Document) error

ExecuteTemplate executes the template with the given name for the given document and writes the result to the given writer.

Types

type Block

type Block struct {
	*aon.Entry

	Position    Position
	Index       Position
	Color       string
	Size        float64
	ExtraHeader float64
}

Block represents an information block.

func (Block) Ability

func (b Block) Ability() string

Ability returns the ability and level (if any).

func (Block) ActionsText

func (b Block) ActionsText() string

ActionsText returns the actions text for the embedded Entry. It is meant to be used with the Pathfinder2eActions font.

Symbols in the font are: - 1/a/A: single action - 2/d/D: two actions - 3/t/T: three actions - 4/f/F: Free action - 5/r/R: Reaction

func (Block) ColorText

func (b Block) ColorText() string

ColorText returns the text color for the block. It is based on the Color field when set, but falls back to a color based on the type of the AoN entry.

func (Block) Description

func (b Block) Description() string

Description returns the sanitized description for the Entry.

func (Block) Header

func (b Block) Header() iter.Seq2[string, string]

Header returns the entries for the header block.

func (Block) HeaderEnd

func (b Block) HeaderEnd() float64

HeaderEnd returns the Y-position of the header end.

func (Block) HeaderItems

func (b Block) HeaderItems() float64

HeaderItems returns the number of header items.

func (Block) Name

func (b Block) Name() string

Name returns the sanitized name.

func (Block) Source

func (b Block) Source() string

Source returns the PF2e source data.

type Document

type Document struct {
	Pages []Page
}

Document represents a multi-page document that can be rendered.

func NewDocument

func NewDocument(options DocumentOptions) *Document

NewDocument returns an initialized Document based on the given options.

type DocumentEntry

type DocumentEntry struct {
	Entry       *aon.Entry
	Height      float64
	ExtraHeader float64
	Color       string
}

DocumentEntry represents an unparsed document entry. It is transformed into a Block.

type DocumentOptions

type DocumentOptions struct {
	Pages []DocumentPage
}

DocumentOptions contains the options for creating a document.

type DocumentPage

type DocumentPage struct {
	Title       string
	Left, Right []DocumentEntry
}

DocumentPage represents an unparsed document page. It is transformed into a Page.

type Page

type Page struct {
	Title         string
	TitlePosition Position
	Blocks        []Block
}

Page represents a page that is ready to be rendered.

type Position

type Position struct {
	X, Y float64
}

Position represents a position in the document.

Jump to

Keyboard shortcuts

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