Support Indicate whether put a line between sections (#102)

This commit is contained in:
lispking
2017-05-18 22:32:21 -04:00
committed by 无闻
parent 36da989cdc
commit 458858a8ce
+8 -3
View File
@@ -60,6 +60,9 @@ var (
// Explicitly write DEFAULT section header
DefaultHeader = false
// Indicate whether to put a line between sections
PrettySection = true
)
func init() {
@@ -513,9 +516,11 @@ func (f *File) WriteToIndent(w io.Writer, indent string) (n int64, err error) {
}
}
// Put a line between sections
if _, err = buf.WriteString(LineBreak); err != nil {
return 0, err
if PrettySection {
// Put a line between sections
if _, err = buf.WriteString(LineBreak); err != nil {
return 0, err
}
}
}