piccolo

package
v0.0.0-...-af62210 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2016 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const NON_CASCADING = MAIN | FEED | ARCHIVE | ROOT

Which attributes are non-cascading.

Variables

This section is empty.

Functions

func LaTex

func LaTex(node *html.Node, root string) error

LaTex finds <latex-pic> nodes in the html and replaces them with PNG images of the rendered LaTex.

Types

type Attr

type Attr int

Attr is the piccolo attributes for a file, i.e. verbatim, ignore, etc.

const (
	NONE     Attr = iota
	VERBATIM Attr = 1 << iota // Copy file w/o modification.
	INCLUDE                   // Add in header, footer and titlebar into HTML files.
	MAIN                      // The main index.html page goes in this directory.
	FEED                      // The index.atom feed goes in this directory.
	ARCHIVE                   // The archives goes in this directory.
	IGNORE                    // These files are not to be copied over.
	ROOT                      // The root of the publishing tree.
)

func (Attr) Has

func (a Attr) Has(b Attr) bool

Has returns true if the given Attr is present.

func (*Attr) Set

func (a *Attr) Set(b Attr)

Set sets the given Attr.

func (Attr) String

func (a Attr) String() string

String representation of an Attr.

type DocSet

type DocSet struct {

	// The root of the tree.
	Root string

	// The directory where the main page goes.
	Main string

	// The directory where the archive pages go.
	Archive string

	// The directory where the Atom feed goes.
	Feed string
	// contains filtered or unexported fields
}

DocSet keeps track of the attributes of all the directories and also tracks the important file locations.

func NewDocSet

func NewDocSet(path string) (*DocSet, error)

NewDocSet creates a new DocSet.

path is a diretory path at or below the .root directory.

func (DocSet) Dest

func (a DocSet) Dest(path string) (string, error)

Dest tranforms a src path into a destination path.

func (*DocSet) Path

func (a *DocSet) Path(path string) (Attr, error)

Path returns the attributes for a path.

func (DocSet) URL

func (a DocSet) URL(path string) (string, error)

URL tranforms a src path into a relative URL.

type FileInfo

type FileInfo struct {
	// Filesystem path to the source file.
	Path string

	// Parsed HTML of the file.
	Node *html.Node

	// The extracted title.
	Title string

	// Time the source file was created.
	Created time.Time

	// Time the source file was last updated.
	Updated time.Time
}

FileInfo contains information about each file that has include processing done on it.

func CreationDate

func CreationDate(path string) (*FileInfo, bool, error)

CreationDate returns the time an HTML document was created.

It also returns a FileInfo for the document, with the time added in the header if it was missing. The bool returned is true the meta creation element has been added to the header.

func CreationDateSaved

func CreationDateSaved(path string) (*FileInfo, error)

CreationDateSaved gets the creation date of an HTML file, and also writes that HTML file back in place with an updated meta element with the creation time if that information doesn't already exist.

func (FileInfo) Body

func (f FileInfo) Body() []*html.Node

Body returns the parsed html.Node's in the body.

Jump to

Keyboard shortcuts

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