MCPcopy Create free account
hub / github.com/Qinbf/groundmap / _resolve_source_entry

Function _resolve_source_entry

scripts/k.py:1117–1128  ·  view source on GitHub ↗

解析 sources[] 里的一条字符串(典型如 "[[wiki/sources/X]]" 或 "[[raw/papers/X]]"), 返回 (target_file_exists, resolved_md_path)。 非 wikilink 字符串(纯文本 caption 等)返回 (True, None) — 无法校验,跳过。

(src: str)

Source from the content-addressed store, hash-verified

1115
1116
1117def _resolve_source_entry(src: str) -> tuple[bool, str | None]:
1118 """解析 sources[] 里的一条字符串(典型如 "[[wiki/sources/X]]" 或 "[[raw/papers/X]]"),
1119 返回 (target_file_exists, resolved_md_path)。
1120
1121 非 wikilink 字符串(纯文本 caption 等)返回 (True, None) — 无法校验,跳过。
1122 """
1123 links = parse_wikilinks(src)
1124 if not links:
1125 return True, None
1126 target_norm = normalize_link_target(links[0].target)
1127 full_path = PROJECT_ROOT / target_norm
1128 return full_path.exists(), target_norm
1129
1130
1131def _has_block_citation(content: str) -> bool:

Callers 1

list_source_count_issuesFunction · 0.85

Calls 2

parse_wikilinksFunction · 0.85
normalize_link_targetFunction · 0.85

Tested by

no test coverage detected