label

package
v0.1.23 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2026 License: MIT Imports: 3 Imported by: 2 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 label writes the labels a reader sees in front of list items and on pages: bullets, and numbers as letters and Roman numerals, and reads Roman numerals back. Moved here from go-fast-ooxml and go-fast-msbin (internal/label, the same in both), with Alpha, the lettering HTML, RTF and OpenDocument use, and the page labels of go-fast-pdf.

Index

Constants

View Source
const MaxParseThousands = 64

MaxParseThousands bounds the Ms ParseRoman reads: the most RomanN writes for a PDF's page labels.

Variables

This section is empty.

Functions

func Alpha

func Alpha(v int) string

Alpha writes 1 as A, 26 as Z, 27 as AA, 28 as AB: it counts in base 26 without a zero, as CSS's upper-alpha, RTF and OpenDocument (without letter synchronisation) do. It returns "" for a number below 1.

func Bullet

func Bullet(text, font string) string

Bullet returns the character a reader sees for a bullet definition. Bullets are usually stored as a code of a symbol font, often in the private range; the code is translated by the font's table, and a code with no character, or a bullet with nothing to show, becomes a plain bullet.

func Letters

func Letters(v int) string

Letters writes 1 as A, 26 as Z, 27 as AA, 28 as BB: Office repeats the letter, it does not count in base 26 (see Alpha). It is LettersN with 30 repeats, and returns "" for a number past 780.

func LettersN added in v0.1.22

func LettersN(v, repeats int) string

LettersN writes a number as Letters does, the letter repeated at most repeats times: from 1 to 26*repeats. It returns "" for any other number. go-fast-pdf writes page labels with up to 64 repeats.

func ParseRoman added in v0.1.22

func ParseRoman(s string) (int, bool)

ParseRoman reads a Roman numeral, in capitals or small letters (or both), and reports whether s is one: exactly what RomanN writes for its value, with at most MaxParseThousands thousands. "IIII", "VX" and "" are not numerals.

func Roman

func Roman(v int) string

Roman writes a number from 1 to 3999 in capital Roman numerals, and "" for any other: RomanN with three thousands, as Office numbers lists.

func RomanN added in v0.1.22

func RomanN(v, thousands int) string

RomanN writes a number in capital Roman numerals, with an M for each thousand, at most thousands of them: from 1 to thousands*1000+999. It returns "" for any other number. A PDF's page labels have no bound of their own; go-fast-pdf writes up to 64 thousands.

Types

This section is empty.

Jump to

Keyboard shortcuts

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