dvorak

package module
v0.0.0-...-53adfd5 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2023 License: MIT Imports: 9 Imported by: 0

README

dvorak

Package dvorak parses source code templates used by the Dvorak game wiki.

Documentation

Overview

Package dvorak parses source code templates used by the Dvorak game wiki.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(rawURL string) ([]byte, error)

Get returns the source code of a Dvorak deck, beginning with its subpages in order, if any.

func ImageURLs

func ImageURLs(cards []Card) (map[string]string, error)

ImageURLs queries the Dvorak wiki API and returns a map of image filenames to their URLs.

Filenames are in MediaWiki normalized form, with the first character capitalized and spaces instead of underscores, but without the "File:" namespace prefix.

Types

type Card

type Card struct {

	// Title is the card's title.
	Title []*html.Node

	// LongTitle indicates that Title is too long to fit the standard header.
	LongTitle bool

	// Text is the card's rule text.
	Text []*html.Node

	// LongText indicates that Text is too long to fit the standard text area.
	LongText bool

	// Type is the card's type, usually "Action" or "Thing".
	Type []*html.Node

	// BGColor is the color of the card header background,
	// as a three- or six-digit hex triplet.
	// If omitted, Parse sets a default value according to the card type.
	BGColor string

	// CornerValue is an optional value to print in the card's top right corner.
	CornerValue []*html.Node

	// Image is the filename of an image for the card.
	Image string

	// ImgBack is the optional color to be shown behind the card image,
	// as a three- or six-digit hex triplet.
	ImgBack string

	// FlavorText is the card's flavor text. If not empty, this is displayed
	// under the rule text, separated by a horizontal line.
	FlavorText []*html.Node

	// Creator is the player who created the card. If not empty, this is
	// displayed at the bottom of the card.
	Creator []*html.Node

	// MiniCard indicates that the card is smaller than standard size,
	// e.g. for display in example texts.
	MiniCard bool

	// ID is the card's position within the deck.
	ID int
}

Card is a Dvorak card.

func Parse

func Parse(b []byte) []Card

Parse returns the Cards in b.

Jump to

Keyboard shortcuts

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