Append src[b, e) of the current block to the module doc, after a blank * line, unless it holds no text. */
| 2692 | /* Append src[b, e) of the current block to the module doc, after a blank |
| 2693 | * line, unless it holds no text. */ |
| 2694 | static void pod_module_run(pod_module_t *m, uint32_t b, uint32_t e) { |
| 2695 | const char *src = m->ctx->source; |
| 2696 | while (b < e) { /* leading blank lines */ |
| 2697 | uint32_t le = b; |
| 2698 | while (le < e && src[le] != '\n') { |
| 2699 | le++; |
| 2700 | } |
| 2701 | if (!pod_line_is_blank(src, b, le)) { |
| 2702 | break; |
| 2703 | } |
| 2704 | b = le < e ? le + SKIP_ONE : e; |
| 2705 | } |
| 2706 | e = pod_trim_end(src, b, e); |
| 2707 | if (b >= e || !pod_run_has_text(src, b, e)) { |
| 2708 | return; |
| 2709 | } |
| 2710 | if (m->first_line == 0) { |
| 2711 | uint32_t line = ts_node_start_point(m->block).row + SKIP_ONE; |
| 2712 | for (uint32_t k = ts_node_start_byte(m->block); k < b; k++) { |
| 2713 | line += src[k] == '\n' ? SKIP_ONE : 0; |
| 2714 | } |
| 2715 | m->first_line = line; |
| 2716 | } |
| 2717 | if (m->w > 0) { |
| 2718 | m->buf[m->w++] = '\n'; |
| 2719 | m->buf[m->w++] = '\n'; |
| 2720 | } |
| 2721 | memcpy(m->buf + m->w, src + b, e - b); |
| 2722 | m->w += e - b; |
| 2723 | } |
| 2724 | |
| 2725 | /* Perl's module doc, for the File node: the file's POD outside the sections a |
| 2726 | * sub's doc holds, so that no reference is read twice. Every POD block with |
no test coverage detected