Merge branch 'main' into 홈페이지-레이아웃-구상
# Conflicts: # docs/DEVLOG.md # solution/backend/crud/site_crud.py # solution/backend/router/router.py # solution/backend/router/v1/site/protocol.py
This commit is contained in:
commit
41e49c693b
77 files changed
+4828
-658
No files matched your search
@@ -196,6 +196,15 @@ def fake_renderer(monkeypatch, tmp_path_factory):
|
||||
# 고유 콘텐츠 계수 규칙은 렌더러(prerender.ts countUniqueContent)와 같아야 한다.
|
||||
MIN_UNIQUE_TEXT = 8
|
||||
|
||||
def _has_long_text(value, long) -> bool:
|
||||
if isinstance(value, str):
|
||||
return long(value)
|
||||
if isinstance(value, list):
|
||||
return any(_has_long_text(v, long) for v in value)
|
||||
if isinstance(value, dict):
|
||||
return any(_has_long_text(v, long) for v in value.values())
|
||||
return False
|
||||
|
||||
def _count(payload: dict) -> int:
|
||||
def long(value) -> bool:
|
||||
return len(str(value or "").strip()) >= MIN_UNIQUE_TEXT
|
||||
@@ -207,6 +216,17 @@ def fake_renderer(monkeypatch, tmp_path_factory):
|
||||
)
|
||||
if intro and intro.get("enabled") and long(intro.get("body")):
|
||||
count += 1
|
||||
# 붙여넣기 아이템(theme.sections[].data)의 항목도 고유 콘텐츠다 — 렌더러와 같은 규칙.
|
||||
for section in (payload.get("theme") or {}).get("sections") or []:
|
||||
if not section.get("enabled") or not section.get("data"):
|
||||
continue
|
||||
try:
|
||||
envelope = json.loads(section["data"])
|
||||
except (ValueError, TypeError):
|
||||
continue
|
||||
for item in (envelope or {}).get("items") or []:
|
||||
if _has_long_text(item, long):
|
||||
count += 1
|
||||
facts = list(payload.get("facts") or [])
|
||||
for unit in payload.get("units") or []:
|
||||
facts.extend(unit.get("facts") or [])
|
||||
|
||||
Reference in new issue
Block a user