위키 정리: 표준 AI WIKI 플랫폼 구조 적용
- 표준(diadmin/AI_Wiki_Platform 38f17d7)을 new_project.py 방식으로 복사: PROJECT.md(개발용 · windows, mac, linux), CLAUDE.md, .claude, .obsidian, raw, assets, tools, wiki/00~09·99 (08_화면은 빈 구조, 포탈 예시 제외) - 프로젝트 문서 wiki/10_JJ_Ollama_Manager/: 00_홈(예전 wiki/00 홈.md 갱신 - host 방식·포트 전달), 01_설치, 02_메뉴_사용법, 03_ComfyUI, 04_문제_해결, 05_변경_기록, 06_작업_현황 (Gitea 위키 6페이지 + 10/29~11/3 내용 통합) - 사용자 지시 기록 20261103_1657_위키_정리 - .gitignore/.gitattributes 표준 규칙 합침, README에 위키 안내 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K3UWnbHEdCxxWhyNx7Cpd2
This commit is contained in:
75
tools/build_menu.py
Normal file
75
tools/build_menu.py
Normal file
@@ -0,0 +1,75 @@
|
||||
"""폴더 = 메뉴. wiki/08_화면 의 폴더 구조로 메뉴 HTML 과 화면목록.md 를 만든다.
|
||||
폴더 이름 규칙: 숫자_메뉴이름 (숫자 = 순서). 폴더를 바꾸고 다시 실행하면 메뉴도 같이 바뀐다.
|
||||
사용: python tools/build_menu.py → wiki/08_화면/menu.html, wiki/08_화면/00_화면목록.md"""
|
||||
import pathlib, re, html, urllib.parse
|
||||
ROOT = pathlib.Path(__file__).resolve().parent.parent
|
||||
SCR = ROOT / "wiki" / "08_화면"
|
||||
PAT = re.compile(r"^(\d+)_(.+)$")
|
||||
|
||||
def menu_dirs(d):
|
||||
return sorted([p for p in d.iterdir() if p.is_dir() and PAT.match(p.name)], key=lambda p: int(PAT.match(p.name)[1]))
|
||||
|
||||
def label(p):
|
||||
return PAT.match(p.name)[2]
|
||||
|
||||
def status(p):
|
||||
f = p / "화면설명.md"
|
||||
if f.exists():
|
||||
m = re.search(r"^status:\s*(\S+)", f.read_text(encoding="utf-8"), re.M)
|
||||
if m: return m[1]
|
||||
return "없음"
|
||||
|
||||
def rel(p):
|
||||
return urllib.parse.quote(p.relative_to(SCR).as_posix())
|
||||
|
||||
def tree_html(d, depth=0):
|
||||
out = []
|
||||
for p in menu_dirs(d):
|
||||
imgs = sorted(p.glob("화면*.png"))
|
||||
img = "|".join(rel(i) for i in imgs) # 슬라이드가 여러 장이면 전부 표시
|
||||
proto = rel(p / "prototype.html") if (p / "prototype.html").exists() else "" # 실행 가능한 시제품
|
||||
out.append(f'<li><a href="#" data-img="{img}" data-proto="{proto}" data-md="{rel(p / "화면설명.md")}">'
|
||||
f'{html.escape(label(p))} <small>[{status(p)}]</small></a>')
|
||||
sub = tree_html(p, depth + 1)
|
||||
if sub: out.append(f"<ul>{sub}</ul>")
|
||||
out.append("</li>")
|
||||
return "".join(out)
|
||||
|
||||
def tree_md(d, depth=0):
|
||||
lines = []
|
||||
for p in menu_dirs(d):
|
||||
link = (p / "화면설명").relative_to(SCR.parent).as_posix()
|
||||
lines.append(f"{' ' * depth}- [[{link}|{label(p)}]] `{status(p)}`")
|
||||
lines += tree_md(p, depth + 1)
|
||||
return lines
|
||||
|
||||
PAGE = """<!DOCTYPE html><html lang="ko"><head><meta charset="utf-8"><title>화면 메뉴 미리보기</title>
|
||||
<style>body{margin:0;display:flex;height:100vh;font-family:'Malgun Gothic',sans-serif}
|
||||
nav{width:300px;overflow:auto;border-right:1px solid #ccc;padding:12px;background:#f7f7f9}
|
||||
nav ul{list-style:none;padding-left:16px}nav a{text-decoration:none;color:#222;display:block;padding:3px}
|
||||
nav a.on{background:#2b6cb0;color:#fff;border-radius:4px}small{color:#888}nav a.on small{color:#dde}
|
||||
main{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;background:#e9ecef}
|
||||
#tabs{margin:8px}#tabs button{margin:0 3px;padding:4px 12px;border:1px solid #2b6cb0;background:#fff;color:#2b6cb0;border-radius:4px;cursor:pointer}#tabs button.on{background:#2b6cb0;color:#fff}#tabs a.run{margin-left:12px;padding:4px 12px;background:#f6ad55;color:#222;border-radius:4px;text-decoration:none;font-weight:bold}
|
||||
img{max-width:95%;max-height:88vh;box-shadow:0 2px 12px #0003;background:#fff}#t{margin:8px;color:#555}</style></head>
|
||||
<body><nav><b>메뉴 (폴더 구조)</b><ul>__TREE__</ul></nav><main><div id="tabs"></div><img id="v" alt=""><div id="t">왼쪽 메뉴를 누르면 화면이 보입니다</div></main>
|
||||
<script>document.querySelectorAll('nav a').forEach(a=>a.onclick=e=>{e.preventDefault();
|
||||
document.querySelectorAll('nav a').forEach(x=>x.classList.remove('on'));a.classList.add('on');
|
||||
const imgs=(a.dataset.img||'').split('|').filter(x=>x);const tb=document.getElementById('tabs');tb.innerHTML='';
|
||||
const show=i=>{document.getElementById('v').src=imgs[i]||'';
|
||||
document.getElementById('t').textContent=imgs.length?decodeURIComponent(imgs[i]):'화면 이미지가 아직 없습니다';
|
||||
tb.querySelectorAll('button').forEach((b,j)=>b.classList.toggle('on',i==j));};
|
||||
if(imgs.length>1)imgs.forEach((x,i)=>{const b=document.createElement('button');b.textContent='화면 '+(i+1);b.onclick=()=>show(i);tb.appendChild(b);});
|
||||
if(a.dataset.proto){const r=document.createElement('a');r.className='run';r.href=a.dataset.proto;r.target='_blank';r.textContent='▶ 실행해 보기';tb.appendChild(r);}
|
||||
show(0);});
|
||||
const f=document.querySelector('nav a');if(f)f.click();</script></body></html>"""
|
||||
|
||||
def main():
|
||||
(SCR / "menu.html").write_text(PAGE.replace("__TREE__", tree_html(SCR)), encoding="utf-8")
|
||||
md = ["# 00_화면목록 (자동 생성 — 직접 수정하지 마세요)", "",
|
||||
"폴더를 추가/이름변경하고 `python tools/build_menu.py` 를 실행하면 갱신됩니다.",
|
||||
"브라우저 미리보기: `wiki/08_화면/menu.html`", ""] + tree_md(SCR)
|
||||
(SCR / "00_화면목록.md").write_text("\n".join(md) + "\n", encoding="utf-8")
|
||||
print("메뉴 갱신 완료:", SCR / "menu.html")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user