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

Function rst_explicit

internal/cbm/doclink_rst.c:818–850  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

816}
817
818static int rst_explicit(rst_doc_t *d, int i, int ind) {
819 rst_line_t *L = d->L;
820 int a;
821 int b;
822 rst_strip(L[i].s, L[i].len, &a, &b);
823 const char *s = L[i].s + a;
824 int sl = b - a;
825 if ((sl >= 4 && strncmp(s, ".. _", 4) == 0) || (sl >= 3 && strncmp(s, "__ ", 3) == 0)) {
826 d->K[i] = K_TARGET;
827 int j = i + 1;
828 while (j < d->n && !L[j].blank && L[j].indent > ind) {
829 d->K[j] = K_TARGET;
830 j++;
831 }
832 return j;
833 }
834 /* \.\.\s+\[[^\]]+\] : a footnote or citation */
835 int p = rst_skip_ws(s, sl, 2);
836 if (p > 2 && p < sl && s[p] == '[') {
837 const char *close = memchr(s + p + 1, ']', (size_t)(sl - p - 1));
838 if (close && close > s + p + 1) {
839 d->K[i] = K_PROSE;
840 return i + 1;
841 }
842 }
843 if (sl == 2 && (i + 1 >= d->n || L[i + 1].blank)) {
844 d->K[i] = K_COMMENT;
845 return i + 1;
846 }
847 int j = rst_block_end(d, i + 1, ind);
848 rst_mark(d, i, j, K_COMMENT);
849 return j;
850}
851
852static void rst_scan(rst_doc_t *d) {
853 rst_line_t *L = d->L;

Callers 1

rst_scanFunction · 0.85

Calls 4

rst_stripFunction · 0.85
rst_skip_wsFunction · 0.85
rst_block_endFunction · 0.85
rst_markFunction · 0.85

Tested by

no test coverage detected