package source

import "github.com/gohugoio/hugo/source"

Index

Types

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.
	// For page bundles in root, the Section will be empty.
	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
}

type FileInfo

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

func (*FileInfo) BaseFileName

func (fi *FileInfo) BaseFileName() string

func (*FileInfo) Dir

func (fi *FileInfo) Dir() string

func (*FileInfo) Ext

func (fi *FileInfo) Ext() string

func (*FileInfo) Extension

func (fi *FileInfo) Extension() string

func (*FileInfo) FileInfo

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

func (*FileInfo) Filename

func (fi *FileInfo) Filename() string

func (*FileInfo) Lang

func (fi *FileInfo) Lang() string

func (*FileInfo) LogicalName

func (fi *FileInfo) LogicalName() string

func (*FileInfo) Open

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

Open implements ReadableFile.

func (*FileInfo) Path

func (fi *FileInfo) Path() string

func (*FileInfo) Section

func (fi *FileInfo) Section() string

func (*FileInfo) String

func (fi *FileInfo) String() string

func (*FileInfo) TranslationBaseName

func (fi *FileInfo) TranslationBaseName() string

func (*FileInfo) UniqueID

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

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

A ReadableFile is a File that is readable.

type SourceSpec

type SourceSpec struct {
	*helpers.PathSpec

	SourceFs afero.Fs

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

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

func NewSourceSpec

func NewSourceSpec(ps *helpers.PathSpec, fs afero.Fs) *SourceSpec

NewSourceSpec initializes SourceSpec using languages the given filesystem and PathSpec.

func (*SourceSpec) IgnoreFile

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

func (*SourceSpec) IsRegularSourceFile

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

func (*SourceSpec) NewFileInfo

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

func (SourceSpec) NewFilesystem

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

Source Files

fileInfo.go filesystem.go sourceSpec.go

Version
v0.42.2
Published
Jun 28, 2018
Platform
darwin/amd64
Imports
15 packages
Last checked
31 minutes ago

Tools for package owners.