mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2024-10-30 03:36:16 +00:00
eb9acb718e
Starring: * Broken error localization for now (got in the way) * The title for error pages is the same for all errors (who cares anyway) * New bugs * The brand new /rename/ handler
35 lines
778 B
Go
35 lines
778 B
Go
package hyphae
|
|
|
|
import (
|
|
"sync"
|
|
)
|
|
|
|
// TextualHypha is a hypha with text, and nothing else. An article, a note, a poem, whatnot.
|
|
type TextualHypha struct {
|
|
sync.RWMutex
|
|
|
|
canonicalName string
|
|
mycoFilePath string
|
|
}
|
|
|
|
func (t *TextualHypha) CanonicalName() string {
|
|
return t.canonicalName
|
|
}
|
|
|
|
func (t *TextualHypha) HasTextFile() bool {
|
|
return true
|
|
}
|
|
|
|
func (t *TextualHypha) TextFilePath() string {
|
|
return t.mycoFilePath
|
|
}
|
|
|
|
// ExtendTextualToMedia returns a new media hypha with the same name and text file as the given textual hypha. The new hypha is not stored yet.
|
|
func ExtendTextualToMedia(t *TextualHypha, mediaFilePath string) *MediaHypha {
|
|
return &MediaHypha{
|
|
canonicalName: t.CanonicalName(),
|
|
mycoFilePath: t.TextFilePath(),
|
|
mediaFilePath: mediaFilePath,
|
|
}
|
|
}
|