diff options
author | Steve Francia <steve.francia@gmail.com> | 2016-01-08 05:48:13 +0300 |
---|---|---|
committer | Steve Francia <steve.francia@gmail.com> | 2016-01-26 22:26:23 +0300 |
commit | 9f3796a31dc217b2b8094f948266b23ac3808aa6 (patch) | |
tree | e31b0061e7ed687276c1811e211a5892c288bbb4 /source/file.go | |
parent | ca6ca4f4fc29906e491b5ac6b63fb65125c9c9e4 (diff) |
Read/reread individual source content files
next is incremental conversion
Diffstat (limited to 'source/file.go')
-rw-r--r-- | source/file.go | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/source/file.go b/source/file.go index a132cefde..efe604912 100644 --- a/source/file.go +++ b/source/file.go @@ -14,14 +14,16 @@ package source import ( - "github.com/spf13/hugo/helpers" "io" "path/filepath" "strings" + + "github.com/spf13/hugo/helpers" ) +// All paths are relative from the source directory base type File struct { - relpath string // Original Full Path eg. /Users/Home/Hugo/foo.txt + relpath string // Original Full Path eg. content/foo.txt logicalName string // foo.txt Contents io.Reader section string // The first directory @@ -30,6 +32,7 @@ type File struct { uniqueID string // MD5 of the filename } +// UniqueID: MD5 of the filename func (f *File) UniqueID() string { return f.uniqueID } @@ -42,15 +45,17 @@ func (f *File) Bytes() []byte { return helpers.ReaderToBytes(f.Contents) } -// Filename without extension +// BaseFileName Filename without extension func (f *File) BaseFileName() string { return helpers.Filename(f.LogicalName()) } +// Section The first directory func (f *File) Section() string { return f.section } +// LogicalName The filename and extension of the file func (f *File) LogicalName() string { return f.logicalName } @@ -71,6 +76,7 @@ func (f *File) Ext() string { return f.Extension() } +// Path the relative path including file name and extension from the base of the source directory func (f *File) Path() string { return f.relpath } |