The paragraph after heading h (its first non-blank text lines). */
| 878 | |
| 879 | /* The paragraph after heading h (its first non-blank text lines). */ |
| 880 | static char *adr_first_paragraph(CBMArena *a, const adr_doc_t *d, int h, size_t cap) { |
| 881 | int start = d->heads[h].line + SKIP_ONE; |
| 882 | int end = h + SKIP_ONE < d->nheads ? d->heads[h + SKIP_ONE].line : d->L.count; |
| 883 | int k = start; |
| 884 | while (k < end && |
| 885 | (!d->L.v[k].text || d->L.v[k].n == 0 || adr_trim_eq(d->L.v[k].s, d->L.v[k].n, "") || |
| 886 | d->L.v[k].s[0] == '=' || d->L.v[k].s[0] == '-')) { |
| 887 | k++; |
| 888 | } |
| 889 | if (k >= end) { |
| 890 | return NULL; |
| 891 | } |
| 892 | const char *s = d->L.v[k].s; |
| 893 | int last = k; |
| 894 | while (last + SKIP_ONE < end && d->L.v[last + SKIP_ONE].text && |
| 895 | !adr_trim_eq(d->L.v[last + SKIP_ONE].s, d->L.v[last + SKIP_ONE].n, "")) { |
| 896 | last++; |
| 897 | } |
| 898 | const char *e = d->L.v[last].s + d->L.v[last].n; |
| 899 | return adr_plain(a, s, (size_t)(e - s), cap); |
| 900 | } |
| 901 | |
| 902 | /* The text of section h, as one collapsed string. */ |
| 903 | static char *adr_section_text(CBMArena *a, const adr_doc_t *d, int h, size_t cap) { |
no test coverage detected