Past the HTML comment, CDATA section or processing instruction that starts * at s[i]; 0 when s[i] starts none of them. One whose end marker is missing is * plain text, and so is every later one of its kind: the search for the marker * runs once per paragraph. */
| 1826 | * plain text, and so is every later one of its kind: the search for the marker |
| 1827 | * runs once per paragraph. */ |
| 1828 | static uint32_t rs_inline_raw_html(rs_inline_t *in, uint32_t i, bool *is_raw) { |
| 1829 | static const char comment[] = "<!--"; |
| 1830 | static const char cdata[] = "<![CDATA["; |
| 1831 | static const char pi[] = "<?"; |
| 1832 | const char *p = in->s + i; |
| 1833 | uint32_t n = in->n - i; |
| 1834 | const char *end_mark = NULL; |
| 1835 | bool *none = NULL; |
| 1836 | uint32_t skip = 0; |
| 1837 | if (n >= sizeof(comment) - SKIP_ONE && memcmp(p, comment, sizeof(comment) - SKIP_ONE) == 0) { |
| 1838 | end_mark = "-->"; |
| 1839 | none = &in->no_comment_end; |
| 1840 | skip = sizeof(comment) - SKIP_ONE; |
| 1841 | } else if (n >= sizeof(cdata) - SKIP_ONE && memcmp(p, cdata, sizeof(cdata) - SKIP_ONE) == 0) { |
| 1842 | end_mark = "]]>"; |
| 1843 | none = &in->no_cdata_end; |
| 1844 | skip = sizeof(cdata) - SKIP_ONE; |
| 1845 | } else if (n >= sizeof(pi) - SKIP_ONE && memcmp(p, pi, sizeof(pi) - SKIP_ONE) == 0) { |
| 1846 | end_mark = "?>"; |
| 1847 | none = &in->no_pi_end; |
| 1848 | skip = sizeof(pi) - SKIP_ONE; |
| 1849 | } |
| 1850 | *is_raw = end_mark != NULL; |
| 1851 | if (!end_mark || *none) { |
| 1852 | return 0; |
| 1853 | } |
| 1854 | uint32_t end = rs_find_after(in, i + skip, end_mark); |
| 1855 | *none = end == 0; |
| 1856 | return end; |
| 1857 | } |
| 1858 | |
| 1859 | /* Past the autolink or HTML construct at s[i] == '<', or i + 1 when it is |
| 1860 | * neither. */ |
no test coverage detected