File tree Expand file tree Collapse file tree 3 files changed +45
-0
lines changed
Expand file tree Collapse file tree 3 files changed +45
-0
lines changed Original file line number Diff line number Diff line change 22
33各ディレクトリのREADMEにプログラム固有の説明があります。
44
5+ ## デモ
6+
7+ - https://shimizukawa.github.io/pyxel-app/
8+
59## 実行
610
711以下は、共通の起動方法など。
Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html >
3+ < head >
4+ < title > Pyxel Sample Apps by shimizukawa</ title >
5+ </ head >
6+
7+ < body >
8+ < h1 > Pyxel Sample Apps by shimizukawa</ h1 >
9+ < table >
10+ < thead >
11+ < tr >
12+ < th > Title</ th >
13+ < th > Demo</ th >
14+ < th > Source</ th >
15+ </ tr >
16+ </ thead >
17+ < tbody >
18+ < tr >
19+ < td > {packagename}</ td > < td > < a href ="{packagename}.html "> Demo</ a > </ td > < td > < a href ="https://github.com/shimizukawa/pyxel-app/tree/master/{packagename}/ "> Code</ a > </ td >
20+ </ tr >
21+ </ tbody >
22+ </ table >
23+ </ body >
24+ </ html >
Original file line number Diff line number Diff line change @@ -24,12 +24,29 @@ def process_directory(directory: Path):
2424 shutil .copytree (Path (f"{ directory } /assets" ), "dist/assets" , dirs_exist_ok = True )
2525
2626
27+ def create_index_html (packagenames ):
28+ with Path ("index.html" ).open ("r" ) as f :
29+ template = f .read ()
30+ lines = template .splitlines (keepends = True )
31+ with Path ("dist/index.html" ).open ("w" ) as f :
32+ for line in lines :
33+ if "{packagename}" in line :
34+ for packagename in packagenames :
35+ f .write (line .format (packagename = packagename ))
36+ else :
37+ f .write (line )
38+
39+
2740def main ():
2841 Path ("./dist" ).mkdir (exist_ok = True , parents = True )
42+ packagenames = []
2943 # 数字で始まるサブディレクトリを処理
3044 for directory in Path ("." ).glob ("[0-9][0-9]-*" ):
3145 if directory .is_dir ():
3246 process_directory (directory )
47+ packagenames .append (str (directory ))
48+
49+ create_index_html (packagenames )
3350
3451
3552if __name__ == "__main__" :
You can’t perform that action at this time.
0 commit comments