source

package
v0.32.2 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2018 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dirs added in v0.31.1

type Dirs struct {
	AbsStaticDirs []string

	Language *helpers.Language
	// contains filtered or unexported fields
}

Dirs holds the source directories for a given build. In case where there are more than one of a kind, the order matters: It will be used to construct a union filesystem, so the right-most directory will "win" on duplicates. Typically, the theme version will be the first.

func NewDirs added in v0.31.1

func NewDirs(fs *hugofs.Fs, cfg config.Provider, logger *jww.Notepad) (*Dirs, error)

NewDirs creates a new dirs with the given configuration and filesystem.

func (*Dirs) CreateStaticFs added in v0.31.1

func (d *Dirs) CreateStaticFs() (afero.Fs, error)

CreateStaticFs will create a union filesystem with the static paths configured. Any missing directories will be logged as warnings.

func (*Dirs) IsStatic added in v0.31.1

func (d *Dirs) IsStatic(filename string) bool

IsStatic returns whether the given filename is located in one of the static source dirs.

func (*Dirs) MakeStaticPathRelative added in v0.31.1

func (d *Dirs) MakeStaticPathRelative(filename string) string

MakeStaticPathRelative creates a relative path from the given filename. It will return an empty string if the filename is not a member of dirs.

type File

type File interface {

	// Filename gets the full path and filename to the file.
	Filename() string

	// Path gets the relative path including file name and extension.
	// The directory is relative to the content root.
	Path() string

	// Dir gets the name of the directory that contains this file.
	// The directory is relative to the content root.
	Dir() string

	// Extension gets the file extension, i.e "myblogpost.md" will return "md".
	Extension() string
	// Ext is an alias for Extension.
	Ext() string // Hmm... Deprecate Extension

	// Lang for this page, if `Multilingual` is enabled on your site.
	Lang() string

	// LogicalName is filename and extension of the file.
	LogicalName() string

	// Section is first directory below the content root.
	Section() string

	// BaseFileName is a filename without extension.
	BaseFileName() string

	// TranslationBaseName is a filename with no extension,
	// not even the optional language extension part.
	TranslationBaseName() string

	// UniqueID is the MD5 hash of the file's path and is for most practical applications,
	// Hugo content files being one of them, considered to be unique.
	UniqueID() string

	FileInfo() os.FileInfo

	String() string

	// Deprecated
	Bytes() []byte
}

type FileInfo added in v0.32.1

type FileInfo struct {
	// contains filtered or unexported fields
}

func (*FileInfo) BaseFileName added in v0.32.1

func (fi *FileInfo) BaseFileName() string

func (*FileInfo) Bytes added in v0.32.1

func (fi *FileInfo) Bytes() []byte

func (*FileInfo) Dir added in v0.32.1

func (fi *FileInfo) Dir() string

func (*FileInfo) Ext added in v0.32.1

func (fi *FileInfo) Ext() string

func (*FileInfo) Extension added in v0.32.1

func (fi *FileInfo) Extension() string

func (*FileInfo) FileInfo added in v0.32.1

func (fi *FileInfo) FileInfo() os.FileInfo

func (*FileInfo) Filename added in v0.32.1

func (fi *FileInfo) Filename() string

func (*FileInfo) Lang added in v0.32.1

func (fi *FileInfo) Lang() string

func (*FileInfo) LogicalName added in v0.32.1

func (fi *FileInfo) LogicalName() string

func (*FileInfo) Open added in v0.32.1

func (fi *FileInfo) Open() (io.ReadCloser, error)

Open implements ReadableFile.

func (*FileInfo) Path added in v0.32.1

func (fi *FileInfo) Path() string

func (*FileInfo) Section added in v0.32.1

func (fi *FileInfo) Section() string

func (*FileInfo) String added in v0.32.1

func (fi *FileInfo) String() string

func (*FileInfo) TranslationBaseName added in v0.32.1

func (fi *FileInfo) TranslationBaseName() string

func (*FileInfo) UniqueID added in v0.32.1

func (fi *FileInfo) UniqueID() string

type Filesystem

type Filesystem struct {
	Base string

	SourceSpec
	// contains filtered or unexported fields
}

func (*Filesystem) Files

func (f *Filesystem) Files() []ReadableFile

type Input

type Input interface {
	Files() []ReadableFile
}

type ReadableFile added in v0.32.1

type ReadableFile interface {
	File
	Open() (io.ReadCloser, error)
}

A ReadableFile is a File that is readable.

type SourceSpec added in v0.20.1

type SourceSpec struct {
	Cfg config.Provider
	Fs  *hugofs.Fs

	Languages              map[string]interface{}
	DefaultContentLanguage string
	// contains filtered or unexported fields
}

SourceSpec abstracts language-specific file creation. TODO(bep) rename to Spec

func NewSourceSpec added in v0.20.1

func NewSourceSpec(cfg config.Provider, fs *hugofs.Fs) *SourceSpec

NewSourceSpec initializes SourceSpec using languages from a given configuration.

func (*SourceSpec) IgnoreFile added in v0.32.1

func (s *SourceSpec) IgnoreFile(filename string) bool

func (*SourceSpec) IsRegularSourceFile added in v0.32.1

func (s *SourceSpec) IsRegularSourceFile(filename string) (bool, error)

func (*SourceSpec) NewFileInfo added in v0.32.1

func (sp *SourceSpec) NewFileInfo(baseDir, filename string, fi os.FileInfo) *FileInfo

func (SourceSpec) NewFilesystem added in v0.20.1

func (sp SourceSpec) NewFilesystem(base string) *Filesystem

Jump to

Keyboard shortcuts

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