Pārlūkot izejas kodu

Add -after to insert html after the generated content

Lucas Stadler 9 gadi atpakaļ
vecāks
revīzija
e5de0adbda
1 mainītis faili ar 7 papildinājumiem un 0 dzēšanām
  1. 7 0
      go/blog/blog.go

+ 7 - 0
go/blog/blog.go

@ -38,6 +38,7 @@ var flags struct {
38 38
	noDefaultStyle    bool
39 39
	printDefaultStyle bool
40 40
	title             string
41
	after             string
41 42
}
42 43
var dataPath string = "blog.yaml"
43 44
@ -136,6 +137,7 @@ func init() {
136 137
	flag.BoolVar(&flags.noDefaultStyle, "no-default-style", false, "Don't use the default styles")
137 138
	flag.BoolVar(&flags.printDefaultStyle, "print-default-style", false, "Print the default styles")
138 139
	flag.StringVar(&flags.title, "title", "A blog", "Custom `title` to use")
140
	flag.StringVar(&flags.after, "after", "", "Insert additional `html` at the end of the generated page")
139 141
140 142
	flag.Usage = func() {
141 143
		fmt.Fprintf(os.Stderr, "Usage: %s [flags] [<blog.yaml> [<blog.html>]]\n\n", os.Args[0])
@ -412,6 +414,11 @@ func main() {
412 414
		document.title = baseTitle;
413 415
	}
414 416
	</script>`)
417
418
	if flags.after != "" {
419
		fmt.Fprintf(out, "\n%s\n", flags.after)
420
	}
421
415 422
	fmt.Fprintf(out, "\n</body>\n</html>\n")
416 423
	out.Close()
417 424