Skip to content

Commit f4164b1

Browse files
committed
*: disclaimer at the top of doc
1 parent aaab42a commit f4164b1

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

main.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ func init() {
116116

117117
func CommandFunc(cmd *cobra.Command, args []string) error {
118118
var rs string
119+
if len(disclaimer) > 0 {
120+
rs += disclaimer + "\n\n\n"
121+
}
119122
if len(targetDirectories) == 0 {
120123
log.Println("opening", targetDirectory)
121124
proto, err := parse.ReadDir(targetDirectory, "")
@@ -132,7 +135,7 @@ func CommandFunc(cmd *cobra.Command, args []string) error {
132135
}
133136
}
134137
log.Println("converting to markdown", title)
135-
rs, err = proto.Markdown(disclaimer, title, opts, languageOptions...)
138+
rs, err = proto.Markdown(title, opts, languageOptions...)
136139
if err != nil {
137140
return err
138141
}
@@ -150,7 +153,7 @@ func CommandFunc(cmd *cobra.Command, args []string) error {
150153
if err != nil {
151154
return err
152155
}
153-
ms, err := proto.Markdown(disclaimer, "", elem.options, languageOptions...)
156+
ms, err := proto.Markdown("", elem.options, languageOptions...)
154157
if err != nil {
155158
return err
156159
}

parse/markdown.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,10 @@ const (
2929

3030
// Markdown saves 'Proto' to markdown documentation.
3131
// lopts are a slice of language options (C++, Java, Python, Go, Ruby, C#).
32-
func (p *Proto) Markdown(disclaimer, title string, parseOpts []ParseOption, lopts ...string) (string, error) {
32+
func (p *Proto) Markdown(title string, parseOpts []ParseOption, lopts ...string) (string, error) {
3333
p.Sort()
3434

3535
buf := new(bytes.Buffer)
36-
if len(disclaimer) > 0 {
37-
buf.WriteString(fmt.Sprintf("%s\n\n\n", disclaimer))
38-
}
3936
if len(title) > 0 {
4037
buf.WriteString(fmt.Sprintf("### %s\n\n\n", title))
4138
}

parse/markdown_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func TestMarkdown(t *testing.T) {
2121
if err != nil {
2222
t.Fatal(err)
2323
}
24-
if txt, err := proto.Markdown("this is test...", "etcdserverpb", []ParseOption{ParseService, ParseMessage}, "Go", "Java", "Python", "C++"); err != nil {
24+
if txt, err := proto.Markdown("etcdserverpb", []ParseOption{ParseService, ParseMessage}, "Go", "Java", "Python", "C++"); err != nil {
2525
t.Fatal(err)
2626
} else {
2727
err = toFile(txt, "testdata/README.md")

0 commit comments

Comments
 (0)