Просмотр исходного кода

Support setting a custom title

Lucas Stadler лет назад: 9
Родитель
Сommit
f2842411d2
1 измененных файлов с 4 добавлено и 2 удалено
  1. 4 2
      go/blog/blog.go

+ 4 - 2
go/blog/blog.go

28
	writeBack bool
28
	writeBack bool
29
	reverse   bool
29
	reverse   bool
30
	css       string
30
	css       string
31
	title     string
31
}
32
}
32
var dataPath string = "blog.yaml"
33
var dataPath string = "blog.yaml"
33
34
51
	flag.BoolVar(&flags.writeBack, "write-back", false, "Rewrite the YAML file with the generated ids")
52
	flag.BoolVar(&flags.writeBack, "write-back", false, "Rewrite the YAML file with the generated ids")
52
	flag.BoolVar(&flags.reverse, "reverse", false, "Reverse the order of the articles in the file")
53
	flag.BoolVar(&flags.reverse, "reverse", false, "Reverse the order of the articles in the file")
53
	flag.StringVar(&flags.css, "css", defaultStyle, "Custom styles to use")
54
	flag.StringVar(&flags.css, "css", defaultStyle, "Custom styles to use")
55
	flag.StringVar(&flags.title, "title", "A blog", "Custom title to use")
54
}
56
}
55
57
56
func main() {
58
func main() {
80
<html>
82
<html>
81
<head>
83
<head>
82
	<meta charset="utf-8" />
84
	<meta charset="utf-8" />
83
	<title>A blog</title>
85
	<title>%s</title>
84
	<style>%s</style>
86
	<style>%s</style>
85
</head>
87
</head>
86
88
87
<body>
89
<body>
88
`, flags.css)
90
`, flags.title, flags.css)
89
91
90
	if flags.reverse {
92
	if flags.reverse {
91
		l := len(posts)
93
		l := len(posts)