booklit

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2017 License: MIT Imports: 3 Imported by: 4

README

booklit

GoDoc CI

installation

go get github.com/vito/booklit/cmd/booklit

usage

booklit -i foo.lit -o ./out

example

clone this repo and build its docs:

booklit -i ./docs/lit/index.lit -o ./docs

you can see the result at https://vito.github.io/docs

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Version = "0.0.0-dev"

overridden via linker flags

Functions

func RegisterPlugin

func RegisterPlugin(name string, factory PluginFactory)

Types

type Block

type Block struct {
	Content Content

	Class string
}

func (Block) IsSentence

func (con Block) IsSentence() bool

func (Block) String

func (con Block) String() string

func (Block) Visit

func (con Block) Visit(visitor Visitor) error

type Content

type Content interface {
	String() string

	IsSentence() bool

	Visit(Visitor) error
}

func Append

func Append(first Content, rest ...Content) Content
type Link struct {
	Content

	Target string
}

func (Link) Visit

func (con Link) Visit(visitor Visitor) error

type List

type List struct {
	Items []Content

	Ordered bool
}

func (List) IsSentence

func (con List) IsSentence() bool

func (List) String

func (con List) String() string

func (List) Visit

func (con List) Visit(visitor Visitor) error

type Paragraph

type Paragraph []Content

func (Paragraph) IsSentence

func (con Paragraph) IsSentence() bool

func (Paragraph) String

func (con Paragraph) String() string

func (Paragraph) Visit

func (con Paragraph) Visit(visitor Visitor) error

type Plugin

type Plugin interface {
}

type PluginFactory

type PluginFactory interface {
	NewPlugin(*Section) Plugin
}

func LookupPlugin

func LookupPlugin(name string) (PluginFactory, bool)

type PluginFactoryFunc

type PluginFactoryFunc func(*Section) Plugin

func (PluginFactoryFunc) NewPlugin

func (f PluginFactoryFunc) NewPlugin(s *Section) Plugin

type Preformatted

type Preformatted []Content

func (Preformatted) IsSentence

func (con Preformatted) IsSentence() bool

func (Preformatted) String

func (con Preformatted) String() string

func (Preformatted) Visit

func (con Preformatted) Visit(visitor Visitor) error

type Reference

type Reference struct {
	TagName string
	Content Content

	Tag *Tag
}

func (*Reference) Display

func (con *Reference) Display() Content

func (*Reference) IsSentence

func (con *Reference) IsSentence() bool

func (*Reference) String

func (con *Reference) String() string

func (*Reference) Visit

func (con *Reference) Visit(visitor Visitor) error

type Section

type Section struct {
	Path string

	Title Content
	Body  Content

	PrimaryTag Tag
	Tags       []Tag

	Parent   *Section
	Children []*Section

	SplitSections bool

	PluginFactories []PluginFactory
	Plugins         []Plugin
}

func (*Section) AnchorTags

func (con *Section) AnchorTags() []Tag

func (*Section) Contains

func (con *Section) Contains(sub *Section) bool

func (*Section) FindTag

func (con *Section) FindTag(tagName string) (Tag, bool)

func (*Section) HasAnchors

func (con *Section) HasAnchors() bool

func (*Section) IsSentence

func (con *Section) IsSentence() bool

func (*Section) Number

func (con *Section) Number() string

func (*Section) SetTitle

func (con *Section) SetTitle(title Content, tags ...string)

func (*Section) String

func (con *Section) String() string

func (*Section) Top

func (con *Section) Top() *Section

func (*Section) UsePlugin

func (con *Section) UsePlugin(pf PluginFactory)

func (*Section) Visit

func (con *Section) Visit(visitor Visitor) error

type Sequence

type Sequence []Content

func (Sequence) Contents

func (con Sequence) Contents() []Content

func (Sequence) IsSentence

func (con Sequence) IsSentence() bool

func (Sequence) String

func (con Sequence) String() string

func (Sequence) Visit

func (con Sequence) Visit(visitor Visitor) error

type String

type String string
var Empty String

func (String) IsSentence

func (str String) IsSentence() bool

func (String) String

func (str String) String() string

func (String) Visit

func (str String) Visit(visitor Visitor) error

type Style

type Style string
const (
	StyleVerbatim Style = "verbatim"
	StyleItalic   Style = "italic"
	StyleBold     Style = "bold"
)

type Styled

type Styled struct {
	Content

	Style Style
}

func (Styled) Visit

func (con Styled) Visit(visitor Visitor) error

type TableOfContents

type TableOfContents struct {
	Section *Section
}

func (TableOfContents) IsSentence

func (con TableOfContents) IsSentence() bool

func (TableOfContents) String

func (con TableOfContents) String() string

func (TableOfContents) Visit

func (con TableOfContents) Visit(visitor Visitor) error

type Tag

type Tag struct {
	Name    string
	Display Content

	Section *Section
	Anchor  string
}

type Target

type Target struct {
	TagName string
	Display Content
}

func (Target) IsSentence

func (con Target) IsSentence() bool

func (Target) String

func (con Target) String() string

func (Target) Visit

func (con Target) Visit(visitor Visitor) error

type Visitor

type Visitor interface {
	VisitString(String) error
	VisitSequence(Sequence) error
	VisitReference(*Reference) error
	VisitLink(Link) error
	VisitSection(*Section) error
	VisitParagraph(Paragraph) error
	VisitTableOfContents(TableOfContents) error
	VisitPreformatted(Preformatted) error
	VisitStyled(Styled) error
	VisitTarget(Target) error
	VisitBlock(Block) error
	VisitList(List) error
}

Directories

Path Synopsis
cmd
docs
hello Module

Jump to

Keyboard shortcuts

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