~emersion/drmdb

85ea5ba88f3cad1747bead79815950f681ca510b — Simon Ser 6 months ago 5046ca9
drmdoc: stop accumulating content if indentation is missing

When indentation is missing, that means the docs for the prop are
finished. DRM docs often contain free-form paragraphs between prop docs.
1 files changed, 5 insertions(+), 1 deletions(-)

M drmdoc/generate.go
M drmdoc/generate.go => drmdoc/generate.go +5 -1
@@ 67,12 67,16 @@ func parseProps(s string) map[string]string {
	var header, indent string
	var body strings.Builder
	for _, l := range lines {
		if len(l) > 0 && !unicode.IsSpace(rune(l[0])) && strings.HasSuffix(l, ":") {
		if l != "" && !strings.HasPrefix(l, indent) {
			bodyStr := strings.TrimSpace(body.String())
			if bodyStr != "" {
				m[header] = bodyStr
			}
			body.Reset()
			header = ""
		}

		if l != "" && !unicode.IsSpace(rune(l[0])) && strings.HasSuffix(l, ":") {
			if i := strings.Index(l, "("); i >= 0 {
				l = l[:i] // Strip comments in parentheses
			}