MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / ad_heading

Function ad_heading

internal/cbm/doc_adoc.c:137–160  ·  view source on GitHub ↗

ADOC_HEAD_RE ^(={1,6}|#{1,6})\s+(\S.*?)\s*$: the level and the title span. */

Source from the content-addressed store, hash-verified

135
136/* ADOC_HEAD_RE ^(={1,6}|#{1,6})\s+(\S.*?)\s*$: the level and the title span. */
137static 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
162static bool ad_lines(ad_doc_t *d, const char *src, int len) {
163 int count = 1;

Callers 1

ad_structureFunction · 0.85

Calls 2

ad_rlenFunction · 0.85
ad_blankFunction · 0.85

Tested by

no test coverage detected