// hasBinaryData returns true if the revision has any binary data associated.
// During initialisation, it is guaranteed that r.BinaryMime is set to "" if the revision has no binary data. (is it?)
func(h*Hypha)hasBinaryData()bool{
returnh.actual.BinaryMime!=""
}
func(h*Hypha)TagsJoined()string{
ifh.Exists{
returnstrings.Join(h.actual.Tags,", ")
}
return""
}
func(h*Hypha)TextMime()string{
ifh.Exists{
returnh.actual.TextMime
}
return"text/markdown"
}
func(h*Hypha)mimeTypeForActionRaw()string{
// If text mime type is text/html, it is not good as it will be rendered.
ifh.actual.TextMime=="text/html"{
return"text/plain"
}
returnh.actual.TextMime
}
// NewestId finds the largest id among all revisions.
func(h*Hypha)NewestId()string{
varlargestint
fork,_:=rangeh.Revisions{
id,_:=strconv.Atoi(k)
ifid>largest{
largest=id
}
}
returnstrconv.Itoa(largest)
}
func(h*Hypha)TextContent()string{
ifh.Exists{
contents,err:=ioutil.ReadFile(h.TextPath())
iferr!=nil{
log.Println("Could not read",h.FullName)
return"Error: could not hypha text content file. It is recommended to cancel editing. Please contact the wiki admin. If you are the admin, see the logs."