MCPcopy Create free account
hub / github.com/RASAAS/docmcp-knowledge / main

Function main

scripts/sync_zh_fulltext.py:55–77  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

53 if "{{" not in text:
54 return text
55 parts = []
56 i = 0
57 for m in re.finditer(r'\{\{[\s\S]*?\}\}', text):
58 if m.start() < i:
59 continue
60 before = text[max(0, m.start() - 20) : m.start()]
61 if before.endswith("<span v-pre>"):
62 continue
63 parts.append(text[i : m.start()])
64 parts.append(f"<span v-pre>{m.group(0)}</span>")
65 i = m.end()
66 parts.append(text[i:])
67 return "".join(parts)
68
69
70def sync_page(docs_path: Path, zh_fulltext_path: Path, dry_run: bool = False) -> bool:
71 if not docs_path.exists():
72 return False
73 if not zh_fulltext_path.exists():
74 return False
75
76 page_text = docs_path.read_text(encoding="utf-8")
77 marker_pos = page_text.find(FULLTEXT_MARKER)
78 if marker_pos == -1:
79 return False
80

Callers 1

Calls 1

sync_pageFunction · 0.85

Tested by

no test coverage detected