|
60 | 60 | from collections import OrderedDict |
61 | 61 | from dataclasses import dataclass |
62 | 62 | from pathlib import Path |
63 | | -from typing import Any, Dict, Iterable, List, Optional, Tuple |
| 63 | +from typing import Any |
| 64 | +from typing import Dict |
| 65 | +from typing import Iterable |
| 66 | +from typing import List |
| 67 | +from typing import Optional |
| 68 | +from typing import Tuple |
64 | 69 |
|
65 | 70 | import colrev.record.record |
66 | 71 |
|
@@ -338,7 +343,9 @@ def _render_forthcoming_block(records: List[dict], cfg: TocConfig) -> List[str]: |
338 | 343 | return lines |
339 | 344 |
|
340 | 345 |
|
341 | | -def _render_issue_block(vol: str, iss: str, items: List[dict], cfg: TocConfig) -> List[str]: |
| 346 | +def _render_issue_block( |
| 347 | + vol: str, iss: str, items: List[dict], cfg: TocConfig |
| 348 | +) -> List[str]: |
342 | 349 | lines = [f"## Volume {vol} - Number {iss}\n\n"] |
343 | 350 | for d in items: |
344 | 351 | lines.append(_record_to_md_line(d, cfg) + "\n") |
@@ -465,10 +472,14 @@ def _append_incremental( |
465 | 472 | return |
466 | 473 |
|
467 | 474 | # ---- Find header end (first "## " or EOF if no headings yet) |
468 | | - first_h2_idx = next((i for i, ln in enumerate(lines) if ln.startswith("## ")), len(lines)) |
| 475 | + first_h2_idx = next( |
| 476 | + (i for i, ln in enumerate(lines) if ln.startswith("## ")), len(lines) |
| 477 | + ) |
469 | 478 |
|
470 | 479 | # Ensure header ends with a blank line |
471 | | - if first_h2_idx == len(lines) or (first_h2_idx > 0 and not lines[first_h2_idx - 1].endswith("\n")): |
| 480 | + if first_h2_idx == len(lines) or ( |
| 481 | + first_h2_idx > 0 and not lines[first_h2_idx - 1].endswith("\n") |
| 482 | + ): |
472 | 483 | pass # we'll just splice raw; existing newlines are preserved |
473 | 484 |
|
474 | 485 | new_lines = lines[:first_h2_idx] + insertion + lines[first_h2_idx:] |
|
0 commit comments