Documentation ¶
Index ¶
- func CanModifyTemplate(opt map[string]interface{}) bool
- func Contains(fi []os.FileInfo, term string) []os.FileInfo
- func DeleteFile(opt map[string]interface{}, inp map[string][]string, root, host string) error
- func DeletePrivate(opt map[string]interface{}, inp map[string][]string, root, host string) error
- func Exists(path string) (bool, error)
- func ForkPrivate(db *mgo.Database, opt map[string]interface{}, inp map[string][]string, ...) error
- func ForkPublic(db *mgo.Database, opt map[string]interface{}, root, host string) error
- func Install(db *mgo.Database, id bson.ObjectId) error
- func IsDir(filep string) bool
- func NewFile(opt map[string]interface{}, inp map[string][]string, root, host string) error
- func PublishPrivate(db *mgo.Database, opt map[string]interface{}, inp map[string][]string, ...) error
- func SaveFile(opt map[string]interface{}, inp map[string][]string, root, host string) error
- func SwitchToTemplate(db *mgo.Database, inp map[string][]string, root, host string) error
- func Uninstall(db *mgo.Database, id bson.ObjectId) error
- type Breadc
- type ReqLink
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanModifyTemplate ¶
func DeleteFile ¶
Delete a file OR dir. See NewFile for controversy about filenames and extensions.
func DeletePrivate ¶
Delete a whole private template.
func Exists ¶
Taken from http://stackoverflow.com/questions/10510691/how-to-check-whether-a-file-or-directory-denoted-by-a-path-exists-in-golang exists returns whether the given file or directory exists or not
func ForkPrivate ¶
func ForkPrivate(db *mgo.Database, opt map[string]interface{}, inp map[string][]string, root, host string) error
Fork current private template into an other private one. Copies the whole directory from /templates/private/{host}/{current_template} to /templates/private/{host}/{inp:new_private_name}
func ForkPublic ¶
Forks a public template into a private one: creates a deep recursive copy of the whole directory tree, so the user can edit his own template files as he wishes.
func NewFile ¶
New file OR dir. Filenames without extensions became dirs. RETHINK: This way we lose the ability to create files without extensions. Only accessed member of opt will be "TplIsPrivate" in scut.GetTPath. TODO: this is ugly.
func PublishPrivate ¶
func PublishPrivate(db *mgo.Database, opt map[string]interface{}, inp map[string][]string, root, host string) error
Publish a private template, so others can use it too. Copies the whole directory of /templates/private/{host}/{current_template} to /templates/public/{input:public_name} Fails if a public template with the chosen name already exists.
func SwitchToTemplate ¶
Switches from one template to another. Fails if the template we want to switch does not exist.
Types ¶
type Breadc ¶
func CreateBreadCrumb ¶
fs is strings.Split(filepath, "/") where filepath is "aboutus/joe.tpl"
type ReqLink ¶
func ReqLinks ¶
Extracts all requires ( {{require example.t}} ) from a given file. Takes into account fallback files too. First it checks if the file exists in the current template. If yes, the link will point to that file. If not, then the link will point to the fallback module file. TODO: Case when the required file does not exists anywhere is not handled.