Commit ac9fd648 authored by Clayton Coleman's avatar Clayton Coleman

Strip go2idl instructions from generated swagger doc

Ignore doc lines starting with +
parent a512d83a
...@@ -65,11 +65,14 @@ func fmtRawDoc(rawDoc string) string { ...@@ -65,11 +65,14 @@ func fmtRawDoc(rawDoc string) string {
for _, line := range strings.Split(rawDoc, "\n") { for _, line := range strings.Split(rawDoc, "\n") {
line = strings.TrimRight(line, " ") line = strings.TrimRight(line, " ")
leading := strings.TrimLeft(line, " ")
if line == "" { // Keep paragraphs switch {
case len(line) == 0: // Keep paragraphs
delPrevChar() delPrevChar()
buffer.WriteString("\n\n") buffer.WriteString("\n\n")
} else if !strings.HasPrefix(strings.TrimLeft(line, " "), "TODO") { // Ignore one line TODOs case strings.HasPrefix(leading, "TODO"): // Ignore one line TODOs
case strings.HasPrefix(leading, "+"): // Ignore instructions to go2idl
default:
if strings.HasPrefix(line, " ") || strings.HasPrefix(line, "\t") { if strings.HasPrefix(line, " ") || strings.HasPrefix(line, "\t") {
delPrevChar() delPrevChar()
line = "\n" + line + "\n" // Replace it with newline. This is useful when we have a line with: "Example:\n\tJSON-someting..." line = "\n" + line + "\n" // Replace it with newline. This is useful when we have a line with: "Example:\n\tJSON-someting..."
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment