Skip to content

Commit 265945b

Browse files
author
Gerit Wagner
committed
formatter
1 parent cf4f5f0 commit 265945b

2 files changed

Lines changed: 16 additions & 4 deletions

File tree

colrev/packages/toc_sync/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ toc-sync
2121
- add info on "highly cited"
2222
- "retracted"
2323
- "award" (based on LLM?)
24+
- link to example workflow (add option to "tag" colleagues - e.g., in a comment/highlight papers that appear particularly interesting)
2425

2526
## License
2627

colrev/packages/toc_sync/src/toc_sync.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,12 @@
6060
from collections import OrderedDict
6161
from dataclasses import dataclass
6262
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
6469

6570
import colrev.record.record
6671

@@ -338,7 +343,9 @@ def _render_forthcoming_block(records: List[dict], cfg: TocConfig) -> List[str]:
338343
return lines
339344

340345

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]:
342349
lines = [f"## Volume {vol} - Number {iss}\n\n"]
343350
for d in items:
344351
lines.append(_record_to_md_line(d, cfg) + "\n")
@@ -465,10 +472,14 @@ def _append_incremental(
465472
return
466473

467474
# ---- 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+
)
469478

470479
# 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+
):
472483
pass # we'll just splice raw; existing newlines are preserved
473484

474485
new_lines = lines[:first_h2_idx] + insertion + lines[first_h2_idx:]

0 commit comments

Comments
 (0)