Documentation ¶
Overview ¶
Package source contains the types and functions related to source files.
Index ¶
- type File
- func (fi *File) BaseFileName() string
- func (fi *File) ContentBaseName() string
- func (fi *File) Dir() string
- func (fi *File) Ext() string
- func (fi *File) Extension() string
- func (fi *File) FileInfo() hugofs.FileMetaInfo
- func (fi *File) Filename() string
- func (fi *File) IsZero() bool
- func (fi *File) Lang() string
- func (fi *File) LogicalName() string
- func (fi *File) Open() (hugio.ReadSeekCloser, error)
- func (fi *File) Path() string
- func (fi *File) Section() string
- func (fi *File) String() string
- func (fi *File) TranslationBaseName() string
- func (fi *File) UniqueID() string
- type GitInfo
- type SourceSpec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type File ¶
type File struct {
// contains filtered or unexported fields
}
File describes a source file.
func NewFileInfo ¶ added in v0.123.0
func NewFileInfo(fi hugofs.FileMetaInfo) *File
func NewFileInfoFrom ¶ added in v0.123.0
func (*File) BaseFileName ¶
BaseFileName returns a file's name without extension (e.g. "page.sv").
func (*File) ContentBaseName ¶ added in v0.54.0
ContentBaseName is a either TranslationBaseName or name of containing folder if file is a bundle.
func (*File) Dir ¶
Dir gets the name of the directory that contains this file. The directory is relative to the content root.
func (*File) FileInfo ¶ added in v0.32.1
func (fi *File) FileInfo() hugofs.FileMetaInfo
FileInfo returns a file's underlying os.FileInfo.
func (*File) Filename ¶ added in v0.32.1
Filename returns a file's absolute path and filename on disk.
func (*File) Lang ¶
Lang returns a file's language (e.g. "sv"). Deprecated: Use .Page.Language.Lang instead.
func (*File) LogicalName ¶
LogicalName returns a file's name and extension (e.g. "page.sv.md").
func (*File) Open ¶ added in v0.123.0
func (fi *File) Open() (hugio.ReadSeekCloser, error)
Open implements ReadableFile.
func (*File) Path ¶
Path gets the relative path including file name and extension. The directory is relative to the content root.
func (*File) TranslationBaseName ¶
TranslationBaseName returns a file's translation base name without the language segment (e.g. "page").
type GitInfo ¶ added in v0.110.0
type GitInfo struct { // Commit hash. Hash string `json:"hash"` // Abbreviated commit hash. AbbreviatedHash string `json:"abbreviatedHash"` // The commit message's subject/title line. Subject string `json:"subject"` // The author name, respecting .mailmap. AuthorName string `json:"authorName"` // The author email address, respecting .mailmap. AuthorEmail string `json:"authorEmail"` // The author date. AuthorDate time.Time `json:"authorDate"` // The commit date. CommitDate time.Time `json:"commitDate"` }
GitInfo provides information about a version controlled source file.
func NewGitInfo ¶ added in v0.110.0
type SourceSpec ¶ added in v0.20.1
type SourceSpec struct { *helpers.PathSpec SourceFs afero.Fs // 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, inclusionFilter *glob.FilenameFilter, 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.