WIP
This commit is contained in:
parent
619e3dfd41
commit
5bd898f11f
@ -22,7 +22,13 @@
|
||||
|
||||
package main
|
||||
|
||||
import _ "github.com/FooSoft/goldsmith"
|
||||
import (
|
||||
"github.com/FooSoft/goldsmith"
|
||||
_ "github.com/FooSoft/goldsmith-plugins/markdown"
|
||||
)
|
||||
|
||||
func main() {
|
||||
gs := goldsmith.NewGoldsmith("/home/alex/projects/website/content/src")
|
||||
// gs.Apply(markdown.NewMarkdown()).Complete("/home/alex/projects/test")
|
||||
gs.Complete("/home/alex/projects/test")
|
||||
}
|
||||
|
8
file.go
8
file.go
@ -42,9 +42,13 @@ func (f *file) SetPath(path string) {
|
||||
f.path = path
|
||||
}
|
||||
|
||||
func (f *file) Property(key string) (interface{}, bool) {
|
||||
func (f *file) Property(key, def string) interface{} {
|
||||
value, ok := f.meta[key]
|
||||
return value, ok
|
||||
if ok {
|
||||
return value
|
||||
}
|
||||
|
||||
return def
|
||||
}
|
||||
|
||||
func (f *file) SetProperty(key string, value interface{}) {
|
||||
|
@ -38,13 +38,10 @@ type goldsmith struct {
|
||||
files chan File
|
||||
}
|
||||
|
||||
func NewGoldsmith(path string) (Goldsmith, error) {
|
||||
func NewGoldsmith(path string) Goldsmith {
|
||||
gs := new(goldsmith)
|
||||
if err := gs.scan(path); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return gs, nil
|
||||
gs.scan(path)
|
||||
return gs
|
||||
}
|
||||
|
||||
func (gs *goldsmith) scan(path string) error {
|
||||
|
4
types.go
4
types.go
@ -32,7 +32,7 @@ type File interface {
|
||||
Path() string
|
||||
SetPath(path string)
|
||||
|
||||
Property(key string) (interface{}, bool)
|
||||
Property(key, def string) interface{}
|
||||
SetProperty(key string, value interface{})
|
||||
|
||||
Error() error
|
||||
@ -42,7 +42,7 @@ type File interface {
|
||||
}
|
||||
|
||||
type Processor interface {
|
||||
Process(ctx Context, input chan File, output chan File) error
|
||||
Process(ctx Context, input, output chan File)
|
||||
}
|
||||
|
||||
type Goldsmith interface {
|
||||
|
Loading…
Reference in New Issue
Block a user