Documentation ¶
Index ¶
- Variables
- func BubbleUpdates(gitpull string) map[string]int
- func CheckFatal(err error)
- func CheckMAC(message, messageMAC, key []byte) bool
- func CreateNewSite(InitSite string)
- func CreateSecretToken()
- func GetTemplates(root string) *template.Template
- func GetTitleFromMetaInfo(dirPath, name string) string
- func GetTitleFromUrl(s string) string
- func IsBloke(pathname string) bool
- func IsPost(name string) bool
- func LoadBubble(SiteRoot, name string) string
- func ParseBubbles(s []byte) string
- func ParseFileForNewBubbles(pathname string, new_bubbles *map[string]bool)
- func ParseForNewBubbles(SiteRoot string) map[string]bool
- func ReadDir(dir string) []os.FileInfo
- func RedirectServer()
- func RedirectTLS(w http.ResponseWriter, r *http.Request)
- func StartBloke(addr, SiteRoot string, tls bool, no_html bool)
- func StartServer(addr string, mux *http.ServeMux, tls bool)
- func WriteSetToFile(filename string, set map[string]bool)
- type AjaxBubbleResponseType
- type Bubble
- type ConfigType
- type Globals
- func (g *Globals) AssemblePages()
- func (g *Globals) AssemblePosts()
- func (g *Globals) AssembleSite()
- func (g *Globals) ErrorPage(w http.ResponseWriter, err error)
- func (g *Globals) GitPull()
- func (g *Globals) IsPage(name string) bool
- func (g *Globals) LoadConfig(SiteRoot string)
- func (g *Globals) LoadPage(dirPath, name string, page *PageType) error
- func (g *Globals) LoadSecret()
- func (g *Globals) NewServeMux(r Router)
- func (g *Globals) NewWatcher(SiteRoot string)
- func (g *Globals) Refresh(updates map[string]int)
- func (g *Globals) RenderTemplate(w http.ResponseWriter, tmpl string, p interface{})
- func (g *Globals) RenderTemplateToFile(tmpl, SiteRoot, save_file string, p interface{})
- func (g *Globals) SaveSite()
- func (g *Globals) ServeBlokeFile(w http.ResponseWriter, r *http.Request)
- func (g *Globals) ServeFile(w http.ResponseWriter, r *http.Request)
- func (g *Globals) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (g *Globals) WatchDirCallback(watcher *fsnotify.Watcher)
- func (g *Globals) WatchDirs(watcher *fsnotify.Watcher, dir string)
- type MetaInfoType
- type PageType
- type Router
- type UpdateHandler
- type ViewType
Constants ¶
This section is empty.
Variables ¶
var BlokePath = GoPath + "/src/github.com/ebuchman/bloke" // is there a nicer way to get this?
var GoPath = os.Getenv("GOPATH")
bloke should be launched from the sites root should be installed in gopath/src/github/ebuchman/bloke...
var NewBubbleString = "This bubble has not been written yet" // this will be changed to refer you to the github repo once it's configured :)
Functions ¶
func BubbleUpdates ¶
check if changes introduce or change bubbles. return list of them for now it only works on changes, adds, and rms. Rename's mess it all up! redo with regex for christ's sake!
func CheckFatal ¶
func CheckFatal(err error)
func GetTemplates ¶
func GetTitleFromMetaInfo ¶
open a file, parse metainfo, return title fallback to filename if no title
func IsPost ¶
it's a blog post if it is of the form yyyy-mm-dd-name-of-post.md and the date is quasi valid
func LoadBubble ¶
load bubble, parse text, return html string will need an upgrade to json for metainfo...
func ParseBubbles ¶
parse and replace for bubbles and markdown to js/html takes the raw txt.md bytes creates new bubble entries if they are referenced but don't exist
func ParseFileForNewBubbles ¶
Find all bubbles, check against old_bubbles, return new bubbles
func ParseForNewBubbles ¶
search every file for new bubbles, create them, return list of new_bubbles
func RedirectServer ¶
func RedirectServer()
func RedirectTLS ¶
func RedirectTLS(w http.ResponseWriter, r *http.Request)
func StartBloke ¶
standalone server for running your own bloke
func StartServer ¶
start a http or https server listening on addr routing with the mux
func WriteSetToFile ¶
for writing list of empty bubbles to file
Types ¶
type AjaxBubbleResponseType ¶
type AjaxBubbleResponseType struct {
Bubbles []Bubble `json:"bubbles"`
}
type ConfigType ¶
type ConfigType struct { SiteName string `json:"site_name"` Email string `json:"email"` Site string `json:"site"` Repo string `json:"github_repo"` Glossary string `json:"glossary_file"` Disqus string `json:"disqus_user"` // contains filtered or unexported fields }
config struct - corresponds to config.json
type Globals ¶
type Globals struct { Projects [][]string // list of pairs (url/filename, display name) SubProjects map[string][][]string // map from project-filename to list of pairs (subproject filenames, subproject displayname). these generate the dropdowns Posts map[string]map[string]map[string][]string // year, month, day, title RecentPosts [][]string // [](title, date_name) Config ConfigType // config struct loaded from config.json SiteRoot string // path to the site Templates *template.Template UpdateHandler UpdateHandler // called with names of updated bubbles // contains filtered or unexported fields }
main site struct
func LiveBloke ¶
func LiveBloke(SitePath string, no_html bool, update_handler UpdateHandler) Globals
launch a new live bloke
func (*Globals) AssemblePages ¶
func (g *Globals) AssemblePages()
compile list of pages and prepare Globals struct (mostly for filling in the nav bar with pages links) in future, write everything out to static .html files for serving later (so we don't have to render template each time)
func (*Globals) AssemblePosts ¶
func (g *Globals) AssemblePosts()
compile list of posts and fill in Globals struct
func (*Globals) AssembleSite ¶
func (g *Globals) AssembleSite()
main server startup function compile lists of pages and posts and prepare globals struct require at least one page and one post!
func (*Globals) ErrorPage ¶
func (g *Globals) ErrorPage(w http.ResponseWriter, err error)
error function
func (*Globals) GitPull ¶
func (g *Globals) GitPull()
if git pull not up to date, refresh Globals how do we pull safely, without messing up a user?!
func (*Globals) LoadConfig ¶
load config struct from config.json
func (*Globals) NewWatcher ¶
create new watcher for directory cleanup/close!
func (*Globals) Refresh ¶
create new globals, copy over (eg. after git pull) takes a list of bubble names recently updates
func (*Globals) RenderTemplate ¶
func (g *Globals) RenderTemplate(w http.ResponseWriter, tmpl string, p interface{})
bring a template to life!
func (*Globals) RenderTemplateToFile ¶
func (*Globals) ServeBlokeFile ¶
func (g *Globals) ServeBlokeFile(w http.ResponseWriter, r *http.Request)
serve static files (assets: js, css)
func (*Globals) ServeFile ¶
func (g *Globals) ServeFile(w http.ResponseWriter, r *http.Request)
serve static files (imgs, files)
func (*Globals) ServeHTTP ¶
func (g *Globals) ServeHTTP(w http.ResponseWriter, r *http.Request)
serve over the mux
func (*Globals) WatchDirCallback ¶
watch directory callback kind of messy since it fires soo much
type MetaInfoType ¶
type MetaInfoType struct {
Title string `json:"title"`
}
meta info struct. read from json
func ParseMetaInfo ¶
func ParseMetaInfo(s []byte) (MetaInfoType, []byte)
parse metainfo. return metainfo struct and remaining bytes
type PageType ¶
type PageType struct { Name string //URL name of this page Text string // text of current page Title string // title of current page MetaInfo MetaInfoType // struct of meta info for current page // bloke flags (trigger specialized html/templating) IsGlossary bool IsDisqus bool }
info specific to the page requested by a client
type UpdateHandler ¶
type UpdateHandler interface { // takes a list of the names of the updated bubbles HandleUpdate(map[string]int) }
for handling bubble updates this can be ignored, if the updates are in text files being served it can trigger database lookups/modifications it can do whatever else you want point is, separate bloke site generator from the bupble database