ADOC_HEAD_RE ^(={1,6}|#{1,6})\s+(\S.*?)\s*$: the level and the title span. */
| 135 | |
| 136 | /* ADOC_HEAD_RE ^(={1,6}|#{1,6})\s+(\S.*?)\s*$: the level and the title span. */ |
| 137 | static int ad_heading(const ad_line_t *l, int *ta, int *tb) { |
| 138 | const char *s = l->s; |
| 139 | int n = ad_rlen(l); |
| 140 | if (n == 0 || (s[0] != '=' && s[0] != '#')) { |
| 141 | return 0; |
| 142 | } |
| 143 | int k = 0; |
| 144 | while (k < n && s[k] == s[0]) { |
| 145 | k++; |
| 146 | } |
| 147 | if (k > AD_HEAD_MAX || k >= n || !ad_blank(s[k])) { |
| 148 | return 0; |
| 149 | } |
| 150 | int a = k; |
| 151 | while (a < n && ad_blank(s[a])) { |
| 152 | a++; |
| 153 | } |
| 154 | if (a >= n) { |
| 155 | return 0; |
| 156 | } |
| 157 | *ta = a; |
| 158 | *tb = n; |
| 159 | return k; |
| 160 | } |
| 161 | |
| 162 | static bool ad_lines(ad_doc_t *d, const char *src, int len) { |
| 163 | int count = 1; |
no test coverage detected