| 816 | } |
| 817 | |
| 818 | static 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 | |
| 852 | static void rst_scan(rst_doc_t *d) { |
| 853 | rst_line_t *L = d->L; |
no test coverage detected