hugo

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewProcessor

func NewProcessor(opts *Options) processors.Processor

NewProcessor creates a new Hugo WriProcess implementing processors#Processor

func NewWriter

func NewWriter(opts *Options) writers.Writer

NewWriter creates a new Hugo Writer implementing writers#Writer

Types

type FSWriter

type FSWriter struct {
	Writer         writers.Writer
	IndexFileNames []string
}

FSWriter is implementation of Writer interface for writing blobs to the file system at a designated path in a Hugo-specific way

func (*FSWriter) Write

func (w *FSWriter) Write(name, path string, docBlob []byte, node *api.Node) error

Write implements writers#Write and will rename files that match the list in hugo#FSWriter.IndexFileNames to _index.md on first match, first renamed basis to serve as section files.

type Options

type Options struct {
	// PrettyUrls indicates if links will rewritten for Hugo will be
	// formatted for pretty url support or not. Pretty urls in Hugo
	// place built source content in index.html, which resides in a path segment with
	// the name of the file, making request URLs more resource-oriented.
	// Example: (source) sample.md -> (build) sample/index.html -> (runtime) ./sample
	PrettyUrls bool
	// IndexFileNames defines a list of file names that indicate
	// their content can be used as Hugo section files (_index.md).
	IndexFileNames []string
	// Writer is the underlying writer used by hugo#FSWriter to serialize
	// content
	Writer writers.Writer
}

Options is the configuration options for creating Hugo implementations docforge interfaces

type Processor

type Processor struct {
	// PrettyUrls indicates if links will rewritten for Hugo will be
	// formatted for pretty url support or not. Pretty urls in Hugo
	// place built source content in index.html, which resides in a path segment with
	// the name of the file, making request URLs more resource-oriented.
	// Example: (source) sample.md -> (build) sample/index.html -> (runtime) ./sample
	PrettyUrls bool
	// IndexFileNames defines a list of file names that indicate
	// their content can be used as Hugo section files (_index.md).
	IndexFileNames []string
}

Processor is a processor implementation responsible to rewrite links on document that use source format (<path>/<name>.md) to destination format (<path>/<name> for sites configured for pretty URLs and <path>/<name>.html for sites configured for ugly URLs)

func (*Processor) Process

func (f *Processor) Process(documentBlob []byte, node *api.Node) ([]byte, error)

Process implements Processor#Process

Jump to

Keyboard shortcuts

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