End byte of the section that cmds[ci] (a =head or =item) opens. */
| 2448 | |
| 2449 | /* End byte of the section that cmds[ci] (a =head or =item) opens. */ |
| 2450 | static uint32_t pod_section_end(const pod_cmd_t *cmds, int n, int ci, uint32_t pe) { |
| 2451 | const pod_cmd_t *c = &cmds[ci]; |
| 2452 | for (int j = ci + SKIP_ONE; j < n; j++) { |
| 2453 | const pod_cmd_t *d = &cmds[j]; |
| 2454 | if (d->type == POD_CUT) { |
| 2455 | return d->sb; |
| 2456 | } |
| 2457 | if (d->type == POD_HEAD && (c->type == POD_ITEM || d->level <= c->level)) { |
| 2458 | return d->sb; |
| 2459 | } |
| 2460 | if (c->type == POD_ITEM && (d->type == POD_ITEM || d->type == POD_BACK) && |
| 2461 | d->level == c->level) { |
| 2462 | return d->sb; |
| 2463 | } |
| 2464 | } |
| 2465 | return pe; |
| 2466 | } |
| 2467 | |
| 2468 | /* A heading's text with POD formatting codes (X<..>, X<< .. >>) removed and |
| 2469 | * newlines and tabs as spaces. */ |