| 399 | } adr_sec_t; |
| 400 | |
| 401 | static adr_sec_t adr_section_kind(const char *t, size_t n) { |
| 402 | /* a leading "1." / "2.3 " numbering is no part of the title */ |
| 403 | size_t i = 0; |
| 404 | while (i < n && (adr_digit(t[i]) || t[i] == '.')) { |
| 405 | i++; |
| 406 | } |
| 407 | if (i > 0 && i < n && t[i] == ' ') { |
| 408 | t += i + SKIP_ONE; |
| 409 | n -= i + SKIP_ONE; |
| 410 | } |
| 411 | while (n > 0 && (t[n - SKIP_ONE] == ':' || adr_blank(t[n - SKIP_ONE]))) { |
| 412 | n--; |
| 413 | } |
| 414 | if (adr_eq_ci(t, n, "status") || adr_starts_ci(t, n, "status:")) { |
| 415 | return ADR_SEC_STATUS; |
| 416 | } |
| 417 | if (adr_eq_ci(t, n, "context") || adr_starts_ci(t, n, "context and problem") || |
| 418 | adr_eq_ci(t, n, "problem") || adr_eq_ci(t, n, "problem statement") || |
| 419 | adr_eq_ci(t, n, "background") || adr_eq_ci(t, n, "motivation")) { |
| 420 | return ADR_SEC_CONTEXT; |
| 421 | } |
| 422 | if (adr_eq_ci(t, n, "decision outcome")) { |
| 423 | return ADR_SEC_OUTCOME; |
| 424 | } |
| 425 | if (adr_eq_ci(t, n, "decision") || adr_eq_ci(t, n, "decisions") || |
| 426 | adr_eq_ci(t, n, "the decision")) { |
| 427 | return ADR_SEC_DECISION; |
| 428 | } |
| 429 | if (adr_eq_ci(t, n, "considered options") || adr_eq_ci(t, n, "options considered") || |
| 430 | adr_eq_ci(t, n, "alternatives") || adr_eq_ci(t, n, "alternatives considered")) { |
| 431 | return ADR_SEC_OPTIONS; |
| 432 | } |
| 433 | if (adr_eq_ci(t, n, "consequences") || adr_starts_ci(t, n, "positive consequences") || |
| 434 | adr_starts_ci(t, n, "negative consequences")) { |
| 435 | return ADR_SEC_CONSEQUENCES; |
| 436 | } |
| 437 | return ADR_SEC_OTHER; |
| 438 | } |
| 439 | |
| 440 | /* ── File names ──────────────────────────────────────────────────── */ |
| 441 |
no test coverage detected