Documentation ¶
Index ¶
Constants ¶
const ( // Adds indicates the addition files in this visit. Adds = iota // Mods indicates the modification files in this visit. Mods )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dir ¶
type Dir string
Dir transforms path from absolute to relative and vice-versa, from the repository base dir perspective.
func (Dir) Abs ¶
Abs returns the absolute path in the prepend the base dir. Returns "" if the given path is absolute but not on the base dir.
type Doc ¶
type Doc struct { Body template.HTML `json:"-" yaml:"-"` Path string `json:"-" yaml:"-"` URL string `json:"url,omitempty" yaml:"-"` Title string `json:"title" yaml:",omitempty"` Tags []string `json:"tags"` Date time.Time `json:"date"` Weather string `json:"weather"` Summary string `json:"summary"` Location string `json:"location"` Background string `json:"background"` License string `json:"license"` // Hide from the list, but still can get with URL. Hide bool `json:"hide"` Older string `json:"older,omitempty"` Newer string `json:"newer,omitempty"` }
Doc representation of the document.
type DocProcessor ¶
type DocProcessor struct {
// contains filtered or unexported fields
}
DocProcessor render mark up documents as articles.
func (*DocProcessor) Process ¶
func (p *DocProcessor) Process(paths ...string) Docs
Process the given for documents, either using callback or return value to receiving the results, or both.
type DocRepo ¶
type DocRepo struct {
// contains filtered or unexported fields
}
DocRepo documents repository implements.
type DocScanner ¶
type DocScanner struct {
// contains filtered or unexported fields
}
DocScanner scan a path for documents.
func (*DocScanner) Scan ¶
func (s *DocScanner) Scan(path string) []string
Scan a path to find documents.
type Docs ¶
type Docs []Doc
Docs a list of articles. Maybe a BST is faster, an list is fast enough for such a tiny program. Simplicity, generality and clarity is more important, however.
type GithubRenderer ¶
type GithubRenderer struct {
User, Repo string
Dir Dir
StripTitle bool
URLTransformer func(src string) string
}
GithubRenderer render a mark up document using the Github favored style.
type NotFoundError ¶
type NotFoundError string
NotFoundError indicates the requested doc is not existed.
func (NotFoundError) Error ¶
func (s NotFoundError) Error() string
type Renderer ¶
Renderer render a document into HTML.
func NewRenderer ¶
NewRenderer default Github renderer, the URL in the HTML will remain unchanged.
type Repo ¶
type Repo interface { List(since string, size int) Docs Get(path string) (Doc, error) Del(path string) Put(path string) Post(path string) Batch(adds, mods, dels []string) }
Repo the documents repository.