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

Add -after to insert html after the generated content

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

+ 7 - 0
go/blog/blog.go

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