char_quote • '"' parsing a quote */
| 857 | |
| 858 | /* char_quote • '"' parsing a quote */ |
| 859 | static size_t |
| 860 | char_quote(hoedown_buffer *ob, hoedown_document *doc, uint8_t *data, size_t offset, size_t size) |
| 861 | { |
| 862 | size_t end, nq = 0, i, f_begin, f_end; |
| 863 | |
| 864 | /* counting the number of quotes in the delimiter */ |
| 865 | while (nq < size && data[nq] == '"') |
| 866 | nq++; |
| 867 | |
| 868 | /* finding the next delimiter */ |
| 869 | end = nq; |
| 870 | while (1) { |
| 871 | i = end; |
| 872 | end += find_emph_char(data + end, size - end, '"'); |
| 873 | if (end == i) return 0; /* no matching delimiter */ |
| 874 | i = end; |
| 875 | while (end < size && data[end] == '"' && end - i < nq) end++; |
| 876 | if (end - i >= nq) break; |
| 877 | } |
| 878 | |
| 879 | /* trimming outside spaces */ |
| 880 | f_begin = nq; |
| 881 | while (f_begin < end && data[f_begin] == ' ') |
| 882 | f_begin++; |
| 883 | |
| 884 | f_end = end - nq; |
| 885 | while (f_end > nq && data[f_end-1] == ' ') |
| 886 | f_end--; |
| 887 | |
| 888 | /* real quote */ |
| 889 | if (f_begin < f_end) { |
| 890 | hoedown_buffer *work = newbuf(doc, BUFFER_SPAN); |
| 891 | parse_inline(work, doc, data + f_begin, f_end - f_begin); |
| 892 | |
| 893 | if (!doc->md.quote(ob, work, &doc->data)) |
| 894 | end = 0; |
| 895 | popbuf(doc, BUFFER_SPAN); |
| 896 | } else { |
| 897 | if (!doc->md.quote(ob, 0, &doc->data)) |
| 898 | end = 0; |
| 899 | } |
| 900 | |
| 901 | return end; |
| 902 | } |
| 903 | |
| 904 | |
| 905 | /* char_escape • '\\' backslash escape */ |
nothing calls this directly
no test coverage detected