Пример #1
0
func main() {
	var conf_path string
	flag.StringVar(&conf_path, "conf", "config.json", "Location of configuration file. Defaults to config.json in the present working directory.")
	flag.Parse()

	conf, err := configuration.Load(conf_path)

	if err != nil {
		log.Fatal(err)
		return
	}

	theme_path := filepath.Join("themes", conf.Theme, "index.html")
	tmpl, err := theme.Load(conf.Theme, theme_path)

	if err != nil {
		log.Fatal(err)
		return
	}

	tmpl.Execute(os.Stdout, conf)
}
Пример #2
0
func main() {
	log.SetFlags(log.LstdFlags | log.Lshortfile)

	var conf_path string
	flag.StringVar(&conf_path, "conf", "config.json", "Location of configuration file. Defaults to config.json in the present working directory.")
	flag.Parse()

	conf, err := configuration.Load(conf_path)
	if err != nil {
		log.Fatal(err)
	}

	theme_path := filepath.Join("themes", conf.Theme, "index.html")
	tpl, err := theme.Load(conf.Theme, theme_path)
	if err != nil {
		log.Fatal(err)
	}

	tpl.Execute(os.Stdout, conf)

	log.Printf("POST: %s", models.LoadPost(models.ListPosts("posts")[0]))

	// log.Printf("POSTS: %s", models.ListPosts("posts"))
}