Documentation ¶
Index ¶
- type File
- type FileInfo
- func (fi *FileInfo) BaseFileName() string
- func (fi *FileInfo) ContentBaseName() string
- func (fi *FileInfo) Dir() string
- func (fi *FileInfo) Ext() string
- func (fi *FileInfo) Extension() string
- func (fi *FileInfo) FileInfo() os.FileInfo
- func (fi *FileInfo) Filename() string
- func (fi *FileInfo) IsZero() bool
- func (fi *FileInfo) Lang() string
- func (fi *FileInfo) LogicalName() string
- func (fi *FileInfo) Open() (hugio.ReadSeekCloser, error)
- func (fi *FileInfo) Path() string
- func (fi *FileInfo) Section() string
- func (fi *FileInfo) String() string
- func (fi *FileInfo) TranslationBaseName() string
- func (fi *FileInfo) UniqueID() string
- type FileWithoutOverlap
- type Filesystem
- type Input
- type ReadableFile
- type SourceSpec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type File ¶
type File interface { FileWithoutOverlap // contains filtered or unexported methods }
File represents a source file. This is a temporary construct until we resolve page.Page conflicts. TODO(bep) remove this construct once we have resolved page deprecations
type FileInfo ¶ added in v0.32.1
type FileInfo struct {
// contains filtered or unexported fields
}
FileInfo describes a source file.
func NewTestFile ¶ added in v0.55.0
NewTestFile creates a partially filled File used in unit tests. TODO(bep) improve this package
func (*FileInfo) BaseFileName ¶ added in v0.32.1
BaseFileName returns a file's name without extension (ie. "page.sv").
func (*FileInfo) ContentBaseName ¶ added in v0.54.0
ContentBaseName is a either TranslationBaseName or name of containing folder if file is a leaf bundle.
func (*FileInfo) Dir ¶ added in v0.32.1
Dir gets the name of the directory that contains this file. The directory is relative to the content root.
func (*FileInfo) Ext ¶ added in v0.32.1
Ext returns a file's extension without the leading period (ie. "md").
func (*FileInfo) Filename ¶ added in v0.32.1
Filename returns a file's absolute path and filename on disk.
func (*FileInfo) LogicalName ¶ added in v0.32.1
LogicalName returns a file's name and extension (ie. "page.sv.md").
func (*FileInfo) Open ¶ added in v0.32.1
func (fi *FileInfo) Open() (hugio.ReadSeekCloser, error)
Open implements ReadableFile.
func (*FileInfo) Path ¶ added in v0.32.1
Path gets the relative path including file name and extension. The directory is relative to the content root.
func (*FileInfo) TranslationBaseName ¶ added in v0.32.1
TranslationBaseName returns a file's translation base name without the language segement (ie. "page").
type FileWithoutOverlap ¶ added in v0.55.0
type FileWithoutOverlap interface { // Filename gets the full path and filename to the file. Filename() 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 // LogicalName is filename and extension of the file. LogicalName() 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 // ContentBaseName is a either TranslationBaseName or name of containing folder // if file is a leaf bundle. ContentBaseName() 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 }
type Filesystem ¶
type Filesystem struct { Base string SourceSpec // contains filtered or unexported fields }
Filesystem represents a source filesystem.
func (*Filesystem) Files ¶
func (f *Filesystem) Files() []ReadableFile
Files returns a slice of readable files.
type ReadableFile ¶ added in v0.32.1
type ReadableFile interface { File Open() (hugio.ReadSeekCloser, error) }
A ReadableFile is a File that is readable.
type SourceSpec ¶ added in v0.20.1
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 ¶ added in v0.20.1
func NewSourceSpec(ps *helpers.PathSpec, fs afero.Fs) *SourceSpec
NewSourceSpec initializes SourceSpec using languages the given filesystem and PathSpec.
func (*SourceSpec) IgnoreFile ¶ added in v0.32.1
func (s *SourceSpec) IgnoreFile(filename string) bool
IgnoreFile returns whether a given file should be ignored.
func (*SourceSpec) IsRegularSourceFile ¶ added in v0.32.1
func (s *SourceSpec) IsRegularSourceFile(filename string) (bool, error)
IsRegularSourceFile returns whether filename represents a regular file in the source filesystem.
func (*SourceSpec) NewFileInfo ¶ added in v0.32.1
func (sp *SourceSpec) NewFileInfo(baseDir, filename string, isLeafBundle bool, fi os.FileInfo) *FileInfo
NewFileInfo returns a new FileInfo structure.
func (SourceSpec) NewFilesystem ¶ added in v0.20.1
func (sp SourceSpec) NewFilesystem(base string) *Filesystem
NewFilesystem returns a new filesytem for a given source spec.