Skip to content

Commit be29386

Browse files
committed
add github page index
1 parent 0dfdc22 commit be29386

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
各ディレクトリのREADMEにプログラム固有の説明があります。
44

5+
## デモ
6+
7+
- https://shimizukawa.github.io/pyxel-app/
8+
59
## 実行
610

711
以下は、共通の起動方法など。

index.html

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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>

make.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff 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+
2740
def 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

3552
if __name__ == "__main__":

0 commit comments

Comments
 (0)