render

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultBookIgnores = []string{
	".git", "_git",
	"book", "book.toml",
	"node_modules",
}

Functions

This section is empty.

Types

type BookInfo

type BookInfo struct {
	Title           string
	GitRepoIcon     string
	GitRepoUrl      string
	EditUrlTemplate string
}

type BookRendor

type BookRendor struct {
	Book         *mnbook.Book
	BookInfo     *BookInfo
	PageInfos    []*PageInfo
	SidebarItems []*SidebarItem
	Ignores      []string
}

func New

func New() *BookRendor

func (*BookRendor) Run

func (p *BookRendor) Run(book *mnbook.Book) error

type PageInfo

type PageInfo struct {
	Index int

	Book            *BookInfo
	SidebarItems    []*SidebarItem
	EditUrlTemplate string

	Root  string
	Path  string
	Title string

	Content string
	RawHtml string

	HasPrev bool
	HasNext bool

	PrevUrl string
	NextUrl string
}

type SidebarItem

type SidebarItem struct {
	Prefix   string
	Number   string // 1.1, 1.2, ...
	Name     string
	Location string
}

type SidebarTree

type SidebarTree []*SidebarItem

func (SidebarTree) Children

func (p SidebarTree) Children(idx int) []int

func (SidebarTree) GenHTML

func (p SidebarTree) GenHTML(pageRoot string, pageIndex int) string

func (SidebarTree) Siblings

func (p SidebarTree) Siblings(idx int) []int

Jump to

Keyboard shortcuts

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